diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-07-26 14:27:00 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-26 14:27:00 +0530 |
| commit | ad32667bc8bb6ca96e3591ccc1f4daef4bf67028 (patch) | |
| tree | 32feb61883acec33947a50f21536b8c399a243ec /src | |
| parent | 962da8bdcef3c200d6e27550fc83145204cf30ac (diff) | |
| parent | d3492ca85205182e30e9baf06e9b1db08e501f56 (diff) | |
| download | rust-ad32667bc8bb6ca96e3591ccc1f4daef4bf67028.tar.gz rust-ad32667bc8bb6ca96e3591ccc1f4daef4bf67028.zip | |
Rollup merge of #99748 - compiler-errors:better-impl-trait-printing, r=fee1-dead
Use full type name instead of just saying `impl Trait` in "captures lifetime" error I think this is very useful, especially when there's >1 `impl Trait`, and it just means passing around a bit more info that we already have access to.
Diffstat (limited to 'src')
18 files changed, 24 insertions, 24 deletions
diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr index cdb141c0e3e..3128b4df4e2 100644 --- a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr +++ b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr @@ -13,7 +13,7 @@ LL | | } | = help: consider adding the following bound: `'a: 'b` -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Trait<'a>` captures lifetime that does not appear in bounds --> $DIR/ret-impl-trait-one.rs:16:80 | LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> { diff --git a/src/test/ui/impl-trait/hidden-lifetimes.stderr b/src/test/ui/impl-trait/hidden-lifetimes.stderr index 97652f5462e..efc228de58b 100644 --- a/src/test/ui/impl-trait/hidden-lifetimes.stderr +++ b/src/test/ui/impl-trait/hidden-lifetimes.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Swap` captures lifetime that does not appear in bounds --> $DIR/hidden-lifetimes.rs:29:5 | LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a { @@ -11,7 +11,7 @@ help: to declare that the `impl Trait` captures `'b`, you can add an explicit `' LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a + 'b { | ++++ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Swap` captures lifetime that does not appear in bounds --> $DIR/hidden-lifetimes.rs:46:5 | LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a { diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.rs b/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.rs index f5aaf118521..2a2be6b7429 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.rs @@ -20,7 +20,7 @@ fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { let _: &'b i32 = *u.0; } u.0 - //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds + //~^ ERROR hidden type for `E<'b, 'c>` captures lifetime that does not appear in bounds } fn main() {} diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr b/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr index b837b641103..90875708094 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `E<'b, 'c>` captures lifetime that does not appear in bounds --> $DIR/error-handling-2.rs:22:5 | LL | fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.rs b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.rs index 47e05bce0f8..c6eea5323fd 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.rs @@ -26,7 +26,7 @@ where // 'a in ['d, 'e] // ``` if condition() { a } else { b } - //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds + //~^ ERROR hidden type for `impl Trait<'d, 'e>` captures lifetime that does not appear in bounds } fn condition() -> bool { diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr index 15476c706a7..cb1dc0b7d50 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Trait<'d, 'e>` captures lifetime that does not appear in bounds --> $DIR/ordinary-bounds-unrelated.rs:28:33 | LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e> diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.rs b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.rs index 321cb8c92a1..adcbca2a438 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.rs @@ -29,7 +29,7 @@ fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b> // // We are forced to pick that '0 = 'e, because only 'e is outlived by *both* 'a and 'b. if condition() { a } else { b } - //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds + //~^ ERROR hidden type for `impl Trait<'a, 'b>` captures lifetime that does not appear in bounds } fn condition() -> bool { diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr index 7315aa8e9d4..4388e6601a6 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Trait<'a, 'b>` captures lifetime that does not appear in bounds --> $DIR/ordinary-bounds-unsuited.rs:31:33 | LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b> diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr index 586563c3906..16767abd722 100644 --- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr +++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Copy` captures lifetime that does not appear in bounds --> $DIR/must_outlive_least_region_or_bound.rs:3:35 | LL | fn elided(x: &i32) -> impl Copy { x } @@ -11,7 +11,7 @@ help: to declare that the `impl Trait` captures `'_`, you can add an explicit `' LL | fn elided(x: &i32) -> impl Copy + '_ { x } | ++++ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Copy` captures lifetime that does not appear in bounds --> $DIR/must_outlive_least_region_or_bound.rs:6:44 | LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } @@ -96,7 +96,7 @@ help: alternatively, add an explicit `'static` bound to this reference LL | fn with_bound<'a>(x: &'static i32) -> impl LifetimeTrait<'a> + 'static { x } | ~~~~~~~~~~~~ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Fn(&'a u32)` captures lifetime that does not appear in bounds --> $DIR/must_outlive_least_region_or_bound.rs:38:5 | LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { diff --git a/src/test/ui/impl-trait/region-escape-via-bound.rs b/src/test/ui/impl-trait/region-escape-via-bound.rs index a04cb1702b6..fe60c76ca17 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound.rs @@ -15,7 +15,7 @@ fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> where 'x: 'y { x - //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds [E0700] + //~^ ERROR hidden type for `impl Trait<'y>` captures lifetime that does not appear in bounds [E0700] } fn main() { } diff --git a/src/test/ui/impl-trait/region-escape-via-bound.stderr b/src/test/ui/impl-trait/region-escape-via-bound.stderr index bc02f7694d7..fdb2fe022b4 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.stderr +++ b/src/test/ui/impl-trait/region-escape-via-bound.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Trait<'y>` captures lifetime that does not appear in bounds --> $DIR/region-escape-via-bound.rs:17:5 | LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.stderr index 951abb127c1..b8681523155 100644 --- a/src/test/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/src/test/ui/impl-trait/static-return-lifetime-infered.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that does not appear in bounds --> $DIR/static-return-lifetime-infered.rs:7:9 | LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> { @@ -11,7 +11,7 @@ help: to declare that the `impl Trait` captures `'_`, you can add an explicit `' LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ { | ++++ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that does not appear in bounds --> $DIR/static-return-lifetime-infered.rs:7:9 | LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> { @@ -24,7 +24,7 @@ help: to declare that the `impl Trait` captures `'_`, you can add an explicit `' LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ { | ++++ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that does not appear in bounds --> $DIR/static-return-lifetime-infered.rs:12:9 | LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> { @@ -37,7 +37,7 @@ help: to declare that the `impl Trait` captures `'a`, you can add an explicit `' LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a { | ++++ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that does not appear in bounds --> $DIR/static-return-lifetime-infered.rs:12:9 | LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> { diff --git a/src/test/ui/nll/issue-73159-rpit-static.stderr b/src/test/ui/nll/issue-73159-rpit-static.stderr index ab0dfe5fca4..260b9b59772 100644 --- a/src/test/ui/nll/issue-73159-rpit-static.stderr +++ b/src/test/ui/nll/issue-73159-rpit-static.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Iterator<Item = u8>` captures lifetime that does not appear in bounds --> $DIR/issue-73159-rpit-static.rs:8:9 | LL | impl<'a> Foo<'a> { diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr index 06256ebbc29..330c6fafa2d 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `Opaque(DefId(0:11 ~ impl_trait_captures[1afc]::foo::{opaque#0}), [ReStatic, T, ReEarlyBound(0, 'a)])` captures lifetime that does not appear in bounds --> $DIR/impl-trait-captures.rs:11:5 | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr index 5b8b9bb68ad..7e7d60d0ff9 100644 --- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr +++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Clone` captures lifetime that does not appear in bounds --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait-async.rs:8:48 | LL | async fn f(self: Pin<&Self>) -> impl Clone { self } diff --git a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr index abdc650c68e..30d2250c0c8 100644 --- a/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr +++ b/src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr @@ -1,4 +1,4 @@ -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Clone` captures lifetime that does not appear in bounds --> $DIR/arbitrary_self_types_pin_lifetime_impl_trait.rs:6:44 | LL | fn f(self: Pin<&Self>) -> impl Clone { self } diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs index 19a791a8c43..b641f5941dc 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs @@ -17,7 +17,7 @@ where G: Get<T>, { move || { - //~^ ERROR hidden type for `impl Trait` captures lifetime + //~^ ERROR hidden type for `impl FnOnce()` captures lifetime *dest = g.get(); } } diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index e3fe25d5f9c..0d749f04bea 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -6,7 +6,7 @@ LL | fn baz<G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ | | | help: consider introducing lifetime `'a` here: `'a,` -error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not appear in bounds --> $DIR/missing-lifetimes-in-signature.rs:19:5 | LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() |
