mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
17 lines
812 B
Plaintext
17 lines
812 B
Plaintext
warning: creating a shared reference to mutable static is discouraged
|
|
--> $DIR/issue-15261.rs:9:37
|
|
|
|
|
LL | static n: &'static usize = unsafe { &n_mut };
|
|
| ^^^^^^ shared reference to mutable static
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
|
= note: `#[warn(static_mut_refs)]` on by default
|
|
help: use `&raw const` instead to create a raw pointer
|
|
|
|
|
LL | static n: &'static usize = unsafe { &raw const n_mut };
|
|
| ~~~~~~~~~~
|
|
|
|
warning: 1 warning emitted
|
|
|