-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Env vars set by proc macros should be cleared after a macro expansion #11355
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
Comments
I think sqlx should be changed to read |
Yes, I agree. But also, I think that the expander should be resilient to such an abusing |
Rustc isn't robust against it either. |
Rustc is a bit more robust. Since a new rustc process is created for each crate, these env vars are not shared between crates. |
Some macros change their environment variables. For example,
sqlx
loads all variables from.env
file. These envs can affect the expansion of other macros. For example, ansqlx
macro from crateA
can affectsqlx
macros from crateB
.Demo:
then use them like this:
read_var!()
should be expanded to "good", but it will likely be expanded to "bad".The text was updated successfully, but these errors were encountered: