Skip to content

Commit 5d335c9

Browse files
committed
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.
2 parents f7fb0f5 + b54eb9b commit 5d335c9

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)