|
1 |
| -warning: shared reference of mutable static is discouraged |
| 1 | +warning: shared reference to mutable static is discouraged |
2 | 2 | --> $DIR/static-mut-foreign.rs:35:18
|
3 | 3 | |
|
4 | 4 | LL | static_bound(&rust_dbg_static_mut);
|
5 |
| - | ^^^^^^^^^^^^^^^^^^^^ shared reference of mutable static |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static |
6 | 6 | |
|
7 | 7 | = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
|
8 |
| - = note: reference of mutable static is a hard error from 2024 edition |
9 |
| - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior |
10 |
| - = note: `#[warn(static_mut_ref)]` on by default |
| 8 | + = note: this will be a hard error in the 2024 edition |
| 9 | + = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior |
| 10 | + = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior |
| 11 | + = note: `#[warn(static_mut_refs)]` on by default |
11 | 12 | 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
|
12 | 13 | |
|
13 | 14 | LL | static_bound(addr_of!(rust_dbg_static_mut));
|
14 | 15 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
15 | 16 |
|
16 |
| -warning: mutable reference of mutable static is discouraged |
| 17 | +warning: mutable reference to mutable static is discouraged |
17 | 18 | --> $DIR/static-mut-foreign.rs:37:22
|
18 | 19 | |
|
19 | 20 | LL | static_bound_set(&mut rust_dbg_static_mut);
|
20 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference of mutable static |
| 21 | + | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference to mutable static |
21 | 22 | |
|
22 | 23 | = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
|
23 |
| - = note: reference of mutable static is a hard error from 2024 edition |
24 |
| - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior |
| 24 | + = note: this will be a hard error in the 2024 edition |
| 25 | + = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior |
| 26 | + = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior |
25 | 27 | help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
|
26 | 28 | |
|
27 | 29 | LL | static_bound_set(addr_of_mut!(rust_dbg_static_mut));
|
|
0 commit comments