about summary refs log tree commit diff
path: root/tests/ui/consts/issue-17718-const-borrow.rs
blob: 6373333259144348942ad6d7de9e1856c8856cba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::cell::UnsafeCell;

const A: UnsafeCell<usize> = UnsafeCell::new(1);
const B: &'static UnsafeCell<usize> = &A;
//~^ ERROR: interior mutable shared borrows of temporaries

struct C { a: UnsafeCell<usize> }
const D: C = C { a: UnsafeCell::new(1) };
const E: &'static UnsafeCell<usize> = &D.a;
//~^ ERROR: interior mutable shared borrows of temporaries
const F: &'static C = &D;
//~^ ERROR: interior mutable shared borrows of temporaries

fn main() {}