You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of rust-lang#3184 - RalfJung:getenv, r=RalfJung
detect and test for data races between setenv and getenv
But only on Unix; Windows doesn't have such a data race. Also make target_os_is_unix properly check for unix, which then makes our completely empty android files useless.
error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here
2
+
--> $DIR/env-set_var-data-race.rs:LL:CC
3
+
|
4
+
LL | libc::getenv(b"TZ/0".as_ptr().cast());
5
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here
6
+
|
7
+
help: and (1) occurred earlier here
8
+
--> $DIR/env-set_var-data-race.rs:LL:CC
9
+
|
10
+
LL | env::set_var("MY_RUST_VAR", "Ferris");
11
+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
+
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
13
+
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
14
+
= note: BACKTRACE (of the first span):
15
+
= note: inside closure at $DIR/env-set_var-data-race.rs:LL:CC
16
+
17
+
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
0 commit comments