Skip to content
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

proc macro errors are attached to the wrong location in diagnostics. #12657

Closed
jhgg opened this issue Jun 30, 2022 · 1 comment · Fixed by #12691
Closed

proc macro errors are attached to the wrong location in diagnostics. #12657

jhgg opened this issue Jun 30, 2022 · 1 comment · Fixed by #12691
Labels
A-diagnostics diagnostics / error reporting A-macro macro expansion C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now

Comments

@jhgg
Copy link
Contributor

jhgg commented Jun 30, 2022

I'm using tokio::main from the tokio 1.19 crate as an example here, but this seems to occur with any proc macro:

Consider the following code where "heck" produces a proc macro error:

#[tokio::main(heck)]
async fn main() {}

fn world() {
    println!("hello");
    println!("hello");
    println!("hello");
    println!("hello");
    println!("hello");
    println!("hello");
    println!("hello");
    println!("hello");
    println!("hello");
}

The diagnostics is attached to a seemingly random line:

image
image

rust-analyzer version: 0.0.0 (b0102bd 2022-06-28)
rustc 1.63.0-nightly (12cd71f4d 2022-06-01)

@jhgg jhgg changed the title proc macro error spans are attached to the wrong location in diagnostics. proc macro errors are attached to the wrong location in diagnostics. Jun 30, 2022
@jhgg
Copy link
Contributor Author

jhgg commented Jun 30, 2022

I bisected this to #12629 cc @flodiebold

@lnicola lnicola added A-macro macro expansion S-actionable Someone could pick this issue up and work on it right now A-diagnostics diagnostics / error reporting C-bug Category: bug labels Jun 30, 2022
@bors bors closed this as completed in fbba1d7 Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting A-macro macro expansion C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants