]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/trait-object-trait-parens.rs
Account for ADT bodies and struct expressions
[rust.git] / src / test / ui / parser / trait-object-trait-parens.rs
1 trait Trait<'a> {}
2
3 trait Obj {}
4
5 fn f<T: (Copy) + (?Sized) + (for<'a> Trait<'a>)>() {}
6
7 fn main() {
8     let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
9     //~^ ERROR `?Trait` is not permitted in trait object types
10     //~| ERROR only auto traits can be used as additional traits
11     //~| WARN trait objects without an explicit `dyn` are deprecated
12     //~| WARN this is accepted in the current edition
13     let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
14     //~^ ERROR `?Trait` is not permitted in trait object types
15     //~| ERROR only auto traits can be used as additional traits
16     //~| WARN trait objects without an explicit `dyn` are deprecated
17     //~| WARN this is accepted in the current edition
18     let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
19     //~^ ERROR `?Trait` is not permitted in trait object types
20     //~| ERROR only auto traits can be used as additional traits
21     //~| WARN trait objects without an explicit `dyn` are deprecated
22     //~| WARN this is accepted in the current edition
23 }