Closed
Description
This code (playground link) gives me a segfault on the current beta:
#[derive(Clone, Copy)]
enum Bar {
C
}
#[derive(Clone, Copy)]
enum Foo {
A {},
B {
y: f64,
z: Bar
},
}
fn f(s: &Foo) {
match s {
&Foo::A {} => {
},
&Foo::B { y: _y, z: ref _side } => {
}
}
}
const LIST: [(usize, Foo); 2] = [
(51, Foo::B {
y: 0.,
z: Bar::C
}),
(52, Foo::B {
y: 0.,
z: Bar::C
}),
];
pub fn main() {
for &r in LIST.iter() {
let (i, s) = r;
println!("{}", i);
f(&s);
}
}
I've reduced it as much as I can, even removing the A
constructor on the enum causes it to work.
I expect the output to be
51
52
(which it is on stable),
but instead I get
51
0
<segfault>