about summary refs log tree commit diff
path: root/tests/ui/traits/const-traits/macro-const-trait-bound-theoretical-regression.rs
blob: 3f70ffa7d10e7957f049e11698d30e23f0a1df2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Demonstrates and records a theoretical regressions / breaking changes caused by the
// introduction of `const` and `[const]` trait bounds.

// Setting the edition to >2015 since we didn't regress `demo! { dyn const }` in Rust 2015.
// See also test `traits/const-traits/macro-dyn-const-2015.rs`.
//@ edition:2018

trait Trait {}

macro_rules! demo {
    ($ty:ty) => { compile_error!("ty"); }; // KEEP THIS RULE FIRST AND AS IS!
    //~^ ERROR ty
    //~| ERROR ty
    //~| ERROR ty
    //~| ERROR ty

    // DON'T MODIFY THE MATCHERS BELOW UNLESS THE CONST TRAIT MODIFIER SYNTAX CHANGES!

    (impl $c:ident Trait) => { /* KEEP THIS EMPTY! */ };
    (dyn $c:ident Trait) => { /* KEEP THIS EMPTY! */ };

    (impl [const] Trait) => { /* KEEP THIS EMPTY! */ };
    (dyn [const] Trait) => { /* KEEP THIS EMPTY! */ };
}

demo! { impl const Trait } //~ ERROR const trait impls are experimental
demo! { dyn const Trait } //~ ERROR const trait impls are experimental

demo! { impl [const] Trait } //~ ERROR const trait impls are experimental
demo! { dyn [const] Trait } //~ ERROR const trait impls are experimental

fn main() {}