about summary refs log tree commit diff
path: root/tests/ui/parser/macro
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2023-12-18 17:55:55 +0100
committerLeón Orell Valerian Liehr <me@fmease.dev>2023-12-27 12:51:32 +0100
commit3eb48a35c8ae8335da66dc2bdb4f60e6ae22e1dd (patch)
treeeadb378f48629728c106252798e74f8faf1bf745 /tests/ui/parser/macro
parent2fe50cd72c476ebacdedb14893e9632b4de961c2 (diff)
downloadrust-3eb48a35c8ae8335da66dc2bdb4f60e6ae22e1dd.tar.gz
rust-3eb48a35c8ae8335da66dc2bdb4f60e6ae22e1dd.zip
Introduce `const Trait` (always-const trait bounds)
Diffstat (limited to 'tests/ui/parser/macro')
-rw-r--r--tests/ui/parser/macro/mbe-bare-trait-object-maybe-trait-bound.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/parser/macro/mbe-bare-trait-object-maybe-trait-bound.rs b/tests/ui/parser/macro/mbe-bare-trait-object-maybe-trait-bound.rs
new file mode 100644
index 00000000000..fe062d62e5a
--- /dev/null
+++ b/tests/ui/parser/macro/mbe-bare-trait-object-maybe-trait-bound.rs
@@ -0,0 +1,16 @@
+// Check that `?Trait` matches the macro fragment specifier `ty`.
+// Syntactically trait object types can be "bare" (i.e., lack the prefix `dyn`),
+// even in newer editions like Rust 2021.
+// Therefore the arm `?$Trait:path` shouldn't get reached.
+
+// edition: 2021
+// check-pass
+
+macro_rules! check {
+    ($Ty:ty) => {};
+    (?$Trait:path) => { compile_error!("non-ty"); };
+}
+
+check! { ?Trait }
+
+fn main() {}