Skip to content

Commit f852160

Browse files
committed
Keep existing names of regions in placeholder_error
1 parent 9337d4f commit f852160

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

Diff for: compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ impl NiceRegionError<'me, 'tcx> {
118118
sub_region @ ty::RePlaceholder(_),
119119
sup_region,
120120
)) => self.try_report_trait_placeholder_mismatch(
121-
Some(sup_region),
121+
(!sup_region.has_name()).then_some(sup_region),
122122
cause,
123-
Some(*sub_region),
123+
Some(sub_region),
124124
None,
125125
values,
126126
),
@@ -130,10 +130,10 @@ impl NiceRegionError<'me, 'tcx> {
130130
sub_region,
131131
sup_region @ ty::RePlaceholder(_),
132132
)) => self.try_report_trait_placeholder_mismatch(
133-
Some(sub_region),
133+
(!sub_region.has_name()).then_some(sub_region),
134134
cause,
135135
None,
136-
Some(*sup_region),
136+
Some(sup_region),
137137
values,
138138
),
139139

Diff for: src/test/ui/generator/auto-trait-regions.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ error: implementation of `Foo` is not general enough
44
LL | assert_foo(gen);
55
| ^^^^^^^^^^ implementation of `Foo` is not general enough
66
|
7-
= note: `Foo` would have to be implemented for the type `&'0 OnlyFooIfStaticRef`, for any lifetime `'0`...
8-
= note: ...but `Foo` is actually implemented for the type `&'1 OnlyFooIfStaticRef`, for some specific lifetime `'1`
7+
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
8+
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
99

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

1919
error: implementation of `Foo` is not general enough
2020
--> $DIR/auto-trait-regions.rs:50:5

Diff for: src/test/ui/hrtb/hrtb-just-for-static.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | want_hrtb::<StaticInt>()
55
| ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
66
|
77
= note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`...
8-
= note: ...but it actually implements `Foo<&'1 isize>`, for some specific lifetime `'1`
8+
= note: ...but it actually implements `Foo<&'static isize>`
99

1010
error: implementation of `Foo` is not general enough
1111
--> $DIR/hrtb-just-for-static.rs:30:5

Diff for: src/test/ui/hrtb/hrtb-perfect-forwarding.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | foo_hrtb_bar_not(&mut t);
55
| ^^^^^^^^^^^^^^^^ implementation of `Bar` is not general enough
66
|
77
= note: `T` must implement `Bar<&'0 isize>`, for any lifetime `'0`...
8-
= note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1`
8+
= note: ...but it actually implements `Bar<&'b isize>`
99

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

1919
error: aborting due to 2 previous errors
2020

Diff for: src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ error: implementation of `FnOnce` is not general enough
4747
LL | baz(f);
4848
| ^^^ implementation of `FnOnce` is not general enough
4949
|
50-
= note: `fn(*mut &'2 u32)` must implement `FnOnce<(*mut &'1 u32,)>`, for any lifetime `'1`...
51-
= note: ...but it actually implements `FnOnce<(*mut &'2 u32,)>`, for some specific lifetime `'2`
50+
= note: `fn(*mut &'a u32)` must implement `FnOnce<(*mut &'0 u32,)>`, for any lifetime `'0`...
51+
= note: ...but it actually implements `FnOnce<(*mut &'a u32,)>`
5252

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

8181
error: aborting due to 7 previous errors
8282

Diff for: src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.nll.stderr

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

3636
error: aborting due to 4 previous errors
3737

Diff for: src/test/ui/where-clauses/where-for-self-2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: implementation of `Bar` is not general enough
44
LL | foo(&X);
55
| ^^^ implementation of `Bar` is not general enough
66
|
7-
= note: `Bar` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
8-
= note: ...but `Bar` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`
7+
= note: `&'0 u32` must implement `Bar`, for any lifetime `'0`...
8+
= note: ...but `Bar` is actually implemented for the type `&'static u32`
99

1010
error: aborting due to previous error
1111

0 commit comments

Comments
 (0)