about summary refs log tree commit diff
path: root/tests/ui/parser/macro/macro-bare-trait-object-maybe-trait-bound.rs
blob: 494e58c1ca5161f7bee3545d9c9ab29252091785 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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() {}