2022-12-26 17:43:31 -06:00
//@ run-rustfix
#![ allow(warnings) ]
2023-09-07 20:35:51 -05:00
fn foo < ' a > ( d : impl Sized + ' a , p : & ' a mut ( ) ) -> impl Sized + ' a { //~ NOTE the parameter type `impl Sized` must be valid for the anonymous lifetime defined here...
2022-12-26 17:43:31 -06:00
//~^ HELP consider adding an explicit lifetime bound
( d , p )
//~^ ERROR the parameter type `impl Sized` may not live long enough
//~| NOTE ...so that the type `impl Sized` will meet its required lifetime bounds
}
fn foo1 < ' b > ( d : impl Sized + ' b , p : & ' b mut ( ) ) -> impl Sized + '_ {
2023-09-17 09:32:02 -05:00
//~^ NOTE the parameter type `impl Sized` must be valid for the lifetime `'b` as defined here...
2023-10-08 05:06:17 -05:00
//~| HELP consider adding an explicit lifetime bound
2022-12-26 17:43:31 -06:00
( d , p ) //~ NOTE ...so that the type `impl Sized` will meet its required lifetime bounds
//~^ ERROR the parameter type `impl Sized` may not live long enough
}
2023-09-07 20:35:51 -05:00
fn foo2 < ' b , ' a > ( d : impl Sized + ' a + ' b , p : & ' b mut ( ) ) -> impl Sized + ' b { //~ NOTE the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here...
2022-12-26 17:43:31 -06:00
//~^ HELP consider adding an explicit lifetime bound
( d , p )
//~^ ERROR the parameter type `impl Sized + 'a` may not live long enough
//~| NOTE ...so that the type `impl Sized + 'a` will meet its required lifetime bounds
}
2023-09-07 20:35:51 -05:00
fn bar < ' a , T : Sized + ' a > ( d : T , p : & ' a mut ( ) ) -> impl Sized + ' a { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
2022-12-26 17:43:31 -06:00
//~^ HELP consider adding an explicit lifetime bound
( d , p )
//~^ ERROR the parameter type `T` may not live long enough
//~| NOTE ...so that the type `T` will meet its required lifetime bounds
}
fn bar1 < ' b , T : Sized + ' b > ( d : T , p : & ' b mut ( ) ) -> impl Sized + '_ {
2023-09-17 09:32:02 -05:00
//~^ NOTE the parameter type `T` must be valid for the lifetime `'b` as defined here...
2023-10-08 05:06:17 -05:00
//~| HELP consider adding an explicit lifetime bound
2022-12-26 17:43:31 -06:00
( d , p ) //~ NOTE ...so that the type `T` will meet its required lifetime bounds
//~^ ERROR the parameter type `T` may not live long enough
}
2023-09-07 20:35:51 -05:00
fn bar2 < ' b , ' a , T : Sized + ' a + ' b > ( d : T , p : & ' b mut ( ) ) -> impl Sized + ' b { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
2022-12-26 17:43:31 -06:00
//~^ HELP consider adding an explicit lifetime bound
( d , p )
//~^ ERROR the parameter type `T` may not live long enough
//~| NOTE ...so that the type `T` will meet its required lifetime bounds
}
fn main ( ) { }