Closed

Description
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 }
Metadata
Metadata
Assignees
Labels
Area: The borrow checkerCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessMedium priorityRelevant to the compiler team, which will review and decide on the PR/issue.