about summary refs log tree commit diff
path: root/compiler/rustc_feature/src
diff options
context:
space:
mode:
authorRich Kadel <richkadel@google.com>2021-04-26 21:25:30 -0700
committerRich Kadel <richkadel@google.com>2021-04-27 17:12:51 -0700
commit3a5df48021b3d29ca55a712d9677cfe043966c6e (patch)
tree4f006dfe196f125f327eb7d126ebee09cdc702a4 /compiler/rustc_feature/src
parent888d0b4c9691ffcba7cb326a1cd1fc73feb38f57 (diff)
downloadrust-3a5df48021b3d29ca55a712d9677cfe043966c6e.tar.gz
rust-3a5df48021b3d29ca55a712d9677cfe043966c6e.zip
adds feature gating of `no_coverage` at either crate- or function-level
Diffstat (limited to 'compiler/rustc_feature/src')
-rw-r--r--compiler/rustc_feature/src/active.rs4
-rw-r--r--compiler/rustc_feature/src/builtin_attrs.rs8
2 files changed, 11 insertions, 1 deletions
diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs
index 7ae7e0094c6..d5963d34dfa 100644
--- a/compiler/rustc_feature/src/active.rs
+++ b/compiler/rustc_feature/src/active.rs
@@ -649,6 +649,10 @@ declare_features! (
     /// Allows `extern "wasm" fn`
     (active, wasm_abi, "1.53.0", Some(83788), None),
 
+    /// Allows function attribute `#[no_coverage]`, to bypass coverage
+    /// instrumentation of that function.
+    (active, no_coverage, "1.53.0", Some(84605), None),
+
     /// Allows trait bounds in `const fn`.
     (active, const_fn_trait_bound, "1.53.0", Some(57563), None),
 
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index b35072933d9..5474fea9c78 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -264,7 +264,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
 
     // Code generation:
     ungated!(inline, AssumedUsed, template!(Word, List: "always|never")),
-    ungated!(no_coverage, AssumedUsed, template!(Word)),
     ungated!(cold, AssumedUsed, template!(Word)),
     ungated!(no_builtins, AssumedUsed, template!(Word)),
     ungated!(target_feature, AssumedUsed, template!(List: r#"enable = "name""#)),
@@ -274,6 +273,13 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
         template!(List: "address, memory, thread"),
         experimental!(no_sanitize)
     ),
+    ungated!(
+        // Not exclusively gated at the crate level (though crate-level is
+        // supported). The feature can alternatively be enabled on individual
+        // functions.
+        no_coverage, AssumedUsed,
+        template!(Word),
+    ),
 
     // FIXME: #14408 assume docs are used since rustdoc looks at them.
     ungated!(doc, AssumedUsed, template!(List: "hidden|inline|...", NameValueStr: "string")),