From 679267f2ac291202e9c8168edd1df8a9cf3aecb2 Mon Sep 17 00:00:00 2001 From: Andy Caldwell Date: Thu, 24 Aug 2023 20:15:41 +0100 Subject: [PATCH] Rename the feature, but not the attribute, to `coverage_attribute` --- compiler/rustc_builtin_macros/src/test_harness.rs | 2 +- compiler/rustc_feature/src/active.rs | 2 +- compiler/rustc_feature/src/builtin_attrs.rs | 2 +- compiler/rustc_span/src/symbol.rs | 1 + library/core/src/cmp.rs | 2 +- library/core/src/lib.rs | 2 +- .../{coverage.md => coverage-attribute.md} | 4 ++-- ...-gate-coverage.rs => feature-gate-coverage-attribute.rs} | 0 ...verage.stderr => feature-gate-coverage-attribute.stderr} | 6 +++--- tests/ui/lint/no-coverage.rs | 2 +- 10 files changed, 12 insertions(+), 11 deletions(-) rename src/doc/unstable-book/src/language-features/{coverage.md => coverage-attribute.md} (91%) rename tests/ui/feature-gates/{feature-gate-coverage.rs => feature-gate-coverage-attribute.rs} (100%) rename tests/ui/feature-gates/{feature-gate-coverage.stderr => feature-gate-coverage-attribute.stderr} (74%) diff --git a/compiler/rustc_builtin_macros/src/test_harness.rs b/compiler/rustc_builtin_macros/src/test_harness.rs index ed0da7e115f..53ff089d7b4 100644 --- a/compiler/rustc_builtin_macros/src/test_harness.rs +++ b/compiler/rustc_builtin_macros/src/test_harness.rs @@ -254,7 +254,7 @@ fn generate_test_harness( let expn_id = ext_cx.resolver.expansion_for_ast_pass( DUMMY_SP, AstPass::TestHarness, - &[sym::test, sym::rustc_attrs, sym::coverage], + &[sym::test, sym::rustc_attrs, sym::coverage_attribute], None, ); let def_site = DUMMY_SP.with_def_site_ctxt(expn_id.to_expn_id()); diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 7da6f763e99..fcb112eadfe 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, "CURRENT_RUSTC_VERSION", Some(84605), None), + (active, coverage_attribute, "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/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 49fd27de804..b4b794d4e09 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -395,7 +395,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ template!(List: "address, kcfi, memory, thread"), DuplicatesOk, experimental!(no_sanitize) ), - gated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing, experimental!(coverage)), + gated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing, coverage_attribute, experimental!(coverage)), ungated!( doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index a8425b2dc04..23ea8fe8f5a 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -574,6 +574,7 @@ symbols! { cosf64, count, coverage, + coverage_attribute, cr, crate_id, crate_in_paths, diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index be9f75deead..6d5133646b5 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -301,7 +301,7 @@ pub trait Eq: PartialEq { #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] #[allow_internal_unstable(core_intrinsics, derive_eq, structural_match)] #[cfg_attr(bootstrap, allow_internal_unstable(no_coverage))] -#[cfg_attr(not(bootstrap), allow_internal_unstable(coverage))] +#[cfg_attr(not(bootstrap), allow_internal_unstable(coverage_attribute))] pub macro Eq($item:item) { /* compiler built-in */ } diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index e049dcc6eba..7c08d1703cc 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -111,7 +111,7 @@ // Library features: // tidy-alphabetical-start #![cfg_attr(bootstrap, feature(no_coverage))] // rust-lang/rust#84605 -#![cfg_attr(not(bootstrap), feature(coverage))] // rust-lang/rust#84605 +#![cfg_attr(not(bootstrap), feature(coverage_attribute))] // rust-lang/rust#84605 #![feature(char_indices_offset)] #![feature(const_align_of_val)] #![feature(const_align_of_val_raw)] diff --git a/src/doc/unstable-book/src/language-features/coverage.md b/src/doc/unstable-book/src/language-features/coverage-attribute.md similarity index 91% rename from src/doc/unstable-book/src/language-features/coverage.md rename to src/doc/unstable-book/src/language-features/coverage-attribute.md index d200bf6b2bc..0a9bd07de07 100644 --- a/src/doc/unstable-book/src/language-features/coverage.md +++ b/src/doc/unstable-book/src/language-features/coverage-attribute.md @@ -1,4 +1,4 @@ -# `coverage` +# `coverage_attribute` The tracking issue for this feature is: [#84605] @@ -16,7 +16,7 @@ instrumentation in an annotated function. This might be useful to: ## Example ```rust -#![feature(coverage)] +#![feature(coverage_attribute)] // `foo()` will get coverage instrumentation (by default) fn foo() { diff --git a/tests/ui/feature-gates/feature-gate-coverage.rs b/tests/ui/feature-gates/feature-gate-coverage-attribute.rs similarity index 100% rename from tests/ui/feature-gates/feature-gate-coverage.rs rename to tests/ui/feature-gates/feature-gate-coverage-attribute.rs diff --git a/tests/ui/feature-gates/feature-gate-coverage.stderr b/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr similarity index 74% rename from tests/ui/feature-gates/feature-gate-coverage.stderr rename to tests/ui/feature-gates/feature-gate-coverage-attribute.stderr index 25d56912ecd..3912b9834fe 100644 --- a/tests/ui/feature-gates/feature-gate-coverage.stderr +++ b/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr @@ -1,5 +1,5 @@ error[E0557]: feature has been removed - --> $DIR/feature-gate-coverage.rs:2:12 + --> $DIR/feature-gate-coverage-attribute.rs:2:12 | LL | #![feature(no_coverage)] | ^^^^^^^^^^^ feature has been removed @@ -7,13 +7,13 @@ LL | #![feature(no_coverage)] = note: renamed to `coverage` error[E0658]: the `#[coverage]` attribute is an experimental feature - --> $DIR/feature-gate-coverage.rs:10:1 + --> $DIR/feature-gate-coverage-attribute.rs:10:1 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ | = note: see issue #84605 for more information - = help: add `#![feature(coverage)]` to the crate attributes to enable + = help: add `#![feature(coverage_attribute)]` to the crate attributes to enable error: aborting due to 2 previous errors diff --git a/tests/ui/lint/no-coverage.rs b/tests/ui/lint/no-coverage.rs index 92a5ecf51ad..907d25d333e 100644 --- a/tests/ui/lint/no-coverage.rs +++ b/tests/ui/lint/no-coverage.rs @@ -1,5 +1,5 @@ #![feature(extern_types)] -#![feature(coverage)] +#![feature(coverage_attribute)] #![feature(impl_trait_in_assoc_type)] #![warn(unused_attributes)] #![coverage(off)]