Skip to content

Commit 5f3adad

Browse files
committed
fix up compile error messages
1 parent 780765d commit 5f3adad

9 files changed

Lines changed: 164 additions & 129 deletions

tests/compile-fail/bitflags_custom_bits.stderr

Lines changed: 112 additions & 65 deletions
Large diffs are not rendered by default.
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error: no rules expected `}`
2-
--> tests/compile-fail/bitflags_match_missing_default.rs:19:5
3-
|
4-
19 | / bitflags::bitflags_match!(Flags::A | Flags::B, {
5-
20 | | Flags::A => (),
6-
21 | | });
7-
| |______^ no rules expected this token in macro call
8-
|
2+
--> tests/compile-fail/bitflags_match_missing_default.rs:19:5
3+
|
4+
19 | / bitflags::bitflags_match!(Flags::A | Flags::B, {
5+
20 | | Flags::A => (),
6+
21 | | });
7+
| |______^ no rules expected this token in macro call
8+
|
99
note: while trying to match meta-variable `$t:tt`
10-
--> src/lib.rs
11-
|
12-
| ($operation:expr, { $pattern:expr => $body:expr , $($t:tt)+ }) => {
13-
| ^^^^^
14-
= note: this error originates in the macro `bitflags::bitflags_match` (in Nightly builds, run with -Z macro-backtrace for more info)
10+
--> src/lib.rs
11+
|
12+
| ($operation:expr, { $pattern:expr => $body:expr , $($t:tt)+ }) => {
13+
| ^^^^^
14+
= note: this error originates in the macro `bitflags::bitflags_match` (in Nightly builds, run with -Z macro-backtrace for more info)
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: no rules expected `{`
22
--> tests/compile-fail/bitflags_missing_type.rs:5:23
33
|
4-
5 | pub struct Flags1 {
5-
| ^ no rules expected this token in macro call
6-
|
4+
5 | pub struct Flags1 {
5+
| ^ no rules expected this token in macro call
6+
|
77
note: while trying to match `:`
8-
--> src/lib.rs
9-
|
10-
| $vis:vis struct $BitFlags:ident: $T:ty {
11-
| ^
8+
--> src/lib.rs
9+
|
10+
| $vis:vis struct $BitFlags:ident: $T:ty {
11+
| ^
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: no rules expected `;`
22
--> tests/compile-fail/bitflags_missing_value.rs:6:16
33
|
4-
6 | const A;
5-
| ^ no rules expected this token in macro call
6-
|
4+
6 | const A;
5+
| ^ no rules expected this token in macro call
6+
|
77
note: while trying to match `=`
8-
--> src/lib.rs
9-
|
10-
| const $Flag:tt = $value:expr;
11-
| ^
8+
--> src/lib.rs
9+
|
10+
| const $Flag:tt = $value:expr;
11+
| ^
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: no rules expected keyword `pub`
22
--> tests/compile-fail/bitflags_pub_const.rs:5:9
33
|
4-
5 | pub const FLAG_A = 0b00000001;
5-
| ^^^ no rules expected this token in macro call
6-
|
4+
5 | pub const FLAG_A = 0b00000001;
5+
| ^^^ no rules expected this token in macro call
6+
|
77
note: while trying to match `}`
8-
--> src/lib.rs
9-
|
10-
| }
11-
| ^
8+
--> src/lib.rs
9+
|
10+
| }
11+
| ^

tests/compile-fail/bitflags_trait_custom.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ error[E0046]: not all trait items implemented, missing: `Iter`, `IterNames`
3030
error[E0277]: the trait bound `BootlegFlags: Flags` is not satisfied
3131
--> tests/compile-fail/bitflags_trait_custom.rs:5:19
3232
|
33-
5 | impl BitFlags for BootlegFlags {
34-
| ^^^^^^^^^^^^ unsatisfied trait bound
35-
|
33+
5 | impl BitFlags for BootlegFlags {
34+
| ^^^^^^^^^^^^ unsatisfied trait bound
35+
|
3636
help: the trait `Flags` is not implemented for `BootlegFlags`
37-
--> tests/compile-fail/bitflags_trait_custom.rs:3:1
38-
|
39-
3 | pub struct BootlegFlags(u32);
40-
| ^^^^^^^^^^^^^^^^^^^^^^^
37+
--> tests/compile-fail/bitflags_trait_custom.rs:3:1
38+
|
39+
3 | pub struct BootlegFlags(u32);
40+
| ^^^^^^^^^^^^^^^^^^^^^^^
4141
note: required by a bound in `bitflags::BitFlags`
42-
--> src/traits.rs
43-
|
44-
| pub trait BitFlags: ImplementedByBitFlagsMacro + Flags {
45-
| ^^^^^ required by this bound in `BitFlags`
42+
--> src/traits.rs
43+
|
44+
| pub trait BitFlags: ImplementedByBitFlagsMacro + Flags {
45+
| ^^^^^ required by this bound in `BitFlags`
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error: expected identifier, found reserved identifier `_`
22
--> tests/compile-fail/unnamed_const.rs:7:25
33
|
4-
7 | const A = Self::_.bits();
5-
| ^ expected identifier, found reserved identifier
6-
|
7-
::: src/lib.rs
8-
|
9-
| const $Flag:tt = $value:expr;
10-
| ----------- while parsing argument for this `expr` macro fragment
4+
7 | const A = Self::_.bits();
5+
| ^ expected identifier, found reserved identifier
6+
|
7+
::: src/lib.rs
8+
|
9+
| const $Flag:tt = $value:expr;
10+
| ----------- while parsing argument for this `expr` macro fragment

tests/compile-pass/bitflags_multi_flag.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/compile-pass/item_positions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub mod nested {
2929
}
3030
}
3131

32-
pub const _: () = {
32+
const _: () = {
3333
bitflags! {
3434
pub struct Flags1: u32 {
3535
const A = 1;

0 commit comments

Comments
 (0)