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