-
Notifications
You must be signed in to change notification settings - Fork 161
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
Implement env!()
builtin macro
#977
Comments
Rustc has a dep file extension showing which env vars are read and if valid UTF-8 what value saod env vars had. This is used by cargo to rebuild if the env vars change. |
Oh that's really smart. I think this is still a little far for gccrs but we should keep it in mind. I'm guessing this is what this line is for, then. We'll definitely need to look into it before compiling actual projects |
Yes, and this is where it is emitted: https://github.com/rust-lang/rust/blob/45e2c2881d11324d610815bfff097e25c412199e/compiler/rustc_interface/src/passes.rs#L703-L706 And this is the PR originally implementing it: rust-lang/rust#71858 |
Hi, I would like to work on this issue. |
Hi @omachota, and welcome! I've assigned you the issue. Feel free to ask any questions here |
env!()
is part of the list of builtin macros enumerated hereIts description is as follows:
The goal is to fetch environment variables passed to gccrs, and expand them into the user's compiled code.
The macro should not expand to a function call that fetches environment variables during the user's program's execution.
The original macro contains two match arms, including one with a custom error message:
You should try and support the first form first, by simply fetching an environment variable and creating an associated string using the
make_string
function defined ingcc/rust/expand/rust-macro-builtins.cc
The second form could be implemented in a later PR for simplicity
The text was updated successfully, but these errors were encountered: