1 // revisions: func object clause
4 #![feature(rustc_attrs)]
10 impl<'a> Foo<'a> for() {
14 // Check that appearing in a projection input in the argument is not enough:
16 fn func1(_: for<'a> fn(<() as Foo<'a>>::Item) -> &'a i32) {
17 //[func]~^ ERROR E0581
20 // Check that appearing in a projection input in the return still
23 fn func2(_: for<'a> fn() -> <() as Foo<'a>>::Item) {
24 //[func]~^ ERROR E0581
28 fn object1(_: Box<dyn for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32>) {
29 //[object]~^ ERROR E0582
33 fn object2(_: Box<dyn for<'a> Fn() -> <() as Foo<'a>>::Item>) {
34 //[object]~^ ERROR E0582
38 fn clause1<T>() where T: for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32 {
39 //[clause]~^ ERROR `Output` references lifetime `'a`
43 fn clause2<T>() where T: for<'a> Fn() -> <() as Foo<'a>>::Item {
44 //[clause]~^ ERROR `Output` references lifetime `'a`
48 fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]