diff options
| author | Michael Goulet <michael@errs.io> | 2024-03-07 15:44:07 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-03-08 19:08:13 +0000 |
| commit | ffd30e0a6939d7d25c4ac28bfac4b4e367adcd59 (patch) | |
| tree | 079aa5d6de0958fa94d642c53a3c8077baf65153 /tests/ui/error-codes | |
| parent | 74acabe9b042ea8c42862ee29aca2a8b7d333644 (diff) | |
| download | rust-ffd30e0a6939d7d25c4ac28bfac4b4e367adcd59.tar.gz rust-ffd30e0a6939d7d25c4ac28bfac4b4e367adcd59.zip | |
Improve error message for opaque captures
Diffstat (limited to 'tests/ui/error-codes')
| -rw-r--r-- | tests/ui/error-codes/E0657.rs | 4 | ||||
| -rw-r--r-- | tests/ui/error-codes/E0657.stderr | 16 |
2 files changed, 16 insertions, 4 deletions
diff --git a/tests/ui/error-codes/E0657.rs b/tests/ui/error-codes/E0657.rs index cb11de13f73..212c1d9e581 100644 --- a/tests/ui/error-codes/E0657.rs +++ b/tests/ui/error-codes/E0657.rs @@ -8,7 +8,7 @@ impl<T> Id<T> for T {} fn free_fn_capture_hrtb_in_impl_trait() -> Box<for<'a> Id<impl Lt<'a>>> - //~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level [E0657] + //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type { Box::new(()) } @@ -17,7 +17,7 @@ struct Foo; impl Foo { fn impl_fn_capture_hrtb_in_impl_trait() -> Box<for<'a> Id<impl Lt<'a>>> - //~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level + //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type { Box::new(()) } diff --git a/tests/ui/error-codes/E0657.stderr b/tests/ui/error-codes/E0657.stderr index df76b45a589..c539007cdcf 100644 --- a/tests/ui/error-codes/E0657.stderr +++ b/tests/ui/error-codes/E0657.stderr @@ -1,14 +1,26 @@ -error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level +error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from `dyn` type --> $DIR/E0657.rs:10:31 | LL | -> Box<for<'a> Id<impl Lt<'a>>> | ^^ + | +note: lifetime declared here + --> $DIR/E0657.rs:10:16 + | +LL | -> Box<for<'a> Id<impl Lt<'a>>> + | ^^ -error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level +error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from `dyn` type --> $DIR/E0657.rs:19:35 | LL | -> Box<for<'a> Id<impl Lt<'a>>> | ^^ + | +note: lifetime declared here + --> $DIR/E0657.rs:19:20 + | +LL | -> Box<for<'a> Id<impl Lt<'a>>> + | ^^ error: aborting due to 2 previous errors |
