diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 053f1e7b5e8d..e7ade5974271 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -395,7 +395,7 @@ declare_features! ( (active, const_try, "1.56.0", Some(74935), None), /// Allows function attribute `#[coverage(on/off)]`, to control coverage /// instrumentation of that function. - (active, coverage, "1.53.0", Some(84605), None), + (active, coverage, "CURRENT_RUSTC_VERSION", Some(84605), None), /// Allows non-builtin attributes in inner attribute position. (active, custom_inner_attributes, "1.30.0", Some(54726), None), /// Allows custom test frameworks with `#![test_runner]` and `#[test_case]`. diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs index ed5d76b861a4..c70e8e3e6b1e 100644 --- a/compiler/rustc_feature/src/removed.rs +++ b/compiler/rustc_feature/src/removed.rs @@ -136,6 +136,9 @@ declare_features! ( Some("subsumed by `#![feature(allocator_internals)]`")), /// Allows use of unary negate on unsigned integers, e.g., -e for e: u8 (removed, negate_unsigned, "1.0.0", Some(29645), None, None), + /// Allows `#[no_coverage]` on functions. + /// The feature was renamed to `coverage` and the attribute to `#[coverage(on|off)]` + (removed, no_coverage, "CURRENT_RUSTC_VERSION", Some(84605), None, Some("renamed to `coverage`")), /// Allows `#[no_debug]`. (removed, no_debug, "1.43.0", Some(29721), None, Some("removed due to lack of demand")), /// Allows using `#[on_unimplemented(..)]` on traits. diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index e8aebb83ecde..70912da6880c 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1028,6 +1028,7 @@ symbols! { no, no_builtins, no_core, + no_coverage, no_crate_inject, no_debug, no_default_passes, diff --git a/tests/ui/feature-gates/feature-gate-coverage.rs b/tests/ui/feature-gates/feature-gate-coverage.rs index 75336d86c5df..0a463755f137 100644 --- a/tests/ui/feature-gates/feature-gate-coverage.rs +++ b/tests/ui/feature-gates/feature-gate-coverage.rs @@ -1,4 +1,5 @@ #![crate_type = "lib"] +#![feature(no_coverage)] //~ ERROR feature has been removed [E0557] #[derive(PartialEq, Eq)] // ensure deriving `Eq` does not enable `feature(coverage)` struct Foo { @@ -7,7 +8,7 @@ struct Foo { } #[coverage(off)] //~ ERROR the `#[coverage]` attribute is an experimental feature -fn requires_feature_no_coverage() -> bool { +fn requires_feature_coverage() -> bool { let bar = Foo { a: 0, b: 0 }; bar == Foo { a: 0, b: 0 } } diff --git a/tests/ui/feature-gates/feature-gate-coverage.stderr b/tests/ui/feature-gates/feature-gate-coverage.stderr index 4036c046c742..25d56912ecd2 100644 --- a/tests/ui/feature-gates/feature-gate-coverage.stderr +++ b/tests/ui/feature-gates/feature-gate-coverage.stderr @@ -1,5 +1,13 @@ +error[E0557]: feature has been removed + --> $DIR/feature-gate-coverage.rs:2:12 + | +LL | #![feature(no_coverage)] + | ^^^^^^^^^^^ feature has been removed + | + = note: renamed to `coverage` + error[E0658]: the `#[coverage]` attribute is an experimental feature - --> $DIR/feature-gate-coverage.rs:9:1 + --> $DIR/feature-gate-coverage.rs:10:1 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -7,6 +15,7 @@ LL | #[coverage(off)] = note: see issue #84605 for more information = help: add `#![feature(coverage)]` to the crate attributes to enable -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0557, E0658. +For more information about an error, try `rustc --explain E0557`.