The following code segfaults at runtime on stable, beta, and nightly:
fn main() {
let x = 10;
let s = Custom { val: Vec::new() };
match x {
10 if test(s) => println!("oops"),
_ => println!("eek {:?}", s.val),
}
}
#[derive(Debug)]
pub struct Custom {
val: Vec<u8>,
}
impl Drop for Custom {
fn drop(&mut self) { println!("Dropping"); }
}
#[allow(unused_variables)]
fn test(s: Custom) -> bool { false }
The following code segfaults at runtime on stable, beta, and nightly: