about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2025-04-04 09:38:04 +0200
committerMara Bos <m-ou.se@m-ou.se>2025-04-04 09:44:22 +0200
commitb9babad9277fbf0b6209a3075e01f7b2dd043bf4 (patch)
tree087506e296c39030712a3eb06caad95d8d909e58
parent3e6cc7689d467fce677faed22672b592363b0f5f (diff)
downloadrust-b9babad9277fbf0b6209a3075e01f7b2dd043bf4.tar.gz
rust-b9babad9277fbf0b6209a3075e01f7b2dd043bf4.zip
Add feature gate test for cfg'd out super let.
-rw-r--r--tests/ui/feature-gates/feature-gate-super-let.rs7
-rw-r--r--tests/ui/feature-gates/feature-gate-super-let.stderr12
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/ui/feature-gates/feature-gate-super-let.rs b/tests/ui/feature-gates/feature-gate-super-let.rs
index cfe92a42669..7be08003913 100644
--- a/tests/ui/feature-gates/feature-gate-super-let.rs
+++ b/tests/ui/feature-gates/feature-gate-super-let.rs
@@ -2,3 +2,10 @@ fn main() {
     super let a = 1;
     //~^ ERROR `super let` is experimental
 }
+
+// Check that it also isn't accepted in cfg'd out code.
+#[cfg(any())]
+fn a() {
+    super let a = 1;
+    //~^ ERROR `super let` is experimental
+}
diff --git a/tests/ui/feature-gates/feature-gate-super-let.stderr b/tests/ui/feature-gates/feature-gate-super-let.stderr
index a64e1b374f9..4d088594f6d 100644
--- a/tests/ui/feature-gates/feature-gate-super-let.stderr
+++ b/tests/ui/feature-gates/feature-gate-super-let.stderr
@@ -8,6 +8,16 @@ LL |     super let a = 1;
    = help: add `#![feature(super_let)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error: aborting due to 1 previous error
+error[E0658]: `super let` is experimental
+  --> $DIR/feature-gate-super-let.rs:9:5
+   |
+LL |     super let a = 1;
+   |     ^^^^^
+   |
+   = note: see issue #139076 <https://github.com/rust-lang/rust/issues/139076> for more information
+   = help: add `#![feature(super_let)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.