rust/tests/ui/coverage-attr/bad-syntax.rs
Zalathar 87c2f9a5be Revert "Auto merge of #130766 - clarfonthey:stable-coverage-attribute, r=wesleywiser"
This reverts commit 1d35638dc38dbfbf1cc2a9823135dfcf3c650169, reversing
changes made to f23a80a4c2fbca593b64e70f5970368824b4c5e9.
2024-12-23 12:30:37 +11:00

48 lines
1.3 KiB
Rust

#![feature(coverage_attribute)]
//@ edition: 2021
//@ reference: attributes.coverage.syntax
//@ reference: attributes.coverage.duplicates
// Tests the error messages produced (or not produced) by various unusual
// uses of the `#[coverage(..)]` attribute.
#[coverage(off)] //~ ERROR multiple `coverage` attributes
#[coverage(off)]
fn multiple_consistent() {}
#[coverage(off)] //~ ERROR multiple `coverage` attributes
#[coverage(on)]
fn multiple_inconsistent() {}
#[coverage] //~ ERROR malformed `coverage` attribute input
fn bare_word() {}
#[coverage = true] //~ ERROR malformed `coverage` attribute input
fn key_value() {}
#[coverage()] //~ ERROR malformed `coverage` attribute input
fn list_empty() {}
#[coverage(off, off)] //~ ERROR malformed `coverage` attribute input
fn list_consistent() {}
#[coverage(off, on)] //~ ERROR malformed `coverage` attribute input
fn list_inconsistent() {}
#[coverage(bogus)] //~ ERROR malformed `coverage` attribute input
fn bogus_word() {}
#[coverage(bogus, off)] //~ ERROR malformed `coverage` attribute input
fn bogus_word_before() {}
#[coverage(off, bogus)] //~ ERROR malformed `coverage` attribute input
fn bogus_word_after() {}
#[coverage(off,)] // (OK!)
fn comma_after() {}
#[coverage(,off)] //~ ERROR expected identifier, found `,`
fn comma_before() {}
fn main() {}