Skip to content

Commit cb20e25

Browse files
committed
Add test to verify noalias is not being added
1 parent 09d937e commit cb20e25

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// compile-flags: -O -C no-prepopulate-passes -Z mutable-noalias=yes
2+
3+
#![crate_type = "lib"]
4+
5+
use std::cell::UnsafeCell;
6+
use std::sync::RwLockReadGuard;
7+
8+
// Make sure that `RwLockReadGuard` does not get a `noalias` attribute, because
9+
// the `UnsafeCell` might alias writes after it is dropped.
10+
11+
// CHECK-LABEL: @maybe_aliased(
12+
// CHECK-NOT: noalias
13+
#[no_mangle]
14+
pub unsafe fn maybe_aliased(_: RwLockReadGuard<'_, i32>, _data: &UnsafeCell<i32>) {}

0 commit comments

Comments
 (0)