2022-09-23 03:00:02 -05:00
|
|
|
// run-rustfix
|
|
|
|
|
|
|
|
pub trait Trait {}
|
|
|
|
|
|
|
|
pub struct Foo;
|
|
|
|
|
|
|
|
impl Trait for Foo {}
|
|
|
|
|
|
|
|
fn foo<'x, P>(
|
|
|
|
_post: P,
|
|
|
|
x: &'x Foo,
|
|
|
|
) -> &'x impl Trait {
|
|
|
|
x
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn bar<'t, T: 't>(
|
2023-10-08 05:06:17 -05:00
|
|
|
//~^ HELP: consider adding an explicit lifetime bound
|
2022-09-23 03:00:02 -05:00
|
|
|
post: T,
|
|
|
|
x: &'t Foo,
|
|
|
|
) -> &'t impl Trait {
|
|
|
|
foo(post, x)
|
|
|
|
//~^ ERROR: the parameter type `T` may not live long enough
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|