rust/tests/ui/parser/trait-object-trait-parens.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
1020 B
Rust
Raw Normal View History

trait Trait<'a> {}
trait Obj {}
fn f<T: (Copy) + (?Sized) + (for<'a> Trait<'a>)>() {}
fn main() {
let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
//~^ ERROR `?Trait` is not permitted in trait object types
//~| ERROR only auto traits can be used as additional traits
//~| WARN trait objects without an explicit `dyn` are deprecated
2021-06-16 07:27:44 -05:00
//~| WARN this is accepted in the current edition
2021-04-16 04:06:51 -05:00
let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
//~^ ERROR `?Trait` is not permitted in trait object types
//~| ERROR only auto traits can be used as additional traits
//~| WARN trait objects without an explicit `dyn` are deprecated
2021-06-16 07:27:44 -05:00
//~| WARN this is accepted in the current edition
2021-04-16 04:06:51 -05:00
let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
//~^ ERROR `?Trait` is not permitted in trait object types
//~| ERROR only auto traits can be used as additional traits
//~| WARN trait objects without an explicit `dyn` are deprecated
2021-06-16 07:27:44 -05:00
//~| WARN this is accepted in the current edition
}