about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2022-04-26 19:49:00 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2022-04-30 18:10:01 -0700
commitb317ec1697fa3d8d095ea99b7180ae6eab9f77af (patch)
tree88c0c7a9aa35e39ce516d26615f92851866a6fdc /src
parent9b5766cd24554427c2f5fb283c1f09718804cfd0 (diff)
Feature-gate `do yeet` inside `cfg`s too
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs19
-rw-r--r--src/test/ui/feature-gates/feature-gate-yeet_expr-in-cfg.stderr21
2 files changed, 40 insertions, 0 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs b/src/test/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs
new file mode 100644
index 00000000000..a33bd34508c
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs
@@ -0,0 +1,19 @@
+// compile-flags: --edition 2021
+
+pub fn demo() -> Option<i32> {
+    #[cfg(nope)]
+    {
+        do yeet //~ ERROR `do yeet` expression is experimental
+    }
+
+    Some(1)
+}
+
+#[cfg(nope)]
+pub fn alternative() -> Result<(), String> {
+    do yeet "hello"; //~ ERROR `do yeet` expression is experimental
+}
+
+fn main() {
+    demo();
+}
diff --git a/src/test/ui/feature-gates/feature-gate-yeet_expr-in-cfg.stderr b/src/test/ui/feature-gates/feature-gate-yeet_expr-in-cfg.stderr
new file mode 100644
index 00000000000..f90c379bdaf
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-yeet_expr-in-cfg.stderr
@@ -0,0 +1,21 @@
+error[E0658]: `do yeet` expression is experimental
+  --> $DIR/feature-gate-yeet_expr-in-cfg.rs:6:9
+   |
+LL |         do yeet
+   |         ^^^^^^^
+   |
+   = note: see issue #96373 <https://github.com/rust-lang/rust/issues/96373> for more information
+   = help: add `#![feature(yeet_expr)]` to the crate attributes to enable
+
+error[E0658]: `do yeet` expression is experimental
+  --> $DIR/feature-gate-yeet_expr-in-cfg.rs:14:5
+   |
+LL |     do yeet "hello";
+   |     ^^^^^^^^^^^^^^^
+   |
+   = note: see issue #96373 <https://github.com/rust-lang/rust/issues/96373> for more information
+   = help: add `#![feature(yeet_expr)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.