Skip to content

Commit cb487cc

Browse files
committed
Stabilize #[coverage] attribute
1 parent 13b77c6 commit cb487cc

File tree

129 files changed

+373
-516
lines changed

Some content is hidden

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

129 files changed

+373
-516
lines changed

compiler/rustc_feature/src/accepted.rs

+3
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ declare_features! (
157157
(accepted, const_refs_to_static, "1.83.0", Some(119618)),
158158
/// Allows implementing `Copy` for closures where possible (RFC 2132).
159159
(accepted, copy_closures, "1.26.0", Some(44490)),
160+
/// Allows function attribute `#[coverage(on/off)]`, to control coverage
161+
/// instrumentation of that function.
162+
(accepted, coverage_attribute, "CURRENT_RUSTC_VERSION", Some(84605)),
160163
/// Allows `crate` in paths.
161164
(accepted, crate_in_paths, "1.30.0", Some(45477)),
162165
/// Allows users to provide classes for fenced code block using `class:classname`.

compiler/rustc_feature/src/builtin_attrs.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -480,10 +480,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
480480
template!(List: "address, kcfi, memory, thread"), DuplicatesOk,
481481
EncodeCrossCrate::No, experimental!(no_sanitize)
482482
),
483-
gated!(
483+
ungated!(
484484
coverage, Normal, template!(OneOf: &[sym::off, sym::on]),
485485
ErrorPreceding, EncodeCrossCrate::No,
486-
coverage_attribute, experimental!(coverage)
487486
),
488487

489488
ungated!(

compiler/rustc_feature/src/unstable.rs

-3
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,6 @@ declare_features! (
448448
(unstable, coroutine_clone, "1.65.0", Some(95360)),
449449
/// Allows defining coroutines.
450450
(unstable, coroutines, "1.21.0", Some(43122)),
451-
/// Allows function attribute `#[coverage(on/off)]`, to control coverage
452-
/// instrumentation of that function.
453-
(unstable, coverage_attribute, "1.74.0", Some(84605)),
454451
/// Allows non-builtin attributes in inner attribute position.
455452
(unstable, custom_inner_attributes, "1.30.0", Some(54726)),
456453
/// Allows custom test frameworks with `#![test_runner]` and `#[test_case]`.

library/core/src/cmp.rs

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

library/core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@
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_eval_select)]
113114
#![feature(const_typed_swap)]
114115
#![feature(core_intrinsics)]
115-
#![feature(coverage_attribute)]
116116
#![feature(do_not_recommend)]
117117
#![feature(internal_impls_macro)]
118118
#![feature(ip)]

library/core/src/macros/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,8 @@ pub(crate) mod builtin {
16731673
///
16741674
/// [the reference]: ../../../reference/attributes/testing.html#the-test-attribute
16751675
#[stable(feature = "rust1", since = "1.0.0")]
1676-
#[allow_internal_unstable(test, rustc_attrs, coverage_attribute)]
1676+
#[allow_internal_unstable(test, rustc_attrs)]
1677+
#[cfg_attr(bootstrap, allow_internal_unstable(coverage_attribute))]
16771678
#[rustc_builtin_macro]
16781679
pub macro test($item:item) {
16791680
/* compiler built-in */
@@ -1686,7 +1687,8 @@ pub(crate) mod builtin {
16861687
soft,
16871688
reason = "`bench` is a part of custom test frameworks which are unstable"
16881689
)]
1689-
#[allow_internal_unstable(test, rustc_attrs, coverage_attribute)]
1690+
#[allow_internal_unstable(test, rustc_attrs)]
1691+
#[cfg_attr(bootstrap, allow_internal_unstable(coverage_attribute))]
16901692
#[rustc_builtin_macro]
16911693
pub macro bench($item:item) {
16921694
/* compiler built-in */

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

-30
This file was deleted.

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)