Closed
Description
#![feature(unboxed_closures)]
struct Foo;
impl Foo {
fn bar(&self, _x: uint) {}
}
fn main() {
let foo = Foo;
let y = 0u;
move |:| {
foo.bar(y);
};
}
Gives:
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'assertion failed: freevars.len() <= 1', /build/rust-git/src/rust/src/librustc/middle/trans/closure.rs:325
Foo.bar can take &self
or &mut self
instead and the ICE still happens. The following things stop the ICE from happening:
- Moving foo or y inside the closure.
- Removing foo (capturing only y).
- Removing y (capturing only foo)
- Making the closure non-move,
|&:|
or|& mut:|
.
Only have access to the playpen right now, so I can't get a backtrace, sorry.