rust/tests/ui/consts/static_mut_containing_mut_ref2.rs
Obei Sideg 408eeae59d Improve wording of static_mut_ref
Rename `static_mut_ref` lint to `static_mut_refs`.
2024-02-18 06:01:40 +03:00

14 lines
387 B
Rust

//@ revisions: stock mut_refs
#![allow(static_mut_refs)]
#![cfg_attr(mut_refs, feature(const_mut_refs))]
static mut STDERR_BUFFER_SPACE: u8 = 0;
pub static mut STDERR_BUFFER: () = unsafe {
*(&mut STDERR_BUFFER_SPACE) = 42;
//[mut_refs]~^ ERROR could not evaluate static initializer
//[stock]~^^ ERROR mutation through a reference is not allowed in statics
};
fn main() {}