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