Skip to content

Commit 53c467b

Browse files
committed
Stabilize #[coverage] attribute
1 parent 7042c26 commit 53c467b

File tree

120 files changed

+320
-459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+320
-459
lines changed

Diff for: compiler/rustc_feature/src/accepted.rs

+3
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ declare_features! (
153153
(accepted, const_refs_to_cell, "CURRENT_RUSTC_VERSION", Some(80384)),
154154
/// Allows implementing `Copy` for closures where possible (RFC 2132).
155155
(accepted, copy_closures, "1.26.0", Some(44490)),
156+
/// Allows function attribute `#[coverage(on/off)]`, to control coverage
157+
/// instrumentation of that function.
158+
(accepted, coverage_attribute, "CURRENT_RUSTC_VERSION", Some(84605)),
156159
/// Allows `crate` in paths.
157160
(accepted, crate_in_paths, "1.30.0", Some(45477)),
158161
/// Allows users to provide classes for fenced code block using `class:classname`.

Diff for: compiler/rustc_feature/src/builtin_attrs.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
482482
template!(List: "address, kcfi, memory, thread"), DuplicatesOk,
483483
EncodeCrossCrate::No, experimental!(no_sanitize)
484484
),
485-
gated!(
485+
ungated!(
486486
coverage, Normal, template!(OneOf: &[sym::off, sym::on]),
487487
ErrorPreceding, EncodeCrossCrate::No,
488-
coverage_attribute, experimental!(coverage)
489488
),
490489

491490
ungated!(

Diff for: compiler/rustc_feature/src/unstable.rs

-3
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,6 @@ declare_features! (
417417
(unstable, coroutine_clone, "1.65.0", Some(95360)),
418418
/// Allows defining coroutines.
419419
(unstable, coroutines, "1.21.0", Some(43122)),
420-
/// Allows function attribute `#[coverage(on/off)]`, to control coverage
421-
/// instrumentation of that function.
422-
(unstable, coverage_attribute, "1.74.0", Some(84605)),
423420
/// Allows non-builtin attributes in inner attribute position.
424421
(unstable, custom_inner_attributes, "1.30.0", Some(54726)),
425422
/// Allows custom test frameworks with `#![test_runner]` and `#[test_case]`.

Diff for: library/core/src/cmp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ pub trait Eq: PartialEq<Self> {
343343
#[rustc_builtin_macro]
344344
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
345345
#[allow_internal_unstable(core_intrinsics, derive_eq, structural_match)]
346-
#[allow_internal_unstable(coverage_attribute)]
346+
#[cfg_attr(bootstrap, allow_internal_unstable(coverage_attribute))]
347347
pub macro Eq($item:item) {
348348
/* compiler built-in */
349349
}

Diff for: library/core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
//
108108
// Library features:
109109
// tidy-alphabetical-start
110+
#![cfg_attr(bootstrap, feature(coverage_attribute))]
110111
#![feature(array_ptr_get)]
111112
#![feature(asm_experimental_arch)]
112113
#![feature(const_align_of_val)]
@@ -161,7 +162,6 @@
161162
#![feature(const_ub_checks)]
162163
#![feature(const_unicode_case_lookup)]
163164
#![feature(const_unsafecell_get_mut)]
164-
#![feature(coverage_attribute)]
165165
#![feature(do_not_recommend)]
166166
#![feature(duration_consts_float)]
167167
#![feature(f128_const)]

Diff for: library/core/src/macros/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,8 @@ pub(crate) mod builtin {
16541654
///
16551655
/// [the reference]: ../../../reference/attributes/testing.html#the-test-attribute
16561656
#[stable(feature = "rust1", since = "1.0.0")]
1657-
#[allow_internal_unstable(test, rustc_attrs, coverage_attribute)]
1657+
#[allow_internal_unstable(test, rustc_attrs)]
1658+
#[cfg_attr(bootstrap, allow_internal_unstable(coverage_attribute))]
16581659
#[rustc_builtin_macro]
16591660
pub macro test($item:item) {
16601661
/* compiler built-in */
@@ -1667,7 +1668,8 @@ pub(crate) mod builtin {
16671668
soft,
16681669
reason = "`bench` is a part of custom test frameworks which are unstable"
16691670
)]
1670-
#[allow_internal_unstable(test, rustc_attrs, coverage_attribute)]
1671+
#[allow_internal_unstable(test, rustc_attrs)]
1672+
#[cfg_attr(bootstrap, allow_internal_unstable(coverage_attribute))]
16711673
#[rustc_builtin_macro]
16721674
pub macro bench($item:item) {
16731675
/* compiler built-in */

Diff for: src/doc/unstable-book/src/language-features/coverage-attribute.md

-30
This file was deleted.

Diff for: src/tools/rust-analyzer/crates/hir-expand/src/inert_attr_macro.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
237237
template!(List: "address, kcfi, memory, thread"), DuplicatesOk,
238238
experimental!(no_sanitize)
239239
),
240-
gated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing, coverage_attribute, experimental!(coverage)),
240+
ungated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing),
241241

242242
ungated!(
243243
doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk

0 commit comments

Comments
 (0)