Skip to content

"not implemented" macro_error with rustc nightly feature "source_file" #11264

@yezuochang

Description

@yezuochang

rust-analyzer version: rust-analyzer 5478242 2022-01-12 nightly
rustc version: nightly-2021-12-20-x86_64-unknown-linux-gnu

When using the span().source_file() to get the path of the caller, RA reports the "not implemented" macro error.

The code works find with cargo build.

The whole project reproducing the issue is in: https://github.com/yezuochang/proc_macro_example

#[proc_macro]
pub fn testmacro(input: TokenStream) -> TokenStream {
    let _caller_path = input
        .clone()
        .into_iter()
        .last()
        .unwrap()
        .span()
        .source_file()
        .path();
    return input;
}

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macromacro expansion

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions