You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= 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
11
-
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
-
LL | const C: &i32 = unsafe { addr_of!(S_MUT) };
14
-
| ~~~~~~~~~~~~~~~
15
-
16
1
error[E0080]: it is undefined behavior to use this value
= 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
11
-
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
| ^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference of mutable static
6
-
|
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
11
-
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
| ^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference of mutable static
6
-
|
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
11
-
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
warning: mutable reference of mutable static is discouraged
2
-
--> $DIR/static_mut_containing_mut_ref2.rs:8:6
3
-
|
4
-
LL | *(&mut STDERR_BUFFER_SPACE) = 42;
5
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference of mutable static
6
-
|
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
11
-
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
-
LL | *addr_of_mut!(STDERR_BUFFER_SPACE) = 42;
14
-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
-
16
1
error[E0080]: could not evaluate static initializer
17
2
--> $DIR/static_mut_containing_mut_ref2.rs:8:5
18
3
|
19
4
LL | *(&mut STDERR_BUFFER_SPACE) = 42;
20
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ modifying a static's initial value from another static's initializer
21
6
22
-
error: aborting due to 1 previous error; 1 warning emitted
7
+
error: aborting due to 1 previous error
23
8
24
9
For more information about this error, try `rustc --explain E0080`.
warning: mutable reference of mutable static is discouraged
2
-
--> $DIR/static_mut_containing_mut_ref2.rs:8:6
3
-
|
4
-
LL | *(&mut STDERR_BUFFER_SPACE) = 42;
5
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference of mutable static
6
-
|
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
11
-
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
-
LL | *addr_of_mut!(STDERR_BUFFER_SPACE) = 42;
14
-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
-
16
1
error[E0658]: mutation through a reference is not allowed in statics
0 commit comments