2022-09-01 15:41:13 +00:00
|
|
|
trait Trait {}
|
|
|
|
|
|
|
|
struct Foo;
|
|
|
|
|
|
|
|
impl Trait for Foo {}
|
|
|
|
|
2022-09-23 07:10:11 +00:00
|
|
|
fn foo<'x, P>(
|
2022-09-01 15:41:13 +00:00
|
|
|
post: P,
|
2022-09-23 07:10:11 +00:00
|
|
|
x: &'x Foo,
|
|
|
|
) -> &'x impl Trait {
|
2022-09-06 10:16:26 +00:00
|
|
|
//~^ HELP: consider adding an explicit lifetime bound...
|
2022-09-01 15:41:13 +00:00
|
|
|
x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar<'t, T>(
|
|
|
|
post: T,
|
|
|
|
x: &'t Foo,
|
|
|
|
) -> &'t impl Trait {
|
|
|
|
foo(post, x)
|
|
|
|
//~^ ERROR: the opaque type `foo<T>::{opaque#0}` may not live long enough
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|