-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: Expand proc-macros in workspace root, not package root #17973
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
Conversation
cf55624
to
70ff8fa
Compare
70ff8fa
to
9a47e6f
Compare
@bors r+ |
☀️ Test successful - checks-actions |
Thank you! |
@Veykril thanks for giving this a go. Unfortunately I don't think it solved the problem. The repro in #17748 still fails. I'm on If I augment this to the repro, on nightly rustc: #[proc_macro]
pub fn test_each_file(_input: proc_macro::TokenStream) -> proc_macro::TokenStream {
dbg!(env!("CARGO_MANIFEST_DIR"));
dbg!(std::env::var("CARGO_RUSTC_CURRENT_DIR"));
let current_dir = dbg!(std::env::current_dir().unwrap());
assert!(dbg!(Path::new("./ROOT.txt")).is_file());
assert!(dbg!(Path::new("./ROOT.txt").canonicalize().unwrap()).is_file());
proc_macro::TokenStream::new()
} ...then
But Rust Analyzer Language Server log doesn't find the newly added
(if you don't see this, I'll open a new issue, hope that's reasonable, thank you!) |
Oh I see the issue, the env var is set for the proc-macro crate, but we need to it to be set for the calling crate |
Should fix #17748. The approach is generally not perfect though as rust-project.json projects don't benefit from this (still, nothing changes in that regard)