1 use std
::cell
::UnsafeCell
;
3 const A
: UnsafeCell
<usize> = UnsafeCell
::new(1);
4 const B
: &'
static UnsafeCell
<usize> = &A
;
5 //~^ ERROR: cannot borrow a constant which may contain interior mutability
7 struct C { a: UnsafeCell<usize> }
8 const D
: C
= C { a: UnsafeCell::new(1) }
;
9 const E
: &'
static UnsafeCell
<usize> = &D
.a
;
10 //~^ ERROR: cannot borrow a constant which may contain interior mutability
11 const F
: &'
static C
= &D
;
12 //~^ ERROR: cannot borrow a constant which may contain interior mutability