Skip to content

Commit

Permalink
Auto merge of #118368 - GuillaumeGomez:env-flag, r=Nilstrieb
Browse files Browse the repository at this point in the history
Implement `--env` compiler flag (without `tracked_env` support)

Part of rust-lang/rust#80792.
Implementation of rust-lang/compiler-team#653.
Not an implementation of rust-lang/rfcs#2794.

It adds the `--env` compiler flag option which allows to set environment values used by `env!` and `option_env!`.

Important to note: When trying to retrieve an environment variable value, it will first look into the ones defined with `--env`, and if there isn't one, then only it will look into the environment variables. So if you use `--env PATH=a`, then `env!("PATH")` will return `"a"` and not the actual `PATH` value.

As mentioned in the title, `tracked_env` support is not added here. I'll do it in a follow-up PR.

r? rust-lang/compiler
  • Loading branch information
bors committed Dec 10, 2023
2 parents f7cbd7f + 95df081 commit 9cc878d
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 9cc878d

Please sign in to comment.