Description
rust-analyzer version: 0.3.2053-standalone (fd74511 2024-07-28)
rustc version: 1.80.0
editor or extension: VSCode
repository link (if public, optional): https://github.com/binary-banter/test-each-file/tree/repro
code snippet to reproduce:
Given this code:
use std::path::Path;
use test_macro::test_each_file;
fn main() {
test_each_file!();
assert!(Path::new("./ROOT.txt").is_file());
println!("Hello, world!");
}
...referencing this macro:
use std::path::Path;
#[proc_macro]
pub fn test_each_file(_input: proc_macro::TokenStream) -> proc_macro::TokenStream {
assert!(Path::new("./ROOT.txt").is_file());
proc_macro::TokenStream::new()
}
...rustc finds ROOT.txt
at the root of the workspace. But rust-analyzer instead looks for ROOT.txt
at the root of the crate. This means that rust-analyzer shows errors for this path despite it compiling with rustc
fine.
ref binary-banter/test-each-file#6. Repo with a repro linked above.