File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/doc/unstable-book/src/compiler-flags Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ The tracking issue for this feature is: [#118372](https://github.com/rust-lang/r
55------------------------
66
77This option flag allows to specify environment variables value at compile time to be
8- used by ` env! ` and ` option_env! ` macros.
8+ used by ` env! ` and ` option_env! ` macros. It also impacts ` tracked_env::var ` function
9+ from the ` proc_macro ` crate.
910
1011When retrieving an environment variable value, the one specified by ` --env ` will take
1112precedence. For example, if you want have ` PATH=a ` in your environment and pass:
@@ -20,6 +21,21 @@ Then you will have:
2021assert_eq!(env!("PATH"), "env");
2122```
2223
24+ It will trigger a new compilation if any of the ` --env ` argument value is different.
25+ So if you first passed:
26+
27+ ``` bash
28+ --env A=B --env X=12
29+ ```
30+
31+ and then on next compilation:
32+
33+ ``` bash
34+ --env A=B
35+ ```
36+
37+ ` X ` value is different (not set) so the code will be re-compiled.
38+
2339Please note that on Windows, environment variables are case insensitive but case
2440preserving whereas ` rustc ` 's environment variables are case sensitive. For example,
2541having ` Path ` in your environment (case insensitive) is different than using
You can’t perform that action at this time.
0 commit comments