Stabilize #[coverage] attribute

This commit is contained in:
ltdk 2024-09-23 19:40:22 -04:00
parent 13b77c687c
commit cb487cc2fa
129 changed files with 378 additions and 521 deletions

View file

@ -1,26 +0,0 @@
error: malformed `coverage` attribute input
--> $DIR/bad-attr-ice.rs:10:1
|
LL | #[coverage]
| ^^^^^^^^^^^
|
help: the following are the possible correct uses
|
LL | #[coverage(off)]
|
LL | #[coverage(on)]
|
error[E0658]: the `#[coverage]` attribute is an experimental feature
--> $DIR/bad-attr-ice.rs:10:1
|
LL | #[coverage]
| ^^^^^^^^^^^
|
= note: see issue #84605 <https://github.com/rust-lang/rust/issues/84605> for more information
= help: add `#![feature(coverage_attribute)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,5 +1,3 @@
#![cfg_attr(feat, feature(coverage_attribute))]
//@ revisions: feat nofeat
//@ compile-flags: -Cinstrument-coverage
//@ needs-profiler-runtime
@ -9,8 +7,4 @@
#[coverage]
//~^ ERROR malformed `coverage` attribute input
//[nofeat]~| the `#[coverage]` attribute is an experimental feature
fn main() {}
// FIXME(#130766): When the `#[coverage(..)]` attribute is stabilized,
// get rid of the revisions and just make this a normal test.

View file

@ -1,5 +1,5 @@
error: malformed `coverage` attribute input
--> $DIR/bad-attr-ice.rs:10:1
--> $DIR/bad-attr-ice.rs:8:1
|
LL | #[coverage]
| ^^^^^^^^^^^

View file

@ -1,4 +1,3 @@
#![feature(coverage_attribute)]
//@ edition: 2021
// Tests the error messages produced (or not produced) by various unusual

View file

@ -1,5 +1,5 @@
error: malformed `coverage` attribute input
--> $DIR/bad-syntax.rs:15:1
--> $DIR/bad-syntax.rs:14:1
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -12,7 +12,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: malformed `coverage` attribute input
--> $DIR/bad-syntax.rs:18:1
--> $DIR/bad-syntax.rs:17:1
|
LL | #[coverage = true]
| ^^^^^^^^^^^^^^^^^^
@ -25,7 +25,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: malformed `coverage` attribute input
--> $DIR/bad-syntax.rs:21:1
--> $DIR/bad-syntax.rs:20:1
|
LL | #[coverage()]
| ^^^^^^^^^^^^^
@ -38,7 +38,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: malformed `coverage` attribute input
--> $DIR/bad-syntax.rs:24:1
--> $DIR/bad-syntax.rs:23:1
|
LL | #[coverage(off, off)]
| ^^^^^^^^^^^^^^^^^^^^^
@ -51,7 +51,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: malformed `coverage` attribute input
--> $DIR/bad-syntax.rs:27:1
--> $DIR/bad-syntax.rs:26:1
|
LL | #[coverage(off, on)]
| ^^^^^^^^^^^^^^^^^^^^
@ -64,7 +64,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: malformed `coverage` attribute input
--> $DIR/bad-syntax.rs:30:1
--> $DIR/bad-syntax.rs:29:1
|
LL | #[coverage(bogus)]
| ^^^^^^^^^^^^^^^^^^
@ -77,7 +77,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: malformed `coverage` attribute input
--> $DIR/bad-syntax.rs:33:1
--> $DIR/bad-syntax.rs:32:1
|
LL | #[coverage(bogus, off)]
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -90,7 +90,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: malformed `coverage` attribute input
--> $DIR/bad-syntax.rs:36:1
--> $DIR/bad-syntax.rs:35:1
|
LL | #[coverage(off, bogus)]
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -103,7 +103,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: expected identifier, found `,`
--> $DIR/bad-syntax.rs:42:12
--> $DIR/bad-syntax.rs:41:12
|
LL | #[coverage(,off)]
| ^ expected identifier
@ -115,25 +115,25 @@ LL + #[coverage(off)]
|
error: multiple `coverage` attributes
--> $DIR/bad-syntax.rs:7:1
--> $DIR/bad-syntax.rs:6:1
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/bad-syntax.rs:8:1
--> $DIR/bad-syntax.rs:7:1
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
error: multiple `coverage` attributes
--> $DIR/bad-syntax.rs:11:1
--> $DIR/bad-syntax.rs:10:1
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/bad-syntax.rs:12:1
--> $DIR/bad-syntax.rs:11:1
|
LL | #[coverage(on)]
| ^^^^^^^^^^^^^^^

View file

@ -1,4 +1,3 @@
#![feature(coverage_attribute)]
//@ edition: 2021
// Demonstrates the diagnostics produced when using the syntax

View file

@ -1,5 +1,5 @@
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:11:1
--> $DIR/name-value.rs:10:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -12,7 +12,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:16:5
--> $DIR/name-value.rs:15:5
|
LL | #![coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^^
@ -25,7 +25,7 @@ LL | #![coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:20:1
--> $DIR/name-value.rs:19:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -38,7 +38,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:28:5
--> $DIR/name-value.rs:27:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -51,7 +51,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:25:1
--> $DIR/name-value.rs:24:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -64,7 +64,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:38:5
--> $DIR/name-value.rs:37:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -77,7 +77,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:43:5
--> $DIR/name-value.rs:42:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -90,7 +90,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:34:1
--> $DIR/name-value.rs:33:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -103,7 +103,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:52:5
--> $DIR/name-value.rs:51:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -116,7 +116,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:57:5
--> $DIR/name-value.rs:56:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -129,7 +129,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:49:1
--> $DIR/name-value.rs:48:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -142,7 +142,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/name-value.rs:63:1
--> $DIR/name-value.rs:62:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -155,7 +155,7 @@ LL | #[coverage(on)]
|
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/name-value.rs:20:1
--> $DIR/name-value.rs:19:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -164,7 +164,7 @@ LL | struct MyStruct;
| ---------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/name-value.rs:34:1
--> $DIR/name-value.rs:33:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -177,7 +177,7 @@ LL | | }
| |_- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/name-value.rs:38:5
--> $DIR/name-value.rs:37:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -186,7 +186,7 @@ LL | const X: u32;
| ------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/name-value.rs:43:5
--> $DIR/name-value.rs:42:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -195,7 +195,7 @@ LL | type T;
| ------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/name-value.rs:28:5
--> $DIR/name-value.rs:27:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -204,7 +204,7 @@ LL | const X: u32 = 7;
| ----------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/name-value.rs:52:5
--> $DIR/name-value.rs:51:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
@ -213,7 +213,7 @@ LL | const X: u32 = 8;
| ----------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/name-value.rs:57:5
--> $DIR/name-value.rs:56:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,4 @@
#![feature(extern_types)]
#![feature(coverage_attribute)]
#![feature(impl_trait_in_assoc_type)]
#![warn(unused_attributes)]
#![coverage(off)]

View file

@ -1,5 +1,5 @@
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/no-coverage.rs:7:1
--> $DIR/no-coverage.rs:6:1
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
@ -12,7 +12,7 @@ LL | | }
| |_- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/no-coverage.rs:39:5
--> $DIR/no-coverage.rs:38:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
@ -20,7 +20,7 @@ LL | let _ = ();
| ----------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/no-coverage.rs:43:9
--> $DIR/no-coverage.rs:42:9
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
@ -28,7 +28,7 @@ LL | () => (),
| -------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/no-coverage.rs:47:5
--> $DIR/no-coverage.rs:46:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
@ -36,7 +36,7 @@ LL | return ();
| --------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/no-coverage.rs:9:5
--> $DIR/no-coverage.rs:8:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
@ -44,7 +44,7 @@ LL | const X: u32;
| ------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/no-coverage.rs:12:5
--> $DIR/no-coverage.rs:11:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
@ -52,7 +52,7 @@ LL | type T;
| ------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/no-coverage.rs:22:5
--> $DIR/no-coverage.rs:21:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
@ -60,7 +60,7 @@ LL | type T = Self;
| -------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/no-coverage.rs:25:5
--> $DIR/no-coverage.rs:24:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
@ -68,7 +68,7 @@ LL | type U = impl Trait;
| -------------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/no-coverage.rs:30:5
--> $DIR/no-coverage.rs:29:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
@ -76,7 +76,7 @@ LL | static X: u32;
| -------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/no-coverage.rs:33:5
--> $DIR/no-coverage.rs:32:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
@ -84,7 +84,7 @@ LL | type T;
| ------- not a function or closure
error: unconstrained opaque type
--> $DIR/no-coverage.rs:26:14
--> $DIR/no-coverage.rs:25:14
|
LL | type U = impl Trait;
| ^^^^^^^^^^

View file

@ -1,4 +1,3 @@
#![feature(coverage_attribute)]
//@ edition: 2021
// Check that yes/no in `#[coverage(yes)]` and `#[coverage(no)]` must be bare

View file

@ -1,5 +1,5 @@
error: malformed `coverage` attribute input
--> $DIR/subword.rs:7:1
--> $DIR/subword.rs:6:1
|
LL | #[coverage(yes(milord))]
| ^^^^^^^^^^^^^^^^^^^^^^^^
@ -12,7 +12,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: malformed `coverage` attribute input
--> $DIR/subword.rs:10:1
--> $DIR/subword.rs:9:1
|
LL | #[coverage(no(milord))]
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -25,7 +25,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: malformed `coverage` attribute input
--> $DIR/subword.rs:13:1
--> $DIR/subword.rs:12:1
|
LL | #[coverage(yes = "milord")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -38,7 +38,7 @@ LL | #[coverage(on)]
| ~~~~~~~~~~~~~~~
error: malformed `coverage` attribute input
--> $DIR/subword.rs:16:1
--> $DIR/subword.rs:15:1
|
LL | #[coverage(no = "milord")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,4 +1,3 @@
#![feature(coverage_attribute)]
//@ edition: 2021
// Demonstrates the diagnostics produced when using the syntax `#[coverage]`,

View file

@ -1,5 +1,5 @@
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:11:1
--> $DIR/word-only.rs:10:1
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -12,7 +12,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:16:5
--> $DIR/word-only.rs:15:5
|
LL | #![coverage]
| ^^^^^^^^^^^^
@ -25,7 +25,7 @@ LL | #![coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:20:1
--> $DIR/word-only.rs:19:1
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -38,7 +38,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:28:5
--> $DIR/word-only.rs:27:5
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -51,7 +51,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:25:1
--> $DIR/word-only.rs:24:1
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -64,7 +64,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:38:5
--> $DIR/word-only.rs:37:5
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -77,7 +77,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:43:5
--> $DIR/word-only.rs:42:5
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -90,7 +90,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:34:1
--> $DIR/word-only.rs:33:1
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -103,7 +103,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:52:5
--> $DIR/word-only.rs:51:5
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -116,7 +116,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:57:5
--> $DIR/word-only.rs:56:5
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -129,7 +129,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:49:1
--> $DIR/word-only.rs:48:1
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -142,7 +142,7 @@ LL | #[coverage(on)]
|
error: malformed `coverage` attribute input
--> $DIR/word-only.rs:63:1
--> $DIR/word-only.rs:62:1
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -155,7 +155,7 @@ LL | #[coverage(on)]
|
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/word-only.rs:20:1
--> $DIR/word-only.rs:19:1
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -164,7 +164,7 @@ LL | struct MyStruct;
| ---------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/word-only.rs:34:1
--> $DIR/word-only.rs:33:1
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -177,7 +177,7 @@ LL | | }
| |_- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/word-only.rs:38:5
--> $DIR/word-only.rs:37:5
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -186,7 +186,7 @@ LL | const X: u32;
| ------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/word-only.rs:43:5
--> $DIR/word-only.rs:42:5
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -195,7 +195,7 @@ LL | type T;
| ------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/word-only.rs:28:5
--> $DIR/word-only.rs:27:5
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -204,7 +204,7 @@ LL | const X: u32 = 7;
| ----------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/word-only.rs:52:5
--> $DIR/word-only.rs:51:5
|
LL | #[coverage]
| ^^^^^^^^^^^
@ -213,7 +213,7 @@ LL | const X: u32 = 8;
| ----------------- not a function or closure
error[E0788]: attribute should be applied to a function definition or closure
--> $DIR/word-only.rs:57:5
--> $DIR/word-only.rs:56:5
|
LL | #[coverage]
| ^^^^^^^^^^^

View file

@ -1,22 +0,0 @@
error[E0557]: feature has been removed
--> $DIR/feature-gate-coverage-attribute.rs:2:12
|
LL | #![feature(no_coverage)]
| ^^^^^^^^^^^ feature has been removed
|
= note: renamed to `coverage_attribute`
error[E0658]: the `#[coverage]` attribute is an experimental feature
--> $DIR/feature-gate-coverage-attribute.rs:10:1
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
|
= note: see issue #84605 <https://github.com/rust-lang/rust/issues/84605> for more information
= help: add `#![feature(coverage_attribute)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0557, E0658.
For more information about an error, try `rustc --explain E0557`.

View file

@ -7,7 +7,7 @@ struct Foo {
b: u32,
}
#[coverage(off)] //~ ERROR the `#[coverage]` attribute is an experimental feature
#[coverage(off)]
fn requires_feature_coverage() -> bool {
let bar = Foo { a: 0, b: 0 };
bar == Foo { a: 0, b: 0 }

View file

@ -0,0 +1,11 @@
error[E0557]: feature has been removed
--> $DIR/feature-gate-no-coverage.rs:2:12
|
LL | #![feature(no_coverage)]
| ^^^^^^^^^^^ feature has been removed
|
= note: renamed to `coverage_attribute`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0557`.