You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::path::Path;use test_macro::test_each_file;fnmain(){test_each_file!();assert!(Path::new("./ROOT.txt").is_file());println!("Hello, world!");}
...referencing this macro:
use std::path::Path;#[proc_macro]pubfntest_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.
Expand proc-macros in workspace root, not package root
Should fixrust-lang/rust-analyzer#17748. The approach is generally not perfect though as rust-project.json projects don't benefit from this (still, nothing changes in that regard)
Okay so turns out with this we will have to discard our crate graph deduplication logic as crates are now always unique wrt to their workspace. Unfortunate.
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:
...referencing this macro:
...rustc finds
ROOT.txt
at the root of the workspace. But rust-analyzer instead looks forROOT.txt
at the root of the crate. This means that rust-analyzer shows errors for this path despite it compiling withrustc
fine.ref binary-banter/test-each-file#6. Repo with a repro linked above.
The text was updated successfully, but these errors were encountered: