File tree 1 file changed +17
-1
lines changed
src/doc/unstable-book/src/compiler-flags
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
5
5
------------------------
6
6
7
7
This 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.
9
10
10
11
When retrieving an environment variable value, the one specified by ` --env ` will take
11
12
precedence. For example, if you want have ` PATH=a ` in your environment and pass:
@@ -20,6 +21,21 @@ Then you will have:
20
21
assert_eq!(env!("PATH"), "env");
21
22
```
22
23
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
+
23
39
Please note that on Windows, environment variables are case insensitive but case
24
40
preserving whereas ` rustc ` 's environment variables are case sensitive. For example,
25
41
having ` Path ` in your environment (case insensitive) is different than using
You can’t perform that action at this time.
0 commit comments