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 486e55e commit 37d6809Copy full SHA for 37d6809
tests/ui/extenv/extenv-env-overload.rs
@@ -0,0 +1,9 @@
1
+// run-pass
2
+// rustc-env:MY_VAR=tadam
3
+// compile-flags: --env MY_VAR=123abc -Zunstable-options
4
+
5
+// This test ensures that variables provided with `--env` take precedence over
6
+// variables from environment.
7
+fn main() {
8
+ assert_eq!(env!("MY_VAR"), "123abc");
9
+}
tests/ui/extenv/extenv-env.rs
@@ -0,0 +1,5 @@
+// compile-flags: --env FOO=123abc -Zunstable-options
+ assert_eq!(env!("FOO"), "123abc");
tests/ui/extenv/extenv-not-env.rs
@@ -0,0 +1,7 @@
+// rustc-env:MY_ENV=/
+// Ensures that variables not defined through `--env` are still available.
+ assert!(!env!("MY_ENV").is_empty());
0 commit comments