Closed
Description
@kmcallister found this bug in some Servo code.
The following code compiles but triggers an internal assertion and crashes:
struct Foo {
bar: @mut Bar,
}
struct Bar {
x: int,
}
fn main() {
let foo1 = @mut Foo { bar: @mut Bar { x: 1 } };
let foo2 = @mut Foo { bar: @mut Bar { x: 2 } };
let foos = ~[foo1, foo2];
for &@Foo { bar: ref bar } in foos.iter() {
}
}
If you remove the ref
in the pattern match, the code works.