]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-address-of-interior-mut.rs
Do not suggest `let_else` if no bindings would be introduced
[rust.git] / src / test / ui / consts / const-address-of-interior-mut.rs
1 #![feature(raw_ref_op)]
2
3 use std::cell::Cell;
4
5 const A: () = { let x = Cell::new(2); &raw const x; };      //~ ERROR interior mutability
6
7 static B: () = { let x = Cell::new(2); &raw const x; };     //~ ERROR interior mutability
8
9 static mut C: () = { let x = Cell::new(2); &raw const x; }; //~ ERROR interior mutability
10
11 const fn foo() {
12     let x = Cell::new(0);
13     let y = &raw const x;                                   //~ ERROR interior mutability
14 }
15
16 fn main() {}