Skip to content

Commit

Permalink
UnsafeCell -> RwLock
Browse files Browse the repository at this point in the history
  • Loading branch information
r-raymond committed Jun 20, 2022
1 parent 43c6f9c commit 048a801
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/test/codegen/noalias-rwlockreadguard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

#![crate_type = "lib"]

use std::cell::UnsafeCell;
use std::sync::RwLockReadGuard;
use std::sync::{RwLock, RwLockReadGuard};

// Make sure that `RwLockReadGuard` does not get a `noalias` attribute, because
// the `UnsafeCell` might alias writes after it is dropped.
// the `RwLock` might alias writes after it is dropped.

// CHECK-LABEL: @maybe_aliased(
// CHECK-NOT: noalias
// CHECK-SAME: %_data
#[no_mangle]
pub unsafe fn maybe_aliased(_: RwLockReadGuard<'_, i32>, _data: &UnsafeCell<i32>) {}
pub unsafe fn maybe_aliased(_: RwLockReadGuard<'_, i32>, _data: &RwLock<i32>) {}

0 comments on commit 048a801

Please sign in to comment.