Skip to content

Commit c40a7f1

Browse files
committed
check an additional variant of constant borrowing of interior mutable objects
1 parent a43598c commit c40a7f1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/test/compile-fail/issue-17718-const-borrow.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ const E: &'static UnsafeCell<usize> = &D.a;
2323
const F: &'static C = &D;
2424
//~^ ERROR: cannot borrow a constant which contains interior mutability
2525

26+
const G: &'static UnsafeCell<usize> = &UnsafeCell::new(42);
27+
//~^ ERROR: cannot borrow a constant which contains interior mutability
28+
2629
fn main() {}

0 commit comments

Comments
 (0)