|
1 |
| -warning: mutable reference of mutable static is discouraged |
| 1 | +warning: mutable reference to mutable static is discouraged |
2 | 2 | --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:12:16
|
3 | 3 | |
|
4 | 4 | LL | c1(&mut Y);
|
5 | 5 | | ^^^^^^ mutable reference of 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 |
| 8 | + = note: reference of mutable static is a hard error in 2024 edition |
| 9 | + = note: a shared reference supposedly lives forever, so if there is ever also a mutable reference created that is very dangerous as they can accidentally be used in overlapping ways |
| 10 | + = note: a mutable reference supposedly lives forever, so creating more than one is very dangerous and they can accidentally be used in overlapping ways |
10 | 11 | = note: `#[warn(static_mut_ref)]` on by default
|
11 | 12 | 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
|
12 | 13 | |
|
13 | 14 | LL | c1(addr_of_mut!(Y));
|
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/issue-55492-borrowck-migrate-scans-parents.rs:27:16
|
18 | 19 | |
|
19 | 20 | LL | c1(&mut Z);
|
20 | 21 | | ^^^^^^ mutable reference of 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: reference of mutable static is a hard error in 2024 edition |
| 25 | + = note: a shared reference supposedly lives forever, so if there is ever also a mutable reference created that is very dangerous as they can accidentally be used in overlapping ways |
| 26 | + = note: a mutable reference supposedly lives forever, so creating more than one is very dangerous and they can accidentally be used in overlapping ways |
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 | c1(addr_of_mut!(Z));
|
28 | 30 | | ~~~~~~~~~~~~~~~
|
29 | 31 |
|
30 |
| -warning: mutable reference of mutable static is discouraged |
| 32 | +warning: mutable reference to mutable static is discouraged |
31 | 33 | --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:37
|
32 | 34 | |
|
33 | 35 | LL | borrowck_closures_unique::e(&mut X);
|
34 | 36 | | ^^^^^^ mutable reference of mutable static
|
35 | 37 | |
|
36 | 38 | = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
|
37 |
| - = note: reference of mutable static is a hard error from 2024 edition |
38 |
| - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior |
| 39 | + = note: reference of mutable static is a hard error in 2024 edition |
| 40 | + = note: a shared reference supposedly lives forever, so if there is ever also a mutable reference created that is very dangerous as they can accidentally be used in overlapping ways |
| 41 | + = note: a mutable reference supposedly lives forever, so creating more than one is very dangerous and they can accidentally be used in overlapping ways |
39 | 42 | 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
|
40 | 43 | |
|
41 | 44 | LL | borrowck_closures_unique::e(addr_of_mut!(X));
|
|
0 commit comments