Also test that yes/no must be bare words

This commit is contained in:
Zalathar 2024-06-19 17:58:55 +10:00
parent 388aea471f
commit ebb3aa0d46
2 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,19 @@
#![feature(coverage_attribute)]
//@ edition: 2021
// Check that yes/no in `#[coverage(yes)]` and `#[coverage(no)]` must be bare
// words, not part of a more complicated substructure.
#[coverage(yes(milord))] //~ ERROR expected `coverage(off)` or `coverage(on)`
fn yes_list() {}
#[coverage(no(milord))] //~ ERROR expected `coverage(off)` or `coverage(on)`
fn no_list() {}
#[coverage(yes = "milord")] //~ ERROR expected `coverage(off)` or `coverage(on)`
fn yes_key() {}
#[coverage(no = "milord")] //~ ERROR expected `coverage(off)` or `coverage(on)`
fn no_key() {}
fn main() {}

View file

@ -0,0 +1,26 @@
error: expected `coverage(off)` or `coverage(on)`
--> $DIR/subword.rs:7:1
|
LL | #[coverage(yes(milord))]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: expected `coverage(off)` or `coverage(on)`
--> $DIR/subword.rs:10:1
|
LL | #[coverage(no(milord))]
| ^^^^^^^^^^^^^^^^^^^^^^^
error: expected `coverage(off)` or `coverage(on)`
--> $DIR/subword.rs:13:1
|
LL | #[coverage(yes = "milord")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: expected `coverage(off)` or `coverage(on)`
--> $DIR/subword.rs:16:1
|
LL | #[coverage(no = "milord")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 4 previous errors