You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Hi, is there anything preventing this to be stabilized? It's pretty important as ninja cannot set env when running rustc commands. It makes using rustc outside of cargo (e.g. Meson) harder.
Activity
tgross35 commentedon Jan 11, 2024
Ongoing zulip discussion: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Stabilizing.20.60--env.60.20option.20flag.3F
GuillaumeGomez commentedon Jan 13, 2024
We discussed about how it might impact rust-lang/rfcs#2794 and decided to rename it into
--env-setto prevent potential future issues.[-]Tracking issue for `--env` flag[/-][+]Tracking issue for `--env-set` flag[/+]fenollp commentedon Aug 23, 2024
Hi! I see the stabilization PR was closed. What's the state of this then?
My 2cents on a couple points:
$RUSTC_WRAPPERknows which envs to forward torustc. Can't just forward all the envs.--env-set KEY=..should be an error. It resolves that point and allows forward compatibilityIf help is needed here I'd like to provide some!
xclaesse commentedon Jun 5, 2025
Hi, is there anything preventing this to be stabilized? It's pretty important as ninja cannot set env when running rustc commands. It makes using rustc outside of cargo (e.g. Meson) harder.
tools/mount-flatpak: init
Urgau commentedon Aug 31, 2026
Removed in #161831