We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
--env
1 parent bafdbae commit 28a7a39Copy full SHA for 28a7a39
src/doc/unstable-book/src/compiler-flags/env.md
@@ -0,0 +1,21 @@
1
+# `env`
2
+
3
+The tracking issue for this feature is: [#118372](https://github.com/rust-lang/rust/issues/118372).
4
5
+------------------------
6
7
+This option flag allows to specify environment variables value at compile time to be
8
+used by `env!` and `option_env!` macros.
9
10
+When retrieving and environment variable value, the one specified by `--env` will take
11
+precedence. For example if you want have `PATH=a` in your environment and pass:
12
13
+```bash
14
+rustc --env PATH=env
15
+```
16
17
+Then you will have:
18
19
+```rust
20
+assert_eq!(env!("PATH"), "env");
21
0 commit comments