rust/src/test/ui/writealias.rs
2019-07-27 18:56:16 +03:00

20 lines
333 B
Rust

// run-pass
#![allow(dead_code)]
use std::sync::Mutex;
struct Point {x: isize, y: isize, z: isize}
fn f(p: &mut Point) { p.z = 13; }
pub fn main() {
let x = Some(Mutex::new(true));
match x {
Some(ref z) if *z.lock().unwrap() => {
assert!(*z.lock().unwrap());
},
_ => panic!()
}
}