Skip to content

Commit

Permalink
auto merge of rust-lang#17404 : alexcrichton/rust/bitflags-u32, r=sfa…
Browse files Browse the repository at this point in the history
…ckler

If you didn't have a trailing comma at the end of the variants, you could use
any type you wanted, but if you used a trailing comma the macro would
erroneously require the bits be a u32.
  • Loading branch information
bors committed Sep 20, 2014
2 parents f7fb0f5 + b54eb9b commit 5d335c9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/libstd/bitflags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ macro_rules! bitflags {
}) => {
bitflags! {
$(#[$attr])*
flags $BitFlags: u32 {
flags $BitFlags: $T {
$($(#[$Flag_attr])* static $Flag = $value),+
}
}
Expand Down Expand Up @@ -255,6 +255,12 @@ mod tests {
}
}

bitflags! {
flags AnotherSetOfFlags: uint {
static AnotherFlag = 1u,
}
}

#[test]
fn test_bits(){
assert_eq!(Flags::empty().bits(), 0x00000000);
Expand Down

0 comments on commit 5d335c9

Please sign in to comment.