From de1600d110749ae6e428eb59ecdce3c0a56f1223 Mon Sep 17 00:00:00 2001 From: Andy Caldwell Date: Fri, 11 Aug 2023 20:39:20 +0100 Subject: [PATCH] Add `no_coverage` to the 'removed features' list --- compiler/rustc_feature/src/active.rs | 2 +- compiler/rustc_feature/src/removed.rs | 3 +++ compiler/rustc_span/src/symbol.rs | 1 + tests/ui/feature-gates/feature-gate-coverage.rs | 3 ++- .../ui/feature-gates/feature-gate-coverage.stderr | 15 ++++++++++++--- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 59a04114e86..7da6f763e99 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -400,7 +400,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 ed5d76b861a..c70e8e3e6b1 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 2dfb2e5e29d..a8425b2dc04 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1038,6 +1038,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 75336d86c5d..0a463755f13 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 4036c046c74..25d56912ecd 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`.