diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 70e92f545c639..3479d1be9ec70 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -153,6 +153,9 @@ declare_features! ( (accepted, const_refs_to_cell, "CURRENT_RUSTC_VERSION", Some(80384)), /// Allows implementing `Copy` for closures where possible (RFC 2132). (accepted, copy_closures, "1.26.0", Some(44490)), + /// Allows function attribute `#[coverage(on/off)]`, to control coverage + /// instrumentation of that function. + (accepted, coverage_attribute, "CURRENT_RUSTC_VERSION", Some(84605)), /// Allows `crate` in paths. (accepted, crate_in_paths, "1.30.0", Some(45477)), /// Allows users to provide classes for fenced code block using `class:classname`. diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 17827b4e43b37..dd6ac7f4d5269 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -482,10 +482,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ template!(List: "address, kcfi, memory, thread"), DuplicatesOk, EncodeCrossCrate::No, experimental!(no_sanitize) ), - gated!( + ungated!( coverage, Normal, template!(OneOf: &[sym::off, sym::on]), ErrorPreceding, EncodeCrossCrate::No, - coverage_attribute, experimental!(coverage) ), ungated!( diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 63b4b272f76c9..a96b92db1a629 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -417,9 +417,6 @@ declare_features! ( (unstable, coroutine_clone, "1.65.0", Some(95360)), /// Allows defining coroutines. (unstable, coroutines, "1.21.0", Some(43122)), - /// Allows function attribute `#[coverage(on/off)]`, to control coverage - /// instrumentation of that function. - (unstable, coverage_attribute, "1.74.0", Some(84605)), /// Allows non-builtin attributes in inner attribute position. (unstable, custom_inner_attributes, "1.30.0", Some(54726)), /// Allows custom test frameworks with `#![test_runner]` and `#[test_case]`. diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 818a36002e759..caf4072fc2986 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -343,7 +343,7 @@ pub trait Eq: PartialEq { #[rustc_builtin_macro] #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] #[allow_internal_unstable(core_intrinsics, derive_eq, structural_match)] -#[allow_internal_unstable(coverage_attribute)] +#[cfg_attr(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 d9b03c9707285..d69b63fc32f8c 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -107,6 +107,7 @@ // // Library features: // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(coverage_attribute))] #![feature(array_ptr_get)] #![feature(asm_experimental_arch)] #![feature(const_align_of_val)] @@ -161,7 +162,6 @@ #![feature(const_ub_checks)] #![feature(const_unicode_case_lookup)] #![feature(const_unsafecell_get_mut)] -#![feature(coverage_attribute)] #![feature(do_not_recommend)] #![feature(duration_consts_float)] #![feature(f128_const)] diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 888832251f6da..dffc61f74eeee 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1654,7 +1654,8 @@ pub(crate) mod builtin { /// /// [the reference]: ../../../reference/attributes/testing.html#the-test-attribute #[stable(feature = "rust1", since = "1.0.0")] - #[allow_internal_unstable(test, rustc_attrs, coverage_attribute)] + #[allow_internal_unstable(test, rustc_attrs)] + #[cfg_attr(bootstrap, allow_internal_unstable(coverage_attribute))] #[rustc_builtin_macro] pub macro test($item:item) { /* compiler built-in */ @@ -1667,7 +1668,8 @@ pub(crate) mod builtin { soft, reason = "`bench` is a part of custom test frameworks which are unstable" )] - #[allow_internal_unstable(test, rustc_attrs, coverage_attribute)] + #[allow_internal_unstable(test, rustc_attrs)] + #[cfg_attr(bootstrap, allow_internal_unstable(coverage_attribute))] #[rustc_builtin_macro] pub macro bench($item:item) { /* compiler built-in */ diff --git a/src/doc/unstable-book/src/language-features/coverage-attribute.md b/src/doc/unstable-book/src/language-features/coverage-attribute.md deleted file mode 100644 index 0a9bd07de07dd..0000000000000 --- a/src/doc/unstable-book/src/language-features/coverage-attribute.md +++ /dev/null @@ -1,30 +0,0 @@ -# `coverage_attribute` - -The tracking issue for this feature is: [#84605] - -[#84605]: https://github.com/rust-lang/rust/issues/84605 - ---- - -The `coverage` attribute can be used to selectively disable coverage -instrumentation in an annotated function. This might be useful to: - -- Avoid instrumentation overhead in a performance critical function -- Avoid generating coverage for a function that is not meant to be executed, - but still target 100% coverage for the rest of the program. - -## Example - -```rust -#![feature(coverage_attribute)] - -// `foo()` will get coverage instrumentation (by default) -fn foo() { - // ... -} - -#[coverage(off)] -fn bar() { - // ... -} -``` diff --git a/src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs b/src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs index 5c25a55362e64..53e5e41ab5c27 100644 --- a/src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs +++ b/src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs @@ -237,7 +237,7 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[ template!(List: "address, kcfi, memory, thread"), DuplicatesOk, experimental!(no_sanitize) ), - gated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing, coverage_attribute, experimental!(coverage)), + ungated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing), ungated!( doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk diff --git a/tests/coverage/async.coverage b/tests/coverage/async.coverage index 429fb112f3383..2985cccd8013f 100644 --- a/tests/coverage/async.coverage +++ b/tests/coverage/async.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |#![feature(custom_inner_attributes)] // for #![rustfmt::skip] LL| |#![feature(noop_waker)] LL| |#![allow(unused_assignments, dead_code)] diff --git a/tests/coverage/async.rs b/tests/coverage/async.rs index a7f3c7cec4191..33fc7ecf86980 100644 --- a/tests/coverage/async.rs +++ b/tests/coverage/async.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] #![feature(custom_inner_attributes)] // for #![rustfmt::skip] #![feature(noop_waker)] #![allow(unused_assignments, dead_code)] diff --git a/tests/coverage/async2.coverage b/tests/coverage/async2.coverage index ed9bc4c239d98..fe0e457ace8a0 100644 --- a/tests/coverage/async2.coverage +++ b/tests/coverage/async2.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |#![feature(noop_waker)] LL| |//@ edition: 2018 LL| | diff --git a/tests/coverage/async2.rs b/tests/coverage/async2.rs index f52c848f6f241..aa3898af35cea 100644 --- a/tests/coverage/async2.rs +++ b/tests/coverage/async2.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] #![feature(noop_waker)] //@ edition: 2018 diff --git a/tests/coverage/async_block.coverage b/tests/coverage/async_block.coverage index d9be8480d801d..b71d56f37b5c2 100644 --- a/tests/coverage/async_block.coverage +++ b/tests/coverage/async_block.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |#![feature(noop_waker)] LL| |//@ edition: 2021 LL| | diff --git a/tests/coverage/async_block.rs b/tests/coverage/async_block.rs index 7ae8241aa7712..ea8346b8936b2 100644 --- a/tests/coverage/async_block.rs +++ b/tests/coverage/async_block.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] #![feature(noop_waker)] //@ edition: 2021 diff --git a/tests/coverage/attr/impl.coverage b/tests/coverage/attr/impl.coverage index 560429fb5fe5d..205b9e830a564 100644 --- a/tests/coverage/attr/impl.coverage +++ b/tests/coverage/attr/impl.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| | LL| |// Checks that `#[coverage(..)]` can be applied to impl and impl-trait blocks, diff --git a/tests/coverage/attr/impl.rs b/tests/coverage/attr/impl.rs index d4d784a3502b9..8c1f991926dc5 100644 --- a/tests/coverage/attr/impl.rs +++ b/tests/coverage/attr/impl.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // Checks that `#[coverage(..)]` can be applied to impl and impl-trait blocks, diff --git a/tests/coverage/attr/module.coverage b/tests/coverage/attr/module.coverage index c1b9f0e35c0b1..acad031206904 100644 --- a/tests/coverage/attr/module.coverage +++ b/tests/coverage/attr/module.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| | LL| |// Checks that `#[coverage(..)]` can be applied to modules, and is inherited diff --git a/tests/coverage/attr/module.rs b/tests/coverage/attr/module.rs index 4bfb1e7729b7d..ed530d53e47a1 100644 --- a/tests/coverage/attr/module.rs +++ b/tests/coverage/attr/module.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // Checks that `#[coverage(..)]` can be applied to modules, and is inherited diff --git a/tests/coverage/attr/nested.coverage b/tests/coverage/attr/nested.coverage index 2d64fe698ead9..02dc384dea7ee 100644 --- a/tests/coverage/attr/nested.coverage +++ b/tests/coverage/attr/nested.coverage @@ -1,4 +1,4 @@ - LL| |#![feature(coverage_attribute, stmt_expr_attributes)] + LL| |#![feature(stmt_expr_attributes)] LL| |//@ edition: 2021 LL| | LL| |// Demonstrates the interaction between #[coverage(off)] and various kinds of @@ -103,4 +103,3 @@ LL| | closure_expr(); LL| | closure_tail(); LL| |} - diff --git a/tests/coverage/attr/nested.rs b/tests/coverage/attr/nested.rs index 8213e29b6fcd9..019f07428c112 100644 --- a/tests/coverage/attr/nested.rs +++ b/tests/coverage/attr/nested.rs @@ -1,4 +1,4 @@ -#![feature(coverage_attribute, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] //@ edition: 2021 // Demonstrates the interaction between #[coverage(off)] and various kinds of diff --git a/tests/coverage/attr/off-on-sandwich.coverage b/tests/coverage/attr/off-on-sandwich.coverage index 675697906ee76..f23c248c0ebac 100644 --- a/tests/coverage/attr/off-on-sandwich.coverage +++ b/tests/coverage/attr/off-on-sandwich.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| | LL| |// Demonstrates the interaction of `#[coverage(off)]` and `#[coverage(on)]` diff --git a/tests/coverage/attr/off-on-sandwich.rs b/tests/coverage/attr/off-on-sandwich.rs index 261634e00296a..4272365d87dcb 100644 --- a/tests/coverage/attr/off-on-sandwich.rs +++ b/tests/coverage/attr/off-on-sandwich.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // Demonstrates the interaction of `#[coverage(off)]` and `#[coverage(on)]` diff --git a/tests/coverage/auxiliary/executor.rs b/tests/coverage/auxiliary/executor.rs index fb07c8ce304b8..59ce0bffb1154 100644 --- a/tests/coverage/auxiliary/executor.rs +++ b/tests/coverage/auxiliary/executor.rs @@ -1,4 +1,4 @@ -#![feature(coverage_attribute, noop_waker)] +#![feature(noop_waker)] //@ edition: 2021 use core::future::Future; diff --git a/tests/coverage/await_ready.coverage b/tests/coverage/await_ready.coverage index 7ab03e6d3de0a..9b54b340e82d5 100644 --- a/tests/coverage/await_ready.coverage +++ b/tests/coverage/await_ready.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |#![feature(noop_waker)] LL| |#![coverage(off)] LL| |//@ edition: 2021 @@ -22,4 +21,3 @@ LL| | let mut future = Box::pin(await_ready()); LL| | executor::block_on(future.as_mut()); LL| |} - diff --git a/tests/coverage/await_ready.rs b/tests/coverage/await_ready.rs index 27ee99d39890e..c1f883f7ac218 100644 --- a/tests/coverage/await_ready.rs +++ b/tests/coverage/await_ready.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] #![feature(noop_waker)] #![coverage(off)] //@ edition: 2021 diff --git a/tests/coverage/bad_counter_ids.coverage b/tests/coverage/bad_counter_ids.coverage index f6c69913cdd2c..eede634923ddc 100644 --- a/tests/coverage/bad_counter_ids.coverage +++ b/tests/coverage/bad_counter_ids.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Copt-level=0 -Zmir-opt-level=3 LL| | diff --git a/tests/coverage/bad_counter_ids.rs b/tests/coverage/bad_counter_ids.rs index ef31d682e4f1a..8fa0d83bf20c3 100644 --- a/tests/coverage/bad_counter_ids.rs +++ b/tests/coverage/bad_counter_ids.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Copt-level=0 -Zmir-opt-level=3 diff --git a/tests/coverage/branch/generics.coverage b/tests/coverage/branch/generics.coverage index 85f73d45f65e0..849ddfa7a7204 100644 --- a/tests/coverage/branch/generics.coverage +++ b/tests/coverage/branch/generics.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=branch LL| |//@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/generics.rs b/tests/coverage/branch/generics.rs index d870ace7006b3..24bfdaaa687e1 100644 --- a/tests/coverage/branch/generics.rs +++ b/tests/coverage/branch/generics.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=branch //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/guard.coverage b/tests/coverage/branch/guard.coverage index f89b965b5d0f7..3376209d373e5 100644 --- a/tests/coverage/branch/guard.coverage +++ b/tests/coverage/branch/guard.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=branch LL| |//@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/guard.rs b/tests/coverage/branch/guard.rs index fa049e6206dc5..78b79a62946bd 100644 --- a/tests/coverage/branch/guard.rs +++ b/tests/coverage/branch/guard.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=branch //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/if-let.coverage b/tests/coverage/branch/if-let.coverage index 9a3f0113f7515..8552371b447d6 100644 --- a/tests/coverage/branch/if-let.coverage +++ b/tests/coverage/branch/if-let.coverage @@ -1,4 +1,4 @@ - LL| |#![feature(coverage_attribute, let_chains)] + LL| |#![feature(let_chains)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=branch LL| |//@ llvm-cov-flags: --show-branches=count @@ -68,4 +68,3 @@ LL| |} LL| | LL| |// FIXME(#124118) Actually instrument if-let and let-chains for branch coverage. - diff --git a/tests/coverage/branch/if-let.rs b/tests/coverage/branch/if-let.rs index 13db00a82b126..1ac506964b1c4 100644 --- a/tests/coverage/branch/if-let.rs +++ b/tests/coverage/branch/if-let.rs @@ -1,4 +1,4 @@ -#![feature(coverage_attribute, let_chains)] +#![feature(let_chains)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=branch //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/if.coverage b/tests/coverage/branch/if.coverage index 2a9a408b16aff..c098338acea47 100644 --- a/tests/coverage/branch/if.coverage +++ b/tests/coverage/branch/if.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=branch LL| |//@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/if.rs b/tests/coverage/branch/if.rs index 151eede75bbc7..9e06ffc1aa528 100644 --- a/tests/coverage/branch/if.rs +++ b/tests/coverage/branch/if.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=branch //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/lazy-boolean.coverage b/tests/coverage/branch/lazy-boolean.coverage index f6aba1da46e49..6e5dfbd19f381 100644 --- a/tests/coverage/branch/lazy-boolean.coverage +++ b/tests/coverage/branch/lazy-boolean.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=branch LL| |//@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/lazy-boolean.rs b/tests/coverage/branch/lazy-boolean.rs index 3c73fc1a87d71..68267bf56ed2f 100644 --- a/tests/coverage/branch/lazy-boolean.rs +++ b/tests/coverage/branch/lazy-boolean.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=branch //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/let-else.coverage b/tests/coverage/branch/let-else.coverage index 22ad8f2b0e138..f0549205590e6 100644 --- a/tests/coverage/branch/let-else.coverage +++ b/tests/coverage/branch/let-else.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=branch LL| |//@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/let-else.rs b/tests/coverage/branch/let-else.rs index af0665d8241eb..0d23d956541d6 100644 --- a/tests/coverage/branch/let-else.rs +++ b/tests/coverage/branch/let-else.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=branch //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/match-arms.coverage b/tests/coverage/branch/match-arms.coverage index ea8a6f97ab154..bc797d55a530e 100644 --- a/tests/coverage/branch/match-arms.coverage +++ b/tests/coverage/branch/match-arms.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=branch LL| |//@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/match-arms.rs b/tests/coverage/branch/match-arms.rs index 63151f59ffe9b..6292a9c20503b 100644 --- a/tests/coverage/branch/match-arms.rs +++ b/tests/coverage/branch/match-arms.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=branch //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/match-trivial.coverage b/tests/coverage/branch/match-trivial.coverage index 4ffb172e1b675..bd6be9ea3b570 100644 --- a/tests/coverage/branch/match-trivial.coverage +++ b/tests/coverage/branch/match-trivial.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=branch LL| |//@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/match-trivial.rs b/tests/coverage/branch/match-trivial.rs index db8887a26b7a4..62680916d5cb2 100644 --- a/tests/coverage/branch/match-trivial.rs +++ b/tests/coverage/branch/match-trivial.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=branch //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/no-mir-spans.coverage b/tests/coverage/branch/no-mir-spans.coverage index 2cae98ed3ff4f..be5a1ef34429a 100644 --- a/tests/coverage/branch/no-mir-spans.coverage +++ b/tests/coverage/branch/no-mir-spans.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=branch,no-mir-spans LL| |//@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/no-mir-spans.rs b/tests/coverage/branch/no-mir-spans.rs index acb268f2d4554..47b4d1eff5836 100644 --- a/tests/coverage/branch/no-mir-spans.rs +++ b/tests/coverage/branch/no-mir-spans.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=branch,no-mir-spans //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/while.coverage b/tests/coverage/branch/while.coverage index 8d9a6c3bc68b7..b16c8d7defd07 100644 --- a/tests/coverage/branch/while.coverage +++ b/tests/coverage/branch/while.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=branch LL| |//@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/branch/while.rs b/tests/coverage/branch/while.rs index 507815fbecbeb..e7180c43a5ecc 100644 --- a/tests/coverage/branch/while.rs +++ b/tests/coverage/branch/while.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=branch //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/closure_macro_async.coverage b/tests/coverage/closure_macro_async.coverage index a8c72efac6664..84aa33ca0b99d 100644 --- a/tests/coverage/closure_macro_async.coverage +++ b/tests/coverage/closure_macro_async.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |#![feature(noop_waker)] LL| |//@ edition: 2018 LL| | diff --git a/tests/coverage/closure_macro_async.rs b/tests/coverage/closure_macro_async.rs index defd1b6d632c8..88ab705e77670 100644 --- a/tests/coverage/closure_macro_async.rs +++ b/tests/coverage/closure_macro_async.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] #![feature(noop_waker)] //@ edition: 2018 diff --git a/tests/coverage/closure_unit_return.coverage b/tests/coverage/closure_unit_return.coverage index 5e57e0db1600d..131fab993f067 100644 --- a/tests/coverage/closure_unit_return.coverage +++ b/tests/coverage/closure_unit_return.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| | LL| |// Regression test for an inconsistency between functions that return the value diff --git a/tests/coverage/closure_unit_return.rs b/tests/coverage/closure_unit_return.rs index d4f139dd363b0..74334f32f6eb4 100644 --- a/tests/coverage/closure_unit_return.rs +++ b/tests/coverage/closure_unit_return.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // Regression test for an inconsistency between functions that return the value diff --git a/tests/coverage/condition/conditions.coverage b/tests/coverage/condition/conditions.coverage index 3215b391d622e..117e9aabb5b27 100644 --- a/tests/coverage/condition/conditions.coverage +++ b/tests/coverage/condition/conditions.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ compile-flags: -Zcoverage-options=condition LL| |//@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/condition/conditions.rs b/tests/coverage/condition/conditions.rs index 3d658dc93e0c7..63fa962ce5fa2 100644 --- a/tests/coverage/condition/conditions.rs +++ b/tests/coverage/condition/conditions.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ compile-flags: -Zcoverage-options=condition //@ llvm-cov-flags: --show-branches=count diff --git a/tests/coverage/coverage_attr_closure.coverage b/tests/coverage/coverage_attr_closure.coverage index 7bdb96bdab851..5235631bea6c9 100644 --- a/tests/coverage/coverage_attr_closure.coverage +++ b/tests/coverage/coverage_attr_closure.coverage @@ -1,4 +1,4 @@ - LL| |#![feature(coverage_attribute, stmt_expr_attributes)] + LL| |#![feature(stmt_expr_attributes)] LL| |#![allow(dead_code)] LL| |//@ edition: 2021 LL| | @@ -40,4 +40,3 @@ LL| | contains_closures_on(); LL| | contains_closures_off(); LL| |} - diff --git a/tests/coverage/coverage_attr_closure.rs b/tests/coverage/coverage_attr_closure.rs index 4341a868ab846..c66ccb7f5a543 100644 --- a/tests/coverage/coverage_attr_closure.rs +++ b/tests/coverage/coverage_attr_closure.rs @@ -1,4 +1,4 @@ -#![feature(coverage_attribute, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] #![allow(dead_code)] //@ edition: 2021 diff --git a/tests/coverage/fn_sig_into_try.coverage b/tests/coverage/fn_sig_into_try.coverage index cabe747ce5ac7..05b8edf15a4be 100644 --- a/tests/coverage/fn_sig_into_try.coverage +++ b/tests/coverage/fn_sig_into_try.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| | LL| |// Regression test for inconsistent handling of function signature spans that diff --git a/tests/coverage/fn_sig_into_try.rs b/tests/coverage/fn_sig_into_try.rs index cda5e716edf5e..fd3e0c3f7c695 100644 --- a/tests/coverage/fn_sig_into_try.rs +++ b/tests/coverage/fn_sig_into_try.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // Regression test for inconsistent handling of function signature spans that diff --git a/tests/coverage/if_not.coverage b/tests/coverage/if_not.coverage index 678ccf9f2f853..c96627d88aef1 100644 --- a/tests/coverage/if_not.coverage +++ b/tests/coverage/if_not.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| | LL| |#[rustfmt::skip] diff --git a/tests/coverage/if_not.rs b/tests/coverage/if_not.rs index 69283ef2527d5..d1c2b5fc9820e 100644 --- a/tests/coverage/if_not.rs +++ b/tests/coverage/if_not.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 #[rustfmt::skip] diff --git a/tests/coverage/let_else_loop.coverage b/tests/coverage/let_else_loop.coverage index bd13f6e56501c..b42e1e144ae30 100644 --- a/tests/coverage/let_else_loop.coverage +++ b/tests/coverage/let_else_loop.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| | LL| |// Regression test for . diff --git a/tests/coverage/let_else_loop.rs b/tests/coverage/let_else_loop.rs index 8217c0d072a67..8357128785976 100644 --- a/tests/coverage/let_else_loop.rs +++ b/tests/coverage/let_else_loop.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // Regression test for . diff --git a/tests/coverage/macro_in_closure.coverage b/tests/coverage/macro_in_closure.coverage index a23ad2c37ec22..c829c512cb87d 100644 --- a/tests/coverage/macro_in_closure.coverage +++ b/tests/coverage/macro_in_closure.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| | LL| |// If a closure body consists entirely of a single bang-macro invocation, the diff --git a/tests/coverage/macro_in_closure.rs b/tests/coverage/macro_in_closure.rs index 3d62b54073f17..251fbf04ee337 100644 --- a/tests/coverage/macro_in_closure.rs +++ b/tests/coverage/macro_in_closure.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // If a closure body consists entirely of a single bang-macro invocation, the diff --git a/tests/coverage/mcdc/condition-limit.coverage b/tests/coverage/mcdc/condition-limit.coverage index ae8596bb9611a..a110c29f9a57e 100644 --- a/tests/coverage/mcdc/condition-limit.coverage +++ b/tests/coverage/mcdc/condition-limit.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ ignore-llvm-version: 19 - 99 LL| |//@ compile-flags: -Zcoverage-options=mcdc diff --git a/tests/coverage/mcdc/condition-limit.rs b/tests/coverage/mcdc/condition-limit.rs index 0d8546b01cd58..5da9b769000aa 100644 --- a/tests/coverage/mcdc/condition-limit.rs +++ b/tests/coverage/mcdc/condition-limit.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ ignore-llvm-version: 19 - 99 //@ compile-flags: -Zcoverage-options=mcdc diff --git a/tests/coverage/mcdc/if.coverage b/tests/coverage/mcdc/if.coverage index d71de28c6f613..5c77a2aef25f8 100644 --- a/tests/coverage/mcdc/if.coverage +++ b/tests/coverage/mcdc/if.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ ignore-llvm-version: 19 - 99 LL| |//@ compile-flags: -Zcoverage-options=mcdc diff --git a/tests/coverage/mcdc/if.rs b/tests/coverage/mcdc/if.rs index 17247f5e0c182..a85e7c13192dc 100644 --- a/tests/coverage/mcdc/if.rs +++ b/tests/coverage/mcdc/if.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ ignore-llvm-version: 19 - 99 //@ compile-flags: -Zcoverage-options=mcdc diff --git a/tests/coverage/mcdc/inlined_expressions.coverage b/tests/coverage/mcdc/inlined_expressions.coverage index af0b78477d4dc..4be0c2947835b 100644 --- a/tests/coverage/mcdc/inlined_expressions.coverage +++ b/tests/coverage/mcdc/inlined_expressions.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ ignore-llvm-version: 19 - 99 LL| |//@ compile-flags: -Zcoverage-options=mcdc -Copt-level=z -Cllvm-args=--inline-threshold=0 diff --git a/tests/coverage/mcdc/inlined_expressions.rs b/tests/coverage/mcdc/inlined_expressions.rs index 5c1fde6681ab8..fc2ae1affdbb8 100644 --- a/tests/coverage/mcdc/inlined_expressions.rs +++ b/tests/coverage/mcdc/inlined_expressions.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ ignore-llvm-version: 19 - 99 //@ compile-flags: -Zcoverage-options=mcdc -Copt-level=z -Cllvm-args=--inline-threshold=0 diff --git a/tests/coverage/mcdc/nested_if.coverage b/tests/coverage/mcdc/nested_if.coverage index 37aa33d5c57d9..67f517d6c073a 100644 --- a/tests/coverage/mcdc/nested_if.coverage +++ b/tests/coverage/mcdc/nested_if.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ ignore-llvm-version: 19 - 99 LL| |//@ compile-flags: -Zcoverage-options=mcdc diff --git a/tests/coverage/mcdc/nested_if.rs b/tests/coverage/mcdc/nested_if.rs index 1443ccc23abc4..effb1f88f7b93 100644 --- a/tests/coverage/mcdc/nested_if.rs +++ b/tests/coverage/mcdc/nested_if.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ ignore-llvm-version: 19 - 99 //@ compile-flags: -Zcoverage-options=mcdc diff --git a/tests/coverage/mcdc/non_control_flow.coverage b/tests/coverage/mcdc/non_control_flow.coverage index 74c19cf12dfee..5981c647ee7af 100644 --- a/tests/coverage/mcdc/non_control_flow.coverage +++ b/tests/coverage/mcdc/non_control_flow.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| |//@ ignore-llvm-version: 19 - 99 LL| |//@ compile-flags: -Zcoverage-options=mcdc diff --git a/tests/coverage/mcdc/non_control_flow.rs b/tests/coverage/mcdc/non_control_flow.rs index e0145ed8268a9..706629c701b2f 100644 --- a/tests/coverage/mcdc/non_control_flow.rs +++ b/tests/coverage/mcdc/non_control_flow.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 //@ ignore-llvm-version: 19 - 99 //@ compile-flags: -Zcoverage-options=mcdc diff --git a/tests/coverage/no_cov_crate.coverage b/tests/coverage/no_cov_crate.coverage index 6a43e52652e00..b08e56044545e 100644 --- a/tests/coverage/no_cov_crate.coverage +++ b/tests/coverage/no_cov_crate.coverage @@ -1,5 +1,4 @@ LL| |// Enables `coverage(off)` on the entire crate - LL| |#![feature(coverage_attribute)] LL| | LL| |#[coverage(off)] LL| |fn do_not_add_coverage_1() { diff --git a/tests/coverage/no_cov_crate.rs b/tests/coverage/no_cov_crate.rs index e12e4bc55e3e4..1b4b384b16718 100644 --- a/tests/coverage/no_cov_crate.rs +++ b/tests/coverage/no_cov_crate.rs @@ -1,5 +1,4 @@ // Enables `coverage(off)` on the entire crate -#![feature(coverage_attribute)] #[coverage(off)] fn do_not_add_coverage_1() { diff --git a/tests/coverage/no_spans.coverage b/tests/coverage/no_spans.coverage index 19e8c2fe5b6bd..c722210e35f03 100644 --- a/tests/coverage/no_spans.coverage +++ b/tests/coverage/no_spans.coverage @@ -1,4 +1,3 @@ - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| | LL| |// If the span extractor can't find any relevant spans for a function, the diff --git a/tests/coverage/no_spans.rs b/tests/coverage/no_spans.rs index e5312406f8a19..db28bfd059036 100644 --- a/tests/coverage/no_spans.rs +++ b/tests/coverage/no_spans.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // If the span extractor can't find any relevant spans for a function, the diff --git a/tests/coverage/unreachable.coverage b/tests/coverage/unreachable.coverage index fdb6d3616d9a5..6f9f45dce1eab 100644 --- a/tests/coverage/unreachable.coverage +++ b/tests/coverage/unreachable.coverage @@ -1,5 +1,4 @@ LL| |#![feature(core_intrinsics)] - LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 LL| | LL| |// diff --git a/tests/coverage/unreachable.rs b/tests/coverage/unreachable.rs index 0e05c1d11be4e..d6082f85a36f3 100644 --- a/tests/coverage/unreachable.rs +++ b/tests/coverage/unreachable.rs @@ -1,5 +1,4 @@ #![feature(core_intrinsics)] -#![feature(coverage_attribute)] //@ edition: 2021 // diff --git a/tests/mir-opt/coverage/branch_match_arms.rs b/tests/mir-opt/coverage/branch_match_arms.rs index 18764b38d6e3e..84ffddcb28948 100644 --- a/tests/mir-opt/coverage/branch_match_arms.rs +++ b/tests/mir-opt/coverage/branch_match_arms.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ test-mir-pass: InstrumentCoverage //@ compile-flags: -Cinstrument-coverage -Zno-profiler-runtime -Zcoverage-options=branch // skip-filecheck diff --git a/tests/ui/coverage-attr/bad-syntax.rs b/tests/ui/coverage-attr/bad-syntax.rs index c8c92de8c380f..fa2b25ceccd7c 100644 --- a/tests/ui/coverage-attr/bad-syntax.rs +++ b/tests/ui/coverage-attr/bad-syntax.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // Tests the error messages produced (or not produced) by various unusual diff --git a/tests/ui/coverage-attr/name-value.rs b/tests/ui/coverage-attr/name-value.rs index 24a0feb0710f6..4d09b3796a790 100644 --- a/tests/ui/coverage-attr/name-value.rs +++ b/tests/ui/coverage-attr/name-value.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // Demonstrates the diagnostics produced when using the syntax diff --git a/tests/ui/coverage-attr/no-coverage.rs b/tests/ui/coverage-attr/no-coverage.rs index 9545b0b55cf24..634eceee0f67b 100644 --- a/tests/ui/coverage-attr/no-coverage.rs +++ b/tests/ui/coverage-attr/no-coverage.rs @@ -1,5 +1,4 @@ #![feature(extern_types)] -#![feature(coverage_attribute)] #![feature(impl_trait_in_assoc_type)] #![warn(unused_attributes)] #![coverage(off)] diff --git a/tests/ui/coverage-attr/subword.rs b/tests/ui/coverage-attr/subword.rs index 16582240b6908..00c8dea3d374b 100644 --- a/tests/ui/coverage-attr/subword.rs +++ b/tests/ui/coverage-attr/subword.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // Check that yes/no in `#[coverage(yes)]` and `#[coverage(no)]` must be bare diff --git a/tests/ui/coverage-attr/word-only.rs b/tests/ui/coverage-attr/word-only.rs index ea12e7b19eeff..6d9503593f015 100644 --- a/tests/ui/coverage-attr/word-only.rs +++ b/tests/ui/coverage-attr/word-only.rs @@ -1,4 +1,3 @@ -#![feature(coverage_attribute)] //@ edition: 2021 // Demonstrates the diagnostics produced when using the syntax `#[coverage]`, diff --git a/tests/ui/feature-gates/feature-gate-coverage-attribute.rs b/tests/ui/feature-gates/feature-gate-coverage-attribute.rs deleted file mode 100644 index 0a463755f1373..0000000000000 --- a/tests/ui/feature-gates/feature-gate-coverage-attribute.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![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 { - a: u8, - b: u32, -} - -#[coverage(off)] //~ ERROR the `#[coverage]` attribute is an experimental feature -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-attribute.stderr b/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr deleted file mode 100644 index 00e0f0afbde67..0000000000000 --- a/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr +++ /dev/null @@ -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 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`.