rust/tests/ui/consts/static_mut_containing_mut_ref2.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
387 B
Rust
Raw Normal View History

2019-11-28 11:57:34 -05:00
//@ revisions: stock mut_refs
#![allow(static_mut_refs)]
2019-11-28 11:57:34 -05:00
#![cfg_attr(mut_refs, feature(const_mut_refs))]
2018-12-17 14:20:42 +01:00
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
};
2018-12-17 14:20:42 +01:00
fn main() {}