]> git.lizzy.rs Git - rust.git/blob - tests/ui/impl-trait/unactionable_diagnostic.fixed
Fix #106496, suggest remove deref for type mismatch
[rust.git] / tests / ui / impl-trait / unactionable_diagnostic.fixed
1 // run-rustfix
2
3 pub trait Trait {}
4
5 pub struct Foo;
6
7 impl Trait for Foo {}
8
9 fn foo<'x, P>(
10     _post: P,
11     x: &'x Foo,
12 ) -> &'x impl Trait {
13     x
14 }
15
16 pub fn bar<'t, T: 't>(
17     //~^ HELP: consider adding an explicit lifetime bound...
18     post: T,
19     x: &'t Foo,
20 ) -> &'t impl Trait {
21     foo(post, x)
22     //~^ ERROR: the parameter type `T` may not live long enough
23 }
24
25 fn main() {}