Skip to content

Inlay type hints didn't show for chained expressions in attribute macros #18471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xky0007 opened this issue Nov 4, 2024 · 4 comments
Open
Labels
A-inlay-hints inlay/inline hints C-bug Category: bug

Comments

@xky0007
Copy link

xky0007 commented Nov 4, 2024

rust-analyzer version: rust-analyzer version: 0.3.2162-standalone (3b3a87fe9 2024-10-27)

rustc version: rustc 1.82.0 (f6e511eec 2024-10-15)

editor or extension: Vs-Code

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:

use reqwest::header::{HeaderMap, HeaderValue};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let client = reqwest::Client::new();

    // Create custom headers
    let mut headers = HeaderMap::new();
    headers.insert("Authorization", HeaderValue::from_static("Bearer  "));

    // Send HTTP GET request
    let response = client
        .post("https://n.cg.163.com/api/v2/sign-today")
        .headers(headers)  
        .send()
        .await?;

    println!("Status: {}", response.status());
    println!("Content: {}", response.text().await?);
    Ok(())
}

Type hints didn't show after first line of chained expressions.
Image

@xky0007 xky0007 added the C-bug Category: bug label Nov 4, 2024
@ShoyuVanilla ShoyuVanilla added the A-inlay-hints inlay/inline hints label Nov 6, 2024
@npajkovsky

This comment has been minimized.

@ChayimFriedman2

This comment has been minimized.

@ChayimFriedman2
Copy link
Contributor

ChayimFriedman2 commented Jan 7, 2025

So I investigated this a bit and this is caused by the tokio::test macro.

@ChayimFriedman2 ChayimFriedman2 changed the title Inlay type hints didn't show for chained expressions Inlay type hints didn't show for chained expressions in attribute macros Jan 7, 2025
@Veykril
Copy link
Member

Veykril commented Jan 7, 2025

Odd, the spans of those expressions shouldn't be re-used so I'd expect this to work. I guess we do the upmapping a bit weirdly in the chaining hints? (the macro handling in hints is a bit chaotic anyways iirc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inlay-hints inlay/inline hints C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

5 participants