about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-03-11 21:29:15 +0000
committerMichael Goulet <michael@errs.io>2023-03-11 21:29:28 +0000
commitc3159b851a90d3071a97cfb84416f09058c1733a (patch)
tree45c42cac47f42cd636ffb88d5e4960da4fcc4149 /tests
parentbd4355500a53ba2b3d82d754d1d669710d4b442c (diff)
downloadrust-c3159b851a90d3071a97cfb84416f09058c1733a.tar.gz
rust-c3159b851a90d3071a97cfb84416f09058c1733a.zip
Gate const closures even when they appear in macros
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/rfc-2632-const-trait-impl/gate.rs8
-rw-r--r--tests/ui/rfc-2632-const-trait-impl/gate.stderr15
2 files changed, 20 insertions, 3 deletions
diff --git a/tests/ui/rfc-2632-const-trait-impl/gate.rs b/tests/ui/rfc-2632-const-trait-impl/gate.rs
index f2cd26c91b6..d1c93ab9f95 100644
--- a/tests/ui/rfc-2632-const-trait-impl/gate.rs
+++ b/tests/ui/rfc-2632-const-trait-impl/gate.rs
@@ -1,5 +1,13 @@
 // gate-test-const_closures
+
 fn main() {
     (const || {})();
     //~^ ERROR: const closures are experimental
 }
+
+macro_rules! e {
+    ($e:expr) => {}
+}
+
+e!((const || {}));
+//~^ ERROR const closures are experimental
diff --git a/tests/ui/rfc-2632-const-trait-impl/gate.stderr b/tests/ui/rfc-2632-const-trait-impl/gate.stderr
index 30edc4127e1..11cc2cd569a 100644
--- a/tests/ui/rfc-2632-const-trait-impl/gate.stderr
+++ b/tests/ui/rfc-2632-const-trait-impl/gate.stderr
@@ -1,12 +1,21 @@
 error[E0658]: const closures are experimental
-  --> $DIR/gate.rs:3:6
+  --> $DIR/gate.rs:4:6
    |
 LL |     (const || {})();
-   |      ^^^^^^^^^^^
+   |      ^^^^^
    |
    = note: see issue #106003 <https://github.com/rust-lang/rust/issues/106003> for more information
    = help: add `#![feature(const_closures)]` to the crate attributes to enable
 
-error: aborting due to previous error
+error[E0658]: const closures are experimental
+  --> $DIR/gate.rs:12:5
+   |
+LL | e!((const || {}));
+   |     ^^^^^
+   |
+   = note: see issue #106003 <https://github.com/rust-lang/rust/issues/106003> for more information
+   = help: add `#![feature(const_closures)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.