Open
Description
Right now, code can use env!()
and option_env!()
to query arbitrary environment variables set at the time rustc is invoked. This is a subtle leak of the compilation environment into the generated code, which can cause issues with build reproducibility, and could conceivably be considered a security problem.
I'd like to have the option to completely define the "environment" that's available to env!()
on the compiler command line to an explicitly delimited set of names and values
For example:
--override-env
- disable querying of real environment
--set-env name=val
- define an environment variable (added to existing env if --override-env
not set)
--unset-env name
- make a name unset
cc @luser - this seems pertinent to caching rust-lang/cargo#3066