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