]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/bound/not-on-struct.rs
Auto merge of #84959 - camsteffen:lint-suggest-group, r=estebank
[rust.git] / src / test / ui / traits / bound / not-on-struct.rs
1 // We don't need those errors. Ideally we would silence them, but to do so we need to move the
2 // lint from being an early-lint during parsing to a late-lint, because it needs to be aware of
3 // the types involved.
4 #![allow(bare_trait_objects)]
5
6 struct Foo;
7
8 fn foo(_x: Box<Foo + Send>) { } //~ ERROR expected trait, found struct `Foo`
9
10 type TypeAlias<T> = Box<dyn Vec<T>>; //~ ERROR expected trait, found struct `Vec`
11
12 struct A;
13 fn a() -> A + 'static { //~ ERROR expected trait, found
14     A
15 }
16 fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) { //~ ERROR expected trait, found
17     panic!()
18 }
19 fn c() -> 'static + A { //~ ERROR expected trait, found
20     A
21 }
22 fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) { //~ ERROR expected trait, found
23     panic!()
24 }
25 fn e() -> 'static + A + 'static { //~ ERROR expected trait, found
26 //~^ ERROR only a single explicit lifetime bound is permitted
27     A
28 }
29 fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) { //~ ERROR expected trait, found
30 //~^ ERROR only a single explicit lifetime bound is permitted
31     panic!()
32 }
33 struct Traitor;
34 trait Trait {}
35 fn g() -> Traitor + 'static { //~ ERROR expected trait, found struct `Traitor`
36     A
37 }
38 fn main() {}