2014-10-06 23:16:35 -05:00
|
|
|
use std::cell::UnsafeCell;
|
|
|
|
|
2015-05-27 03:18:36 -05:00
|
|
|
const A: UnsafeCell<usize> = UnsafeCell::new(1);
|
2015-01-08 05:02:42 -06:00
|
|
|
const B: &'static UnsafeCell<usize> = &A;
|
2021-01-03 08:46:19 -06:00
|
|
|
//~^ ERROR: cannot refer to interior mutable
|
2014-10-06 23:16:35 -05:00
|
|
|
|
2015-01-08 05:02:42 -06:00
|
|
|
struct C { a: UnsafeCell<usize> }
|
2015-05-27 03:18:36 -05:00
|
|
|
const D: C = C { a: UnsafeCell::new(1) };
|
2015-01-08 05:02:42 -06:00
|
|
|
const E: &'static UnsafeCell<usize> = &D.a;
|
2021-01-03 08:46:19 -06:00
|
|
|
//~^ ERROR: cannot refer to interior mutable
|
2014-10-06 23:16:35 -05:00
|
|
|
const F: &'static C = &D;
|
2021-01-03 08:46:19 -06:00
|
|
|
//~^ ERROR: cannot refer to interior mutable
|
2014-10-06 23:16:35 -05:00
|
|
|
|
|
|
|
fn main() {}
|