2018-05-09 08:54:45 -05:00
|
|
|
// ignore-test validation_op is disabled
|
|
|
|
|
2017-08-09 20:01:10 -05:00
|
|
|
#![allow(unused_variables)]
|
|
|
|
|
|
|
|
static mut PTR: *mut u8 = 0 as *mut _;
|
|
|
|
|
|
|
|
fn fun1(x: &mut u8) {
|
|
|
|
unsafe {
|
|
|
|
PTR = x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn fun2() {
|
|
|
|
// Now we use a pointer we are not allowed to use
|
|
|
|
let _x = unsafe { *PTR }; //~ ERROR: in conflict with lock WriteLock
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut val = 0;
|
|
|
|
fun1(&mut val);
|
|
|
|
fun2();
|
|
|
|
}
|