Reproduce sad diagnostic
This commit is contained in:
parent
36cb01deb3
commit
4b323e62ba
2 changed files with 35 additions and 0 deletions
23
src/test/ui/impl-trait/unactionable_diagnostic.rs
Normal file
23
src/test/ui/impl-trait/unactionable_diagnostic.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
trait Trait {}
|
||||
|
||||
struct Foo;
|
||||
|
||||
impl Trait for Foo {}
|
||||
|
||||
fn foo<'t, P>(
|
||||
post: P,
|
||||
x: &'t Foo,
|
||||
) -> &'t impl Trait {
|
||||
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
|
||||
//~| HELP: consider adding an explicit lifetime bound `foo<T>::{opaque#0}: 't`
|
||||
}
|
||||
|
||||
fn main() {}
|
12
src/test/ui/impl-trait/unactionable_diagnostic.stderr
Normal file
12
src/test/ui/impl-trait/unactionable_diagnostic.stderr
Normal file
|
@ -0,0 +1,12 @@
|
|||
error[E0309]: the opaque type `foo<T>::{opaque#0}` may not live long enough
|
||||
--> $DIR/unactionable_diagnostic.rs:18:5
|
||||
|
|
||||
LL | foo(post, x)
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `foo<T>::{opaque#0}: 't`...
|
||||
= note: ...so that the type `impl Trait` will meet its required lifetime bounds
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0309`.
|
Loading…
Add table
Reference in a new issue