diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-09-06 10:16:26 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-09-21 13:15:24 +0000 |
| commit | 86f1ca812b8704beb20459bd5723d0cc3a0ace62 (patch) | |
| tree | 700ba41dd0144e391f0142341e6bf82d4cedebf9 /src/test/ui/impl-trait | |
| parent | 4b323e62ba785812fbb5d6b77f2564a59dce2171 (diff) | |
Improve diagnostic for adding more bounds to opaque types
Diffstat (limited to 'src/test/ui/impl-trait')
| -rw-r--r-- | src/test/ui/impl-trait/unactionable_diagnostic.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/unactionable_diagnostic.stderr | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/test/ui/impl-trait/unactionable_diagnostic.rs b/src/test/ui/impl-trait/unactionable_diagnostic.rs index de482e0370c..9b82332f9b0 100644 --- a/src/test/ui/impl-trait/unactionable_diagnostic.rs +++ b/src/test/ui/impl-trait/unactionable_diagnostic.rs @@ -8,6 +8,7 @@ fn foo<'t, P>( post: P, x: &'t Foo, ) -> &'t impl Trait { + //~^ HELP: consider adding an explicit lifetime bound... x } @@ -17,7 +18,6 @@ fn bar<'t, T>( ) -> &'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() {} diff --git a/src/test/ui/impl-trait/unactionable_diagnostic.stderr b/src/test/ui/impl-trait/unactionable_diagnostic.stderr index fe6fef5815d..a36e89f58b9 100644 --- a/src/test/ui/impl-trait/unactionable_diagnostic.stderr +++ b/src/test/ui/impl-trait/unactionable_diagnostic.stderr @@ -1,11 +1,13 @@ error[E0309]: the opaque type `foo<T>::{opaque#0}` may not live long enough - --> $DIR/unactionable_diagnostic.rs:18:5 + --> $DIR/unactionable_diagnostic.rs:19: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 +help: consider adding an explicit lifetime bound... + | +LL | ) -> &'t impl Trait + 't { + | ++++ error: aborting due to previous error |
