]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | use std::cell::UnsafeCell; |
2 | ||
62682a34 | 3 | const A: UnsafeCell<usize> = UnsafeCell::new(1); |
1a4d82fc | 4 | const B: &'static UnsafeCell<usize> = &A; |
5869c6ff | 5 | //~^ ERROR: cannot refer to interior mutable |
1a4d82fc JJ |
6 | |
7 | struct C { a: UnsafeCell<usize> } | |
62682a34 | 8 | const D: C = C { a: UnsafeCell::new(1) }; |
1a4d82fc | 9 | const E: &'static UnsafeCell<usize> = &D.a; |
5869c6ff | 10 | //~^ ERROR: cannot refer to interior mutable |
1a4d82fc | 11 | const F: &'static C = &D; |
5869c6ff | 12 | //~^ ERROR: cannot refer to interior mutable |
1a4d82fc JJ |
13 | |
14 | fn main() {} |