2020-09-22 21:19:33 -05:00
|
|
|
// We don't need those errors. Ideally we would silence them, but to do so we need to move the
|
|
|
|
// lint from being an early-lint during parsing to a late-lint, because it needs to be aware of
|
|
|
|
// the types involved.
|
2018-05-18 17:13:53 -05:00
|
|
|
#![allow(bare_trait_objects)]
|
2014-05-05 20:56:44 -05:00
|
|
|
|
2013-06-19 12:55:30 -05:00
|
|
|
struct Foo;
|
|
|
|
|
2017-01-16 14:33:45 -06:00
|
|
|
fn foo(_x: Box<Foo + Send>) { } //~ ERROR expected trait, found struct `Foo`
|
2013-06-19 12:55:30 -05:00
|
|
|
|
2020-09-22 21:19:33 -05:00
|
|
|
type TypeAlias<T> = Box<dyn Vec<T>>; //~ ERROR expected trait, found struct `Vec`
|
2017-10-10 09:33:19 -05:00
|
|
|
|
2020-09-22 21:19:33 -05:00
|
|
|
struct A;
|
|
|
|
fn a() -> A + 'static { //~ ERROR expected trait, found
|
|
|
|
A
|
|
|
|
}
|
|
|
|
fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) { //~ ERROR expected trait, found
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
fn c() -> 'static + A { //~ ERROR expected trait, found
|
|
|
|
A
|
|
|
|
}
|
|
|
|
fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) { //~ ERROR expected trait, found
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
fn e() -> 'static + A + 'static { //~ ERROR expected trait, found
|
|
|
|
//~^ ERROR only a single explicit lifetime bound is permitted
|
|
|
|
A
|
|
|
|
}
|
|
|
|
fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) { //~ ERROR expected trait, found
|
|
|
|
//~^ ERROR only a single explicit lifetime bound is permitted
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
struct Traitor;
|
|
|
|
trait Trait {}
|
|
|
|
fn g() -> Traitor + 'static { //~ ERROR expected trait, found struct `Traitor`
|
|
|
|
A
|
|
|
|
}
|
|
|
|
fn main() {}
|