say "the lifetime" instead of "some lifetime" when it feels right
In particular, when we want to indicate that there is a connection between the self type and the other types.
This commit is contained in:
parent
7bc3f5585a
commit
a24e04dff6
@ -95,7 +95,7 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
|
||||
ty::RePlaceholder(_),
|
||||
)) => {
|
||||
// I actually can't see why this would be the case ever.
|
||||
},
|
||||
}
|
||||
|
||||
Some(RegionResolutionError::ConcreteFailure(
|
||||
SubregionOrigin::Subtype(TypeTrace {
|
||||
@ -219,6 +219,10 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
|
||||
}
|
||||
});
|
||||
|
||||
let self_ty_has_vid = self
|
||||
.tcx
|
||||
.any_free_region_meets(&actual_trait_ref.self_ty(), |r| Some(r) == vid);
|
||||
|
||||
RegionHighlightMode::maybe_highlighting_region(sub_placeholder, has_sub, || {
|
||||
RegionHighlightMode::maybe_highlighting_region(sup_placeholder, has_sup, || {
|
||||
match (has_sub, has_sup) {
|
||||
@ -254,12 +258,21 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
|
||||
|
||||
RegionHighlightMode::maybe_highlighting_region(vid, has_vid, || match has_vid {
|
||||
Some(n) => {
|
||||
err.note(&format!(
|
||||
"but `{}` only implements `{}` for some lifetime `'{}`",
|
||||
actual_trait_ref.self_ty(),
|
||||
actual_trait_ref,
|
||||
n
|
||||
));
|
||||
if self_ty_has_vid {
|
||||
err.note(&format!(
|
||||
"but `{}` only implements `{}` for the lifetime `'{}`",
|
||||
actual_trait_ref.self_ty(),
|
||||
actual_trait_ref,
|
||||
n
|
||||
));
|
||||
} else {
|
||||
err.note(&format!(
|
||||
"but `{}` only implements `{}` for some lifetime `'{}`",
|
||||
actual_trait_ref.self_ty(),
|
||||
actual_trait_ref,
|
||||
n
|
||||
));
|
||||
}
|
||||
}
|
||||
None => {
|
||||
err.note(&format!(
|
||||
|
@ -5,7 +5,7 @@ LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo` for any lifetime `'0`
|
||||
= note: but `&'1 OnlyFooIfStaticRef` only implements `Foo` for some lifetime `'1`
|
||||
= note: but `&'1 OnlyFooIfStaticRef` only implements `Foo` for the lifetime `'1`
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:48:5
|
||||
@ -14,7 +14,7 @@ LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `A<'0, '1>` must implement `Foo` for any two lifetimes `'0` and `'1`
|
||||
= note: but `A<'_, '2>` only implements `Foo` for some lifetime `'2`
|
||||
= note: but `A<'_, '2>` only implements `Foo` for the lifetime `'2`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -16,7 +16,7 @@ LL | want_hrtb::<&'a u32>() //~ ERROR
|
||||
|
|
||||
= note: Due to a where-clause on `want_hrtb`,
|
||||
= note: `&'a u32` must implement `Foo<&'0 isize>` for any lifetime `'0`
|
||||
= note: but `&'1 u32` only implements `Foo<&'1 isize>` for some lifetime `'1`
|
||||
= note: but `&'1 u32` only implements `Foo<&'1 isize>` for the lifetime `'1`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | <u32 as RefFoo<u32>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `&'0 u32` must implement `Foo<'static, u32>` for any lifetime `'0`
|
||||
= note: but `&'1 _` only implements `Foo<'_, _>` for some lifetime `'1`
|
||||
= note: but `&'1 _` only implements `Foo<'_, _>` for the lifetime `'1`
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/issue-54302-cases.rs:69:5
|
||||
@ -14,7 +14,7 @@ LL | <i32 as RefFoo<i32>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `&'0 i32` must implement `Foo<'static, i32>` for any lifetime `'0`
|
||||
= note: but `&'1 _` only implements `Foo<'_, _>` for some lifetime `'1`
|
||||
= note: but `&'1 _` only implements `Foo<'_, _>` for the lifetime `'1`
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/issue-54302-cases.rs:75:5
|
||||
@ -23,7 +23,7 @@ LL | <u64 as RefFoo<u64>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `&'0 u64` must implement `Foo<'static, u64>` for any lifetime `'0`
|
||||
= note: but `&'1 _` only implements `Foo<'_, _>` for some lifetime `'1`
|
||||
= note: but `&'1 _` only implements `Foo<'_, _>` for the lifetime `'1`
|
||||
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/issue-54302-cases.rs:81:5
|
||||
@ -32,7 +32,7 @@ LL | <i64 as RefFoo<i64>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `&'0 i64` must implement `Foo<'static, i64>` for any lifetime `'0`
|
||||
= note: but `&'1 _` only implements `Foo<'_, _>` for some lifetime `'1`
|
||||
= note: but `&'1 _` only implements `Foo<'_, _>` for the lifetime `'1`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -6,7 +6,7 @@ LL | foo(&X); //~ ERROR implementation of `Bar` is not general enough
|
||||
|
|
||||
= note: Due to a where-clause on `foo`,
|
||||
= note: `&'0 _` must implement `Bar` for any lifetime `'0`
|
||||
= note: but `&'1 u32` only implements `Bar` for some lifetime `'1`
|
||||
= note: but `&'1 u32` only implements `Bar` for the lifetime `'1`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user