summary refs log tree commit diff
path: root/tests/ui/consts/static_mut_containing_mut_ref2.rs
blob: 39162d6f7e5eaccbe666b1d9cc331e6ad89160a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// revisions: stock 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 mutable references are not allowed in statics
    //[mut_refs]~^^^ WARN creating a mutable reference to mutable static is discouraged [static_mut_refs]
    //[stock]~^^^^ WARN creating a mutable reference to mutable static is discouraged [static_mut_refs]
};

fn main() {}