]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/issue-17718-const-borrow.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / consts / issue-17718-const-borrow.rs
CommitLineData
1a4d82fc
JJ
1use std::cell::UnsafeCell;
2
62682a34 3const A: UnsafeCell<usize> = UnsafeCell::new(1);
1a4d82fc 4const B: &'static UnsafeCell<usize> = &A;
5869c6ff 5//~^ ERROR: cannot refer to interior mutable
1a4d82fc
JJ
6
7struct C { a: UnsafeCell<usize> }
62682a34 8const D: C = C { a: UnsafeCell::new(1) };
1a4d82fc 9const E: &'static UnsafeCell<usize> = &D.a;
5869c6ff 10//~^ ERROR: cannot refer to interior mutable
1a4d82fc 11const F: &'static C = &D;
5869c6ff 12//~^ ERROR: cannot refer to interior mutable
1a4d82fc
JJ
13
14fn main() {}