Open
Description
Code
static DANGLING: &mut () = unsafe { &mut *(1 as *mut ()) };
const WUT: &mut () = DANGLING;
Current output
error[E0596]: cannot borrow `*DANGLING` as mutable, as `DANGLING` is an immutable static item
--> src/lib.rs:2:22
|
2 | const WUT: &mut () = DANGLING;
| ^^^^^^^^ cannot borrow as mutable
For more information about this error, try `rustc --explain E0596`.
error: could not compile `playground` (lib) due to 1 previous error
Desired output
Mention the fact that &mut T doesn't implement Copy.
Rationale and extra context
Found while investigating #140123
Other cases
Rust Version
Reproducible on the playground with version 1.89.0-nightly (2025-06-11 e703dff8fe220b78195c)
Anything else?
No response