about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-14 01:05:18 +0000
committerbors <bors@rust-lang.org>2023-09-14 01:05:18 +0000
commitc728bf3963433062b91bd84ffcb37d15416b800e (patch)
treef016a2109e7038fa294ed5dcc97d8d905184ce2e /src
parent8142a319ed5c1d1f96e5a1881a6546e463b77c8f (diff)
parent0ca6c38cc22fe516ac5f25f87cff996cfd8932b7 (diff)
Auto merge of #114656 - bossmc:rework-no-coverage-attr, r=oli-obk
Rework `no_coverage` to `coverage(off)`

As discussed at the tail of https://github.com/rust-lang/rust/issues/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="#12345")` or similar.
Diffstat (limited to 'src')
-rw-r--r--src/doc/rustc/src/instrument-coverage.md4
-rw-r--r--src/doc/unstable-book/src/language-features/coverage-attribute.md (renamed from src/doc/unstable-book/src/language-features/no-coverage.md)8
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/attr/builtin.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs10
4 files changed, 12 insertions, 12 deletions
diff --git a/src/doc/rustc/src/instrument-coverage.md b/src/doc/rustc/src/instrument-coverage.md
index 2535cd4f12c..5b766318331 100644
--- a/src/doc/rustc/src/instrument-coverage.md
+++ b/src/doc/rustc/src/instrument-coverage.md
@@ -173,9 +173,9 @@ Some of the more notable options in this example include:
 [`llvm-cov report`]: https://llvm.org/docs/CommandGuide/llvm-cov.html#llvm-cov-report
 [`llvm-cov show`]: https://llvm.org/docs/CommandGuide/llvm-cov.html#llvm-cov-show
 
-> **Note**: Coverage can also be disabled on an individual function by annotating the function with the [`no_coverage` attribute] (which requires the feature flag `#![feature(no_coverage)]`).
+> **Note**: Coverage can also be disabled on an individual function by annotating the function with the [`coverage(off)` attribute] (which requires the feature flag `#![feature(coverage)]`).
 
-[`no_coverage` attribute]: ../unstable-book/language-features/no-coverage.html
+[`coverage` attribute]: ../unstable-book/language-features/coverage.html
 
 ## Interpreting reports
 
diff --git a/src/doc/unstable-book/src/language-features/no-coverage.md b/src/doc/unstable-book/src/language-features/coverage-attribute.md
index 327cdb39791..0a9bd07de07 100644
--- a/src/doc/unstable-book/src/language-features/no-coverage.md
+++ b/src/doc/unstable-book/src/language-features/coverage-attribute.md
@@ -1,4 +1,4 @@
-# `no_coverage`
+# `coverage_attribute`
 
 The tracking issue for this feature is: [#84605]
 
@@ -6,7 +6,7 @@ The tracking issue for this feature is: [#84605]
 
 ---
 
-The `no_coverage` attribute can be used to selectively disable coverage
+The `coverage` attribute can be used to selectively disable coverage
 instrumentation in an annotated function. This might be useful to:
 
 -   Avoid instrumentation overhead in a performance critical function
@@ -16,14 +16,14 @@ instrumentation in an annotated function. This might be useful to:
 ## Example
 
 ```rust
-#![feature(no_coverage)]
+#![feature(coverage_attribute)]
 
 // `foo()` will get coverage instrumentation (by default)
 fn foo() {
   // ...
 }
 
-#[no_coverage]
+#[coverage(off)]
 fn bar() {
   // ...
 }
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/attr/builtin.rs b/src/tools/rust-analyzer/crates/hir-def/src/attr/builtin.rs
index cead64a3374..9bd0c30b105 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/attr/builtin.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/attr/builtin.rs
@@ -239,7 +239,7 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
         template!(List: "address, kcfi, memory, thread"), DuplicatesOk,
         experimental!(no_sanitize)
     ),
-    gated!(no_coverage, Normal, template!(Word), WarnFollowing, experimental!(no_coverage)),
+    gated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing, experimental!(coverage)),
 
     ungated!(
         doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
index 49b37024a5e..57563a17483 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
@@ -3505,8 +3505,8 @@ This serves two purposes:
 "##,
     },
     Lint {
-        label: "no_coverage",
-        description: r##"# `no_coverage`
+        label: "coverage",
+        description: r##"# `coverage`
 
 The tracking issue for this feature is: [#84605]
 
@@ -3514,7 +3514,7 @@ The tracking issue for this feature is: [#84605]
 
 ---
 
-The `no_coverage` attribute can be used to selectively disable coverage
+The `coverage` attribute can be used to selectively disable coverage
 instrumentation in an annotated function. This might be useful to:
 
 -   Avoid instrumentation overhead in a performance critical function
@@ -3524,14 +3524,14 @@ instrumentation in an annotated function. This might be useful to:
 ## Example
 
 ```rust
-#![feature(no_coverage)]
+#![feature(coverage)]
 
 // `foo()` will get coverage instrumentation (by default)
 fn foo() {
   // ...
 }
 
-#[no_coverage]
+#[coverage(off)]
 fn bar() {
   // ...
 }