Closed
Description
The following code gives an error pointing to the static FOO
line, but not pointing to the FOO =>
line, so it's not obvious that the problem is really the match
. I originally encountered this from (a form of) the bitflags!
macro, which was doubly confusing.
pub struct Flags
{
bits: uint,
}
static FOO: Flags = Flags{bits: 0x01};
static BAR: Flags = Flags{bits: 0x02};
// caller is guaranteed to only set one bit here.
pub fn frob(f: Flags)
{
match f
{
FOO => {}
BAR => {}
_ => {}
}
}
Metadata
Metadata
Assignees
Labels
No labels