|
8 | 8 | // and in places that cannot have a coverage attribute, to demonstrate the
|
9 | 9 | // interaction between multiple errors.
|
10 | 10 |
|
11 |
| -// FIXME(#126658): The error messages for using this syntax are inconsistent |
12 |
| -// with the error message in other cases. They also sometimes appear together |
13 |
| -// with other errors, and they suggest using the incorrect `#[coverage]` syntax. |
14 |
| - |
15 |
| -#[coverage = "off"] //~ ERROR malformed `coverage` attribute input |
| 11 | +#[coverage = "off"] |
| 12 | +//~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 13 | +//~| ERROR attribute should be applied to a function definition or closure |
16 | 14 | mod my_mod {}
|
17 | 15 |
|
18 | 16 | mod my_mod_inner {
|
19 |
| - #![coverage = "off"] //~ ERROR malformed `coverage` attribute input |
| 17 | + #![coverage = "off"] |
| 18 | + //~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 19 | + //~| ERROR attribute should be applied to a function definition or closure |
20 | 20 | }
|
21 | 21 |
|
22 | 22 | #[coverage = "off"]
|
23 |
| -//~^ ERROR `#[coverage]` must be applied to coverable code |
24 |
| -//~| ERROR malformed `coverage` attribute input |
| 23 | +//~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 24 | +//~| ERROR attribute should be applied to a function definition or closure |
25 | 25 | struct MyStruct;
|
26 | 26 |
|
27 |
| -#[coverage = "off"] //~ ERROR malformed `coverage` attribute input |
| 27 | +#[coverage = "off"] |
| 28 | +//~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 29 | +//~| ERROR attribute should be applied to a function definition or closure |
28 | 30 | impl MyStruct {
|
29 | 31 | #[coverage = "off"]
|
30 |
| - //~^ ERROR `#[coverage]` must be applied to coverable code |
31 |
| - //~| ERROR malformed `coverage` attribute input |
| 32 | + //~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 33 | + //~| ERROR attribute should be applied to a function definition or closure |
32 | 34 | const X: u32 = 7;
|
33 | 35 | }
|
34 | 36 |
|
35 |
| -#[coverage = "off"] //~ ERROR malformed `coverage` attribute input |
| 37 | +#[coverage = "off"] |
| 38 | +//~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 39 | +//~| ERROR attribute should be applied to a function definition or closure |
36 | 40 | trait MyTrait {
|
37 | 41 | #[coverage = "off"]
|
38 |
| - //~^ ERROR `#[coverage]` must be applied to coverable code |
39 |
| - //~| ERROR malformed `coverage` attribute input |
| 42 | + //~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 43 | + //~| ERROR attribute should be applied to a function definition or closure |
40 | 44 | const X: u32;
|
41 | 45 |
|
42 | 46 | #[coverage = "off"]
|
43 |
| - //~^ ERROR `#[coverage]` must be applied to coverable code |
44 |
| - //~| ERROR malformed `coverage` attribute input |
| 47 | + //~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 48 | + //~| ERROR attribute should be applied to a function definition or closure |
45 | 49 | type T;
|
46 | 50 | }
|
47 | 51 |
|
48 |
| -#[coverage = "off"] //~ ERROR malformed `coverage` attribute input |
| 52 | +#[coverage = "off"] |
| 53 | +//~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 54 | +//~| ERROR attribute should be applied to a function definition or closure |
49 | 55 | impl MyTrait for MyStruct {
|
50 | 56 | #[coverage = "off"]
|
51 |
| - //~^ ERROR `#[coverage]` must be applied to coverable code |
52 |
| - //~| ERROR malformed `coverage` attribute input |
| 57 | + //~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 58 | + //~| ERROR attribute should be applied to a function definition or closure |
53 | 59 | const X: u32 = 8;
|
54 | 60 |
|
55 | 61 | #[coverage = "off"]
|
56 |
| - //~^ ERROR `#[coverage]` must be applied to coverable code |
57 |
| - //~| ERROR malformed `coverage` attribute input |
| 62 | + //~^ ERROR expected `coverage(off)` or `coverage(on)` |
| 63 | + //~| ERROR attribute should be applied to a function definition or closure |
58 | 64 | type T = ();
|
59 | 65 | }
|
60 | 66 |
|
61 | 67 | #[coverage = "off"]
|
62 | 68 | //~^ ERROR expected `coverage(off)` or `coverage(on)`
|
63 |
| -//~| ERROR malformed `coverage` attribute input |
64 | 69 | fn main() {}
|
0 commit comments