Skip to content

Commit

Permalink
Stabilize #[coverage] attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
clarfonthey committed Sep 24, 2024
1 parent 7042c26 commit 8037f0c
Show file tree
Hide file tree
Showing 119 changed files with 314 additions and 453 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]`.
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ pub trait Eq: PartialEq<Self> {
#[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 */
}
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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)]
Expand Down
6 changes: 4 additions & 2 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down
30 changes: 0 additions & 30 deletions src/doc/unstable-book/src/language-features/coverage-attribute.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 8037f0c

Please sign in to comment.