Skip to content

Commit b54eb9b

Browse files
committed
std: Don't require bitflags! be u32
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.
1 parent af3889f commit b54eb9b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/libstd/bitflags.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ macro_rules! bitflags {
223223
}) => {
224224
bitflags! {
225225
$(#[$attr])*
226-
flags $BitFlags: u32 {
226+
flags $BitFlags: $T {
227227
$($(#[$Flag_attr])* static $Flag = $value),+
228228
}
229229
}
@@ -255,6 +255,12 @@ mod tests {
255255
}
256256
}
257257

258+
bitflags! {
259+
flags AnotherSetOfFlags: uint {
260+
static AnotherFlag = 1u,
261+
}
262+
}
263+
258264
#[test]
259265
fn test_bits(){
260266
assert_eq!(Flags::empty().bits(), 0x00000000);

0 commit comments

Comments
 (0)