-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for overflow in computed flags
- Loading branch information
1 parent
d0eb893
commit c2d64de
Showing
11 changed files
with
54 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#[enumflags2::bitflags] | ||
#[repr(u8)] | ||
#[derive(Copy, Clone)] | ||
enum Foo { | ||
OhNoTheresNoDiscriminant, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
error: Please add an explicit discriminant | ||
--> $DIR/missing_disciminant.rs:4:5 | ||
--> $DIR/missing_disciminant.rs:5:5 | ||
| | ||
4 | OhNoTheresNoDiscriminant, | ||
5 | OhNoTheresNoDiscriminant, | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#[enumflags2::bitflags] | ||
#[repr(u8)] | ||
#[derive(Copy, Clone)] | ||
enum Foo { | ||
SingleBit = 1, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
error: Flags must have exactly one set bit | ||
--> $DIR/multiple_bits.rs:5:5 | ||
--> $DIR/multiple_bits.rs:6:5 | ||
| | ||
5 | MultipleBits = 6, | ||
6 | MultipleBits = 6, | ||
| ^^^^^^^^^^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#[enumflags2::bitflags] | ||
#[repr(u8)] | ||
#[derive(Copy, Clone)] | ||
enum Foo { | ||
Bar(u32), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
error: Bitflag variants cannot contain additional data | ||
--> $DIR/with_fields.rs:4:8 | ||
--> $DIR/with_fields.rs:5:8 | ||
| | ||
4 | Bar(u32), | ||
5 | Bar(u32), | ||
| ^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#[enumflags2::bitflags] | ||
#[repr(u8)] | ||
#[derive(Copy, Clone)] | ||
enum Foo { | ||
Zero = 0, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
error: Flags must have exactly one set bit | ||
--> $DIR/zero_disciminant.rs:4:5 | ||
--> $DIR/zero_disciminant.rs:5:5 | ||
| | ||
4 | Zero = 0, | ||
5 | Zero = 0, | ||
| ^^^^^^^^ |