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