2025-04-20 10:51:19 +09:00
warning: creating a shared reference to mutable static
2023-12-22 15:12:01 +03:00
--> $DIR/static-recursive.rs:3:36
|
LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 };
2024-02-17 22:01:56 +03:00
| ^^ shared reference to mutable static
2023-12-22 15:12:01 +03:00
|
2025-07-16 01:44:02 -07:00
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
2024-08-24 06:49:09 +03:00
= 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
2025-04-28 13:47:25 +02:00
= note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default
2024-08-24 06:49:09 +03:00
help: use `&raw const` instead to create a raw pointer
2023-12-22 15:12:01 +03:00
|
2025-02-13 02:54:07 +00:00
LL | static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 };
2025-02-13 03:21:25 +00:00
| +++++++++
2023-12-22 15:12:01 +03:00
2025-04-20 10:51:19 +09:00
warning: creating a shared reference to mutable static
2024-08-24 06:49:09 +03:00
--> $DIR/static-recursive.rs:19:20
|
LL | assert_eq!(S, *(S as *const *const u8));
| ^ shared reference to mutable static
|
2025-07-16 01:44:02 -07:00
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
2024-08-24 06:49:09 +03:00
= 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
warning: 2 warnings emitted
2023-12-22 15:12:01 +03:00