-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Proc macros are executed in the wrong working directory #7057
Comments
It seems fairly hard to obtain the correct directory, since that requires VFS access, and the compiler crates aren't really supposed to have that (they're mostly supposed to care only about |
We already get the dylib path information from |
We already know the crate root of the invoking crate (the |
I feel like this is a very similar thing as e.g. the |
I just reread the bug reported in #7052 (comment) , the actual error is, the proc-macro cannot find the related env OTOH, what is working directory inside proc-macro in rustc ? And is it stable ? |
The working directory is whatever cargo chooses when running rustc. In the past this was the working directory cargo was invoked from. It was later changed to the root of the workspace. I don't think there are any explicit guarantees from cargo. |
Presumably fixed by #11353? |
Reported in #7052 (comment), it seems like proc macros should be executed in the directory containing the invoking crate's main file (
lib.rs
/main.rs
, or whatever would be passed to rustc as the crate root to compile).The text was updated successfully, but these errors were encountered: