Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix beta test output #279

Merged
merged 2 commits into from Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,9 @@
# Updating compile-fail test outputs

`bitflags` uses the `trybuild` crate to integration test its macros. Since Rust error messages change frequently enough that `nightly` builds produce spurious failures, we only check the compiler output in `beta` builds. If you run:

```
TRYBUILD=overwrite cargo +beta test --all
```

it will run the tests and update the `trybuild` output files.
12 changes: 6 additions & 6 deletions tests/compile-fail/impls/copy.stderr.beta
@@ -1,27 +1,27 @@
error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Flags`
error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `Flags`
--> $DIR/copy.rs:3:1
|
3 | / bitflags! {
4 | | #[derive(Clone, Copy)]
| | ----- first implementation here
| | ---- first implementation here
5 | | struct Flags: u32 {
6 | | const A = 0b00000001;
7 | | }
8 | | }
| |_^ conflicting implementation for `Flags`
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `Flags`
error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Flags`
--> $DIR/copy.rs:3:1
|
3 | / bitflags! {
4 | | #[derive(Clone, Copy)]
| | ---- first implementation here
| | ----- first implementation here
5 | | struct Flags: u32 {
6 | | const A = 0b00000001;
7 | | }
8 | | }
| |_^ conflicting implementation for `Flags`
|
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
16 changes: 8 additions & 8 deletions tests/compile-fail/impls/eq.stderr.beta
@@ -1,4 +1,4 @@
error[E0119]: conflicting implementations of trait `std::cmp::PartialEq` for type `Flags`
error[E0119]: conflicting implementations of trait `std::marker::StructuralPartialEq` for type `Flags`
--> $DIR/eq.rs:3:1
|
3 | / bitflags! {
Expand All @@ -12,35 +12,35 @@ error[E0119]: conflicting implementations of trait `std::cmp::PartialEq` for typ
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `std::cmp::Eq` for type `Flags`
error[E0119]: conflicting implementations of trait `std::cmp::PartialEq` for type `Flags`
--> $DIR/eq.rs:3:1
|
3 | / bitflags! {
4 | | #[derive(PartialEq, Eq)]
| | -- first implementation here
| | --------- first implementation here
5 | | struct Flags: u32 {
6 | | const A = 0b00000001;
7 | | }
8 | | }
| |_^ conflicting implementation for `Flags`
|
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `std::marker::StructuralPartialEq` for type `Flags`
error[E0119]: conflicting implementations of trait `std::marker::StructuralEq` for type `Flags`
--> $DIR/eq.rs:3:1
|
3 | / bitflags! {
4 | | #[derive(PartialEq, Eq)]
| | --------- first implementation here
| | -- first implementation here
5 | | struct Flags: u32 {
6 | | const A = 0b00000001;
7 | | }
8 | | }
| |_^ conflicting implementation for `Flags`
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0119]: conflicting implementations of trait `std::marker::StructuralEq` for type `Flags`
error[E0119]: conflicting implementations of trait `std::cmp::Eq` for type `Flags`
--> $DIR/eq.rs:3:1
|
3 | / bitflags! {
Expand Down
80 changes: 80 additions & 0 deletions tests/compile-fail/non_integer_base/all_defined.stderr.beta
Expand Up @@ -11,6 +11,82 @@ error[E0308]: mismatched types
| |_^ expected struct `MyInt`, found integer
|
= note: this error originates in the macro `__impl_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
help: try wrapping the expression in `MyInt`
|
492 | if extra_bits != MyInt(0) {
| ++++++ +

error[E0308]: mismatched types
--> $DIR/all_defined.rs:115:1
|
115 | / bitflags! {
116 | | struct Flags128: MyInt {
117 | | const A = MyInt(0b0000_0001u8);
118 | | const B = MyInt(0b0000_0010u8);
119 | | const C = MyInt(0b0000_0100u8);
120 | | }
121 | | }
| |_^ expected struct `MyInt`, found integer
|
= note: this error originates in the macro `__impl_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
help: try wrapping the expression in `MyInt`
|
536 | Self { bits: MyInt(0) }
| ++++++ +

error[E0308]: mismatched types
--> $DIR/all_defined.rs:115:1
|
115 | / bitflags! {
116 | | struct Flags128: MyInt {
117 | | const A = MyInt(0b0000_0001u8);
118 | | const B = MyInt(0b0000_0010u8);
119 | | const C = MyInt(0b0000_0100u8);
120 | | }
121 | | }
| |_^ expected struct `MyInt`, found integer
|
= note: this error originates in the macro `__impl_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
help: try wrapping the expression in `MyInt`
|
562 | if (bits & !Self::all().bits()) == MyInt(0) {
| ++++++ +

error[E0308]: mismatched types
--> $DIR/all_defined.rs:115:1
|
115 | / bitflags! {
116 | | struct Flags128: MyInt {
117 | | const A = MyInt(0b0000_0001u8);
118 | | const B = MyInt(0b0000_0010u8);
119 | | const C = MyInt(0b0000_0100u8);
120 | | }
121 | | }
| |_^ expected struct `MyInt`, found integer
|
= note: this error originates in the macro `__impl_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
help: try wrapping the expression in `MyInt`
|
471 | if Self::$Flag.bits == MyInt(0) && self.bits != 0 {
| ++++++ +

error[E0308]: mismatched types
--> $DIR/all_defined.rs:115:1
|
115 | / bitflags! {
116 | | struct Flags128: MyInt {
117 | | const A = MyInt(0b0000_0001u8);
118 | | const B = MyInt(0b0000_0010u8);
119 | | const C = MyInt(0b0000_0100u8);
120 | | }
121 | | }
| |_^ expected struct `MyInt`, found integer
|
= note: this error originates in the macro `__impl_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
help: try wrapping the expression in `MyInt`
|
471 | if Self::$Flag.bits == 0 && self.bits != MyInt(0) {
| ++++++ +

error[E0308]: mismatched types
--> $DIR/all_defined.rs:115:1
Expand All @@ -25,3 +101,7 @@ error[E0308]: mismatched types
| |_^ expected struct `MyInt`, found integer
|
= note: this error originates in the macro `__impl_all_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
help: try wrapping the expression in `MyInt`
|
410 | const $Flag: $T = MyInt(0);
| ++++++ +