Closed
Description
enum StructVar {
BoxedInt { boxed: Box<i32> },
UnboxedInt { unboxed: i32 }
}
fn main() {
let x = StructVar::BoxedInt { boxed: box 3 };
match x {
//StructVar::BoxedInt { box boxed } => { } // expected identifier, found keyword 'box'
StructVar::BoxedInt { boxed: box boxed } => { } // ok
StructVar::UnboxedInt { unboxed } => { }
}
match x {
StructVar::BoxedInt { ref boxed } => { } // works with ref
StructVar::UnboxedInt { ref unboxed } => { }
}
}
I'm not sure if this is actually an issue or if it's known behavior but it seems inconsistent to be able to match against ref
and not box
, especially since the same works with regular enums.