Skip to content
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

Tracking issue for --env-set flag #118372

Open
1 of 3 tasks
GuillaumeGomez opened this issue Nov 27, 2023 · 2 comments · May be fixed by #119926
Open
1 of 3 tasks

Tracking issue for --env-set flag #118372

GuillaumeGomez opened this issue Nov 27, 2023 · 2 comments · May be fixed by #119926
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature.

Comments

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Nov 27, 2023

Adds a new --env-set command line option on rustc. It allows to set environment variables value at compile-time to be used by env! and option_env! macros.

When retrieving and environment variable value, the one specified by --env-set will take precedence. For example if you want have PATH=a in your environment and pass --env-set PATH=env, then you will have:

assert_eq!(env!("PATH"), "env");

Steps

Unresolved questions

  • What is the desired behavior if the same --env variable is passed twice?
@GuillaumeGomez GuillaumeGomez added the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label Nov 27, 2023
@tgross35
Copy link
Contributor

@GuillaumeGomez
Copy link
Member Author

We discussed about how it might impact rust-lang/rfcs#2794 and decided to rename it into --env-set to prevent potential future issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants