rust/tests/ui/impl-trait/unactionable_diagnostic.rs

26 lines
380 B
Rust
Raw Normal View History

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