Skip to content

Commit

Permalink
Keep existing names of regions in placeholder_error
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Feb 10, 2021
1 parent 9337d4f commit f852160
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ impl NiceRegionError<'me, 'tcx> {
sub_region @ ty::RePlaceholder(_),
sup_region,
)) => self.try_report_trait_placeholder_mismatch(
Some(sup_region),
(!sup_region.has_name()).then_some(sup_region),
cause,
Some(*sub_region),
Some(sub_region),
None,
values,
),
Expand All @@ -130,10 +130,10 @@ impl NiceRegionError<'me, 'tcx> {
sub_region,
sup_region @ ty::RePlaceholder(_),
)) => self.try_report_trait_placeholder_mismatch(
Some(sub_region),
(!sub_region.has_name()).then_some(sub_region),
cause,
None,
Some(*sup_region),
Some(sup_region),
values,
),

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/generator/auto-trait-regions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ error: implementation of `Foo` is not general enough
LL | assert_foo(gen);
| ^^^^^^^^^^ implementation of `Foo` is not general enough
|
= note: `Foo` would have to be implemented for the type `&'0 OnlyFooIfStaticRef`, for any lifetime `'0`...
= note: ...but `Foo` is actually implemented for the type `&'1 OnlyFooIfStaticRef`, for some specific lifetime `'1`
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`

error: implementation of `Foo` is not general enough
--> $DIR/auto-trait-regions.rs:31:5
|
LL | assert_foo(gen);
| ^^^^^^^^^^ implementation of `Foo` is not general enough
|
= note: `Foo` would have to be implemented for the type `&'0 OnlyFooIfStaticRef`, for any lifetime `'0`...
= note: ...but `Foo` is actually implemented for the type `&'1 OnlyFooIfStaticRef`, for some specific lifetime `'1`
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`

error: implementation of `Foo` is not general enough
--> $DIR/auto-trait-regions.rs:50:5
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hrtb/hrtb-just-for-static.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | want_hrtb::<StaticInt>()
| ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
= note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`...
= note: ...but it actually implements `Foo<&'1 isize>`, for some specific lifetime `'1`
= note: ...but it actually implements `Foo<&'static isize>`

error: implementation of `Foo` is not general enough
--> $DIR/hrtb-just-for-static.rs:30:5
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/hrtb/hrtb-perfect-forwarding.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | foo_hrtb_bar_not(&mut t);
| ^^^^^^^^^^^^^^^^ implementation of `Bar` is not general enough
|
= note: `T` must implement `Bar<&'0 isize>`, for any lifetime `'0`...
= note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1`
= note: ...but it actually implements `Bar<&'b isize>`

error: implementation of `Bar` is not general enough
--> $DIR/hrtb-perfect-forwarding.rs:43:5
Expand All @@ -14,7 +14,7 @@ LL | foo_hrtb_bar_not(&mut t);
| ^^^^^^^^^^^^^^^^ implementation of `Bar` is not general enough
|
= note: `T` must implement `Bar<&'0 isize>`, for any lifetime `'0`...
= note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1`
= note: ...but it actually implements `Bar<&'b isize>`

error: aborting due to 2 previous errors

8 changes: 4 additions & 4 deletions src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ error: implementation of `FnOnce` is not general enough
LL | baz(f);
| ^^^ implementation of `FnOnce` is not general enough
|
= note: `fn(*mut &'2 u32)` must implement `FnOnce<(*mut &'1 u32,)>`, for any lifetime `'1`...
= note: ...but it actually implements `FnOnce<(*mut &'2 u32,)>`, for some specific lifetime `'2`
= note: `fn(*mut &'a u32)` must implement `FnOnce<(*mut &'0 u32,)>`, for any lifetime `'0`...
= note: ...but it actually implements `FnOnce<(*mut &'a u32,)>`

error[E0308]: mismatched types
--> $DIR/closure-arg-type-mismatch.rs:10:5
Expand All @@ -75,8 +75,8 @@ error: implementation of `FnOnce` is not general enough
LL | baz(f);
| ^^^ implementation of `FnOnce` is not general enough
|
= note: `fn(*mut &'2 u32)` must implement `FnOnce<(*mut &'1 u32,)>`, for any lifetime `'1`...
= note: ...but it actually implements `FnOnce<(*mut &'2 u32,)>`, for some specific lifetime `'2`
= note: `fn(*mut &'a u32)` must implement `FnOnce<(*mut &'0 u32,)>`, for any lifetime `'0`...
= note: ...but it actually implements `FnOnce<(*mut &'a u32,)>`

error: aborting due to 7 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ error: implementation of `FnOnce` is not general enough
LL | type Bar = impl Baz<Self, Self>;
| ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
= note: closure with signature `fn(&'2 X) -> &'2 X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
= note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
= note: closure with signature `fn(&'static X) -> &'static X` must implement `FnOnce<(&'0 X,)>`, for any lifetime `'0`...
= note: ...but it actually implements `FnOnce<(&'static X,)>`

error: aborting due to 4 previous errors

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/where-clauses/where-for-self-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ error: implementation of `Bar` is not general enough
LL | foo(&X);
| ^^^ implementation of `Bar` is not general enough
|
= note: `Bar` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
= note: ...but `Bar` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`
= note: `&'0 u32` must implement `Bar`, for any lifetime `'0`...
= note: ...but `Bar` is actually implemented for the type `&'static u32`

error: aborting due to previous error

0 comments on commit f852160

Please sign in to comment.