Closed
Description
Was trying to find another bug, found this bug!
#[inline(never)]
fn function(slot: &mut Option<proc() -> proc()>, f: proc()) {
let a = slot.take();
let a = match a {
Some(a) => { let _a = a(); },
None => (),
};
//a();
}
fn main() {
let mut slot = None;
function(&mut slot, proc() {});
}
That code will fail with
[~/rust/valgrind[master]] $ rustc foo.rs -O && valgrind ./foo [alex@arch-vm]
foo.rs:2:50: 2:51 warning: unused variable: `f`, #[warn(unused_variable)] on by default
foo.rs:2 fn function(slot: &mut Option<proc() -> proc()>, f: proc()) {
^
foo.rs:4:7: 4:8 warning: unused variable: `a`, #[warn(unused_variable)] on by default
foo.rs:4 let a = match a {
^
error: internal compiler error: unexpected failure
This message reflects a bug in the Rust compiler.
We would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: the compiler hit an unexpected failure path. this is a bug
task 'rustc' failed at 'assertion failed: dest == expr::Ignore || bcx.unreachable.get()', /build/rust-git/src/rust/src/librustc/middle/trans/controlflow.rs:91