about summary refs log tree commit diff
path: root/src/test/ui
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 /src/test/ui
parent888d0b4c9691ffcba7cb326a1cd1fc73feb38f57 (diff)
downloadrust-3a5df48021b3d29ca55a712d9677cfe043966c6e.tar.gz
rust-3a5df48021b3d29ca55a712d9677cfe043966c6e.zip
adds feature gating of `no_coverage` at either crate- or function-level
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/feature-gates/feature-gate-no_coverage.rs8
-rw-r--r--src/test/ui/feature-gates/feature-gate-no_coverage.stderr13
2 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-no_coverage.rs b/src/test/ui/feature-gates/feature-gate-no_coverage.rs
new file mode 100644
index 00000000000..c6b79f9a431
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-no_coverage.rs
@@ -0,0 +1,8 @@
+#![crate_type = "lib"]
+
+#[no_coverage]
+#[feature(no_coverage)] // does not have to be enabled before `#[no_coverage]`
+fn no_coverage_is_enabled_on_this_function() {}
+
+#[no_coverage] //~ ERROR the `#[no_coverage]` attribute is an experimental feature
+fn requires_feature_no_coverage() {}
diff --git a/src/test/ui/feature-gates/feature-gate-no_coverage.stderr b/src/test/ui/feature-gates/feature-gate-no_coverage.stderr
new file mode 100644
index 00000000000..04627be4aaf
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-no_coverage.stderr
@@ -0,0 +1,13 @@
+error[E0658]: the `#[no_coverage]` attribute is an experimental feature
+  --> $DIR/feature-gate-no_coverage.rs:7:1
+   |
+LL | #[no_coverage]
+   | ^^^^^^^^^^^^^^
+   |
+   = note: see issue #84605 <https://github.com/rust-lang/rust/issues/84605> for more information
+   = help: add `#![feature(no_coverage)]` to the crate attributes to enable
+   = help: or, alternatively, add `#[feature(no_coverage)]` to the function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.