]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/write_to_mut_ref_dest.rs
Merge commit '928e72dd10749875cbd412f74bfbfd7765dbcd8a' into clippyup
[rust.git] / src / test / ui / consts / write_to_mut_ref_dest.rs
1 // revisions: stock mut_refs
2
3 #![cfg_attr(mut_refs, feature(const_mut_refs))]
4
5 use std::cell::Cell;
6
7 const FOO: &u32 = {
8     let mut a = 42;
9     {
10         let b: *mut u32 = &mut a; //[stock]~ ERROR mutable references are not allowed in constants
11         unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants
12     }
13     &{a}
14 };
15
16 fn main() {}