about summary refs log tree commit diff
path: root/tests/ui/statics/issue-15261.stderr
blob: 7edd79e08b1ef8b5fe91819d2a811849cb6c2d0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
warning: creating a shared reference to mutable static is discouraged
  --> $DIR/issue-15261.rs:8: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 { &n_mut };
LL + static n: &'static usize = unsafe { &raw const n_mut };
   |

warning: 1 warning emitted