add some tests making sure we get the alias checking right

This commit is contained in:
Ralf Jung 2017-08-07 17:39:09 -07:00
parent de80bcbdbf
commit 11f0aedc3d
3 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,10 @@
#![allow(unused_variables)]
mod safe {
pub fn safe(x: &mut i32, y: &mut i32) {} //~ ERROR: in conflict with lock WriteLock
}
fn main() {
let x = &mut 0 as *mut _;
unsafe { safe::safe(&mut *x, &mut *x) };
}

View File

@ -0,0 +1,10 @@
#![allow(unused_variables)]
mod safe {
pub fn safe(x: &i32, y: &mut i32) {} //~ ERROR: in conflict with lock ReadLock
}
fn main() {
let x = &mut 0 as *mut _;
unsafe { safe::safe(&*x, &mut *x) };
}

View File

@ -0,0 +1,10 @@
#![allow(unused_variables)]
mod safe {
pub fn safe(x: &mut i32, y: &i32) {} //~ ERROR: in conflict with lock WriteLock
}
fn main() {
let x = &mut 0 as *mut _;
unsafe { safe::safe(&mut *x, &*x) };
}