Skip to content

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

@jhgg

Description

@jhgg

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsdiagnostics / error reportingA-macromacro expansionC-bugCategory: bugS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions