diff options
| author | bors <bors@rust-lang.org> | 2014-09-20 08:05:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-09-20 08:05:35 +0000 |
| commit | 5d335c94bd9017f16ce7538a5f4063e1178f15a1 (patch) | |
| tree | d952312786a7a40e882c6089f9c1cab89e0b5ab7 /src/libstd | |
| parent | f7fb0f5a172bcde42293bf64ffafd1e5df4bd0f8 (diff) | |
| parent | b54eb9b6e2a414404b53912608ecc9c3d7aedfe8 (diff) | |
auto merge of #17404 : alexcrichton/rust/bitflags-u32, r=sfackler
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.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/bitflags.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs index 8af88b4fe72..41813fff36e 100644 --- a/src/libstd/bitflags.rs +++ b/src/libstd/bitflags.rs @@ -223,7 +223,7 @@ macro_rules! bitflags { }) => { bitflags! { $(#[$attr])* - flags $BitFlags: u32 { + flags $BitFlags: $T { $($(#[$Flag_attr])* static $Flag = $value),+ } } @@ -255,6 +255,12 @@ mod tests { } } + bitflags! { + flags AnotherSetOfFlags: uint { + static AnotherFlag = 1u, + } + } + #[test] fn test_bits(){ assert_eq!(Flags::empty().bits(), 0x00000000); |
