In the following code "in match" is outputted before "drop". I naively expected that it would be the other way around because the scope of the temporary "Foo" would end before entering the match block. Can someone explain this behaviour?
struct Foo;
impl Drop for Foo {
fn drop(&mut self) {
println!("drop");
}
}
fn foo(_f: &Foo) -> Option<()> {
Some(())
}
fn main() {
println!("start");
match foo(&Foo) {
_ => println!("in match"),
}
println!("end");
}