From 0ca6c38cc22fe516ac5f25f87cff996cfd8932b7 Mon Sep 17 00:00:00 2001
From: Andy Caldwell <andycaldwell@microsoft.com>
Date: Tue, 5 Sep 2023 23:42:57 +0100
Subject: [PATCH] Fix up run-coverage and coverage-map/status-quo tests

---
 tests/coverage-map/status-quo/closure_macro.rs     |  2 +-
 .../coverage-map/status-quo/closure_macro_async.rs | 14 +++++++-------
 tests/coverage-map/status-quo/no_cov_crate.rs      | 14 +++++++-------
 tests/run-coverage/closure_macro.coverage          |  2 +-
 tests/run-coverage/closure_macro.rs                |  2 +-
 tests/run-coverage/closure_macro_async.coverage    | 14 +++++++-------
 tests/run-coverage/closure_macro_async.rs          | 14 +++++++-------
 tests/run-coverage/no_cov_crate.coverage           | 14 +++++++-------
 tests/run-coverage/no_cov_crate.rs                 | 14 +++++++-------
 9 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/tests/coverage-map/status-quo/closure_macro.rs b/tests/coverage-map/status-quo/closure_macro.rs
index 5e3b00d1ef5..9b289141c2e 100644
--- a/tests/coverage-map/status-quo/closure_macro.rs
+++ b/tests/coverage-map/status-quo/closure_macro.rs
@@ -1,5 +1,5 @@
 // compile-flags: --edition=2018
-#![feature(no_coverage)]
+#![feature(coverage_attribute)]
 
 macro_rules! bail {
     ($msg:literal $(,)?) => {
diff --git a/tests/coverage-map/status-quo/closure_macro_async.rs b/tests/coverage-map/status-quo/closure_macro_async.rs
index 3d6bdb38a2a..b4275599e59 100644
--- a/tests/coverage-map/status-quo/closure_macro_async.rs
+++ b/tests/coverage-map/status-quo/closure_macro_async.rs
@@ -1,5 +1,5 @@
 // compile-flags: --edition=2018
-#![feature(no_coverage)]
+#![feature(coverage_attribute)]
 
 macro_rules! bail {
     ($msg:literal $(,)?) => {
@@ -39,7 +39,7 @@ pub async fn test() -> Result<(), String> {
     Ok(())
 }
 
-#[no_coverage]
+#[coverage(off)]
 fn main() {
     executor::block_on(test()).unwrap();
 }
@@ -51,18 +51,18 @@ mod executor {
         task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
     };
 
-    #[no_coverage]
+    #[coverage(off)]
     pub fn block_on<F: Future>(mut future: F) -> F::Output {
         let mut future = unsafe { Pin::new_unchecked(&mut future) };
         use std::hint::unreachable_unchecked;
         static VTABLE: RawWakerVTable = RawWakerVTable::new(
-            #[no_coverage]
+            #[coverage(off)]
             |_| unsafe { unreachable_unchecked() }, // clone
-            #[no_coverage]
+            #[coverage(off)]
             |_| unsafe { unreachable_unchecked() }, // wake
-            #[no_coverage]
+            #[coverage(off)]
             |_| unsafe { unreachable_unchecked() }, // wake_by_ref
-            #[no_coverage]
+            #[coverage(off)]
             |_| (),
         );
         let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
diff --git a/tests/coverage-map/status-quo/no_cov_crate.rs b/tests/coverage-map/status-quo/no_cov_crate.rs
index 5b748aeefb7..e12e4bc55e3 100644
--- a/tests/coverage-map/status-quo/no_cov_crate.rs
+++ b/tests/coverage-map/status-quo/no_cov_crate.rs
@@ -1,17 +1,17 @@
-// Enables `no_coverage` on the entire crate
-#![feature(no_coverage)]
+// Enables `coverage(off)` on the entire crate
+#![feature(coverage_attribute)]
 
-#[no_coverage]
+#[coverage(off)]
 fn do_not_add_coverage_1() {
     println!("called but not covered");
 }
 
 fn do_not_add_coverage_2() {
-    #![no_coverage]
+    #![coverage(off)]
     println!("called but not covered");
 }
 
-#[no_coverage]
+#[coverage(off)]
 #[allow(dead_code)]
 fn do_not_add_coverage_not_called() {
     println!("not called and not covered");
@@ -33,7 +33,7 @@ fn add_coverage_not_called() {
 // FIXME: These test-cases illustrate confusing results of nested functions.
 // See https://github.com/rust-lang/rust/issues/93319
 mod nested_fns {
-    #[no_coverage]
+    #[coverage(off)]
     pub fn outer_not_covered(is_true: bool) {
         fn inner(is_true: bool) {
             if is_true {
@@ -50,7 +50,7 @@ mod nested_fns {
         println!("called and covered");
         inner_not_covered(is_true);
 
-        #[no_coverage]
+        #[coverage(off)]
         fn inner_not_covered(is_true: bool) {
             if is_true {
                 println!("called but not covered");
diff --git a/tests/run-coverage/closure_macro.coverage b/tests/run-coverage/closure_macro.coverage
index 1bfd2013da8..0f2c917e090 100644
--- a/tests/run-coverage/closure_macro.coverage
+++ b/tests/run-coverage/closure_macro.coverage
@@ -1,5 +1,5 @@
    LL|       |// compile-flags: --edition=2018
-   LL|       |#![feature(no_coverage)]
+   LL|       |#![feature(coverage_attribute)]
    LL|       |
    LL|       |macro_rules! bail {
    LL|       |    ($msg:literal $(,)?) => {
diff --git a/tests/run-coverage/closure_macro.rs b/tests/run-coverage/closure_macro.rs
index 5e3b00d1ef5..9b289141c2e 100644
--- a/tests/run-coverage/closure_macro.rs
+++ b/tests/run-coverage/closure_macro.rs
@@ -1,5 +1,5 @@
 // compile-flags: --edition=2018
-#![feature(no_coverage)]
+#![feature(coverage_attribute)]
 
 macro_rules! bail {
     ($msg:literal $(,)?) => {
diff --git a/tests/run-coverage/closure_macro_async.coverage b/tests/run-coverage/closure_macro_async.coverage
index 018e3160e4f..74247f1bc6f 100644
--- a/tests/run-coverage/closure_macro_async.coverage
+++ b/tests/run-coverage/closure_macro_async.coverage
@@ -1,5 +1,5 @@
    LL|       |// compile-flags: --edition=2018
-   LL|       |#![feature(no_coverage)]
+   LL|       |#![feature(coverage_attribute)]
    LL|       |
    LL|       |macro_rules! bail {
    LL|       |    ($msg:literal $(,)?) => {
@@ -40,7 +40,7 @@
    LL|      1|    Ok(())
    LL|      1|}
    LL|       |
-   LL|       |#[no_coverage]
+   LL|       |#[coverage(off)]
    LL|       |fn main() {
    LL|       |    executor::block_on(test()).unwrap();
    LL|       |}
@@ -52,18 +52,18 @@
    LL|       |        task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
    LL|       |    };
    LL|       |
-   LL|       |    #[no_coverage]
+   LL|       |    #[coverage(off)]
    LL|       |    pub fn block_on<F: Future>(mut future: F) -> F::Output {
    LL|       |        let mut future = unsafe { Pin::new_unchecked(&mut future) };
    LL|       |        use std::hint::unreachable_unchecked;
    LL|       |        static VTABLE: RawWakerVTable = RawWakerVTable::new(
-   LL|       |            #[no_coverage]
+   LL|       |            #[coverage(off)]
    LL|       |            |_| unsafe { unreachable_unchecked() }, // clone
-   LL|       |            #[no_coverage]
+   LL|       |            #[coverage(off)]
    LL|       |            |_| unsafe { unreachable_unchecked() }, // wake
-   LL|       |            #[no_coverage]
+   LL|       |            #[coverage(off)]
    LL|       |            |_| unsafe { unreachable_unchecked() }, // wake_by_ref
-   LL|       |            #[no_coverage]
+   LL|       |            #[coverage(off)]
    LL|       |            |_| (),
    LL|       |        );
    LL|       |        let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
diff --git a/tests/run-coverage/closure_macro_async.rs b/tests/run-coverage/closure_macro_async.rs
index 3d6bdb38a2a..b4275599e59 100644
--- a/tests/run-coverage/closure_macro_async.rs
+++ b/tests/run-coverage/closure_macro_async.rs
@@ -1,5 +1,5 @@
 // compile-flags: --edition=2018
-#![feature(no_coverage)]
+#![feature(coverage_attribute)]
 
 macro_rules! bail {
     ($msg:literal $(,)?) => {
@@ -39,7 +39,7 @@ pub async fn test() -> Result<(), String> {
     Ok(())
 }
 
-#[no_coverage]
+#[coverage(off)]
 fn main() {
     executor::block_on(test()).unwrap();
 }
@@ -51,18 +51,18 @@ mod executor {
         task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
     };
 
-    #[no_coverage]
+    #[coverage(off)]
     pub fn block_on<F: Future>(mut future: F) -> F::Output {
         let mut future = unsafe { Pin::new_unchecked(&mut future) };
         use std::hint::unreachable_unchecked;
         static VTABLE: RawWakerVTable = RawWakerVTable::new(
-            #[no_coverage]
+            #[coverage(off)]
             |_| unsafe { unreachable_unchecked() }, // clone
-            #[no_coverage]
+            #[coverage(off)]
             |_| unsafe { unreachable_unchecked() }, // wake
-            #[no_coverage]
+            #[coverage(off)]
             |_| unsafe { unreachable_unchecked() }, // wake_by_ref
-            #[no_coverage]
+            #[coverage(off)]
             |_| (),
         );
         let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
diff --git a/tests/run-coverage/no_cov_crate.coverage b/tests/run-coverage/no_cov_crate.coverage
index 73f6fbd0c2b..f5a0322bf3e 100644
--- a/tests/run-coverage/no_cov_crate.coverage
+++ b/tests/run-coverage/no_cov_crate.coverage
@@ -1,17 +1,17 @@
-   LL|       |// Enables `no_coverage` on the entire crate
-   LL|       |#![feature(no_coverage)]
+   LL|       |// Enables `coverage(off)` on the entire crate
+   LL|       |#![feature(coverage_attribute)]
    LL|       |
-   LL|       |#[no_coverage]
+   LL|       |#[coverage(off)]
    LL|       |fn do_not_add_coverage_1() {
    LL|       |    println!("called but not covered");
    LL|       |}
    LL|       |
    LL|       |fn do_not_add_coverage_2() {
-   LL|       |    #![no_coverage]
+   LL|       |    #![coverage(off)]
    LL|       |    println!("called but not covered");
    LL|       |}
    LL|       |
-   LL|       |#[no_coverage]
+   LL|       |#[coverage(off)]
    LL|       |#[allow(dead_code)]
    LL|       |fn do_not_add_coverage_not_called() {
    LL|       |    println!("not called and not covered");
@@ -33,7 +33,7 @@
    LL|       |// FIXME: These test-cases illustrate confusing results of nested functions.
    LL|       |// See https://github.com/rust-lang/rust/issues/93319
    LL|       |mod nested_fns {
-   LL|       |    #[no_coverage]
+   LL|       |    #[coverage(off)]
    LL|       |    pub fn outer_not_covered(is_true: bool) {
    LL|      1|        fn inner(is_true: bool) {
    LL|      1|            if is_true {
@@ -50,7 +50,7 @@
    LL|      1|        println!("called and covered");
    LL|      1|        inner_not_covered(is_true);
    LL|      1|
-   LL|      1|        #[no_coverage]
+   LL|      1|        #[coverage(off)]
    LL|      1|        fn inner_not_covered(is_true: bool) {
    LL|      1|            if is_true {
    LL|      1|                println!("called but not covered");
diff --git a/tests/run-coverage/no_cov_crate.rs b/tests/run-coverage/no_cov_crate.rs
index 5b748aeefb7..e12e4bc55e3 100644
--- a/tests/run-coverage/no_cov_crate.rs
+++ b/tests/run-coverage/no_cov_crate.rs
@@ -1,17 +1,17 @@
-// Enables `no_coverage` on the entire crate
-#![feature(no_coverage)]
+// Enables `coverage(off)` on the entire crate
+#![feature(coverage_attribute)]
 
-#[no_coverage]
+#[coverage(off)]
 fn do_not_add_coverage_1() {
     println!("called but not covered");
 }
 
 fn do_not_add_coverage_2() {
-    #![no_coverage]
+    #![coverage(off)]
     println!("called but not covered");
 }
 
-#[no_coverage]
+#[coverage(off)]
 #[allow(dead_code)]
 fn do_not_add_coverage_not_called() {
     println!("not called and not covered");
@@ -33,7 +33,7 @@ fn add_coverage_not_called() {
 // FIXME: These test-cases illustrate confusing results of nested functions.
 // See https://github.com/rust-lang/rust/issues/93319
 mod nested_fns {
-    #[no_coverage]
+    #[coverage(off)]
     pub fn outer_not_covered(is_true: bool) {
         fn inner(is_true: bool) {
             if is_true {
@@ -50,7 +50,7 @@ mod nested_fns {
         println!("called and covered");
         inner_not_covered(is_true);
 
-        #[no_coverage]
+        #[coverage(off)]
         fn inner_not_covered(is_true: bool) {
             if is_true {
                 println!("called but not covered");