16 lines
667 B
Plaintext
16 lines
667 B
Plaintext
error[E0796]: reference of mutable static is disallowed
|
|
--> $DIR/reference-of-mut-static-safe.rs:9:14
|
|
|
|
|
LL | let _x = &X;
|
|
| ^^ reference of mutable static
|
|
|
|
|
= note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
|
|
help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
|
|
|
|
|
LL | let _x = addr_of!(X);
|
|
| ~~~~~~~~~~~
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0796`.
|