Skip to content

Commit 7b0b3a2

Browse files
committed
Auto merge of rust-lang#114656 - bossmc:rework-no-coverage-attr, r=oli-obk
Rework `no_coverage` to `coverage(off)` As discussed at the tail of rust-lang#84605 this replaces the `no_coverage` attribute with a `coverage` attribute that takes sub-parameters (currently `off` and `on`) to control the coverage instrumentation. Allows future-proofing for things like `coverage(off, reason="Tested live", issue="rust-lang#12345")` or similar.
2 parents 0e049f6 + 99fc492 commit 7b0b3a2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

core/src/cmp.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ pub trait Eq: PartialEq<Self> {
289289
//
290290
// This should never be implemented by hand.
291291
#[doc(hidden)]
292-
#[no_coverage] // rust-lang/rust#84605
292+
#[cfg_attr(bootstrap, no_coverage)] // rust-lang/rust#84605
293+
#[cfg_attr(not(bootstrap), coverage(off))] //
293294
#[inline]
294295
#[stable(feature = "rust1", since = "1.0.0")]
295296
fn assert_receiver_is_total_eq(&self) {}
@@ -298,7 +299,9 @@ pub trait Eq: PartialEq<Self> {
298299
/// Derive macro generating an impl of the trait [`Eq`].
299300
#[rustc_builtin_macro]
300301
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
301-
#[allow_internal_unstable(core_intrinsics, derive_eq, structural_match, no_coverage)]
302+
#[allow_internal_unstable(core_intrinsics, derive_eq, structural_match)]
303+
#[cfg_attr(bootstrap, allow_internal_unstable(no_coverage))]
304+
#[cfg_attr(not(bootstrap), allow_internal_unstable(coverage_attribute))]
302305
pub macro Eq($item:item) {
303306
/* compiler built-in */
304307
}

core/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@
110110
//
111111
// Library features:
112112
// tidy-alphabetical-start
113+
#![cfg_attr(bootstrap, feature(no_coverage))] // rust-lang/rust#84605
114+
#![cfg_attr(not(bootstrap), feature(coverage_attribute))] // rust-lang/rust#84605
113115
#![feature(char_indices_offset)]
114116
#![feature(const_align_of_val)]
115117
#![feature(const_align_of_val_raw)]
@@ -235,7 +237,6 @@
235237
#![feature(negative_impls)]
236238
#![feature(never_type)]
237239
#![feature(no_core)]
238-
#![feature(no_coverage)] // rust-lang/rust#84605
239240
#![feature(platform_intrinsics)]
240241
#![feature(prelude_import)]
241242
#![feature(repr_simd)]

0 commit comments

Comments
 (0)