File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
src/doc/unstable-book/src/compiler-flags Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ 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.
10+
11+ This information will be stored in the dep-info files.
912
1013When retrieving an environment variable value, the one specified by ` --env ` will take
1114precedence. For example, if you want have ` PATH=a ` in your environment and pass:
@@ -20,6 +23,21 @@ Then you will have:
2023assert_eq!(env!("PATH"), "env");
2124```
2225
26+ It will trigger a new compilation if any of the ` --env ` argument value is different.
27+ So if you first passed:
28+
29+ ``` bash
30+ --env A=B --env X=12
31+ ```
32+
33+ and then on next compilation:
34+
35+ ``` bash
36+ --env A=B
37+ ```
38+
39+ ` X ` value is different (not set) so the code will be re-compiled.
40+
2341Please note that on Windows, environment variables are case insensitive but case
2442preserving whereas ` rustc ` 's environment variables are case sensitive. For example,
2543having ` Path ` in your environment (case insensitive) is different than using
You can’t perform that action at this time.
0 commit comments