File tree 3 files changed +42
-2
lines changed
compiler/rustc_infer/src/infer/canonical
tests/ui/nll/user-annotations
3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -230,9 +230,9 @@ impl CanonicalizeMode for CanonicalizeUserTypeAnnotation {
230
230
r : ty:: Region < ' tcx > ,
231
231
) -> ty:: Region < ' tcx > {
232
232
match * r {
233
- ty:: ReEarlyBound ( _) | ty:: ReFree ( _) | ty:: ReErased | ty:: ReStatic => r,
233
+ ty:: ReEarlyBound ( _) | ty:: ReFree ( _) | ty:: ReErased | ty:: ReStatic | ty :: ReError ( _ ) => r,
234
234
ty:: ReVar ( _) => canonicalizer. canonical_var_for_region_in_root_universe ( r) ,
235
- _ => {
235
+ ty :: RePlaceholder ( .. ) | ty :: ReLateBound ( .. ) => {
236
236
// We only expect region names that the user can type.
237
237
bug ! ( "unexpected region in query response: `{:?}`" , r)
238
238
}
Original file line number Diff line number Diff line change
1
+ // Regression test for #109072.
2
+ // Check that we don't ICE when canonicalizing user annotation.
3
+
4
+ trait Lt < ' a > {
5
+ type T ;
6
+ }
7
+
8
+ impl Lt < ' missing > for ( ) { //~ ERROR undeclared lifetime
9
+ type T = & ' missing ( ) ; //~ ERROR undeclared lifetime
10
+ }
11
+
12
+ fn main ( ) {
13
+ let _: <( ) as Lt < ' _ > >:: T = & ( ) ;
14
+ }
Original file line number Diff line number Diff line change
1
+ error[E0261]: use of undeclared lifetime name `'missing`
2
+ --> $DIR/region-error-ice-109072.rs:8:9
3
+ |
4
+ LL | impl Lt<'missing> for () {
5
+ | - ^^^^^^^^ undeclared lifetime
6
+ | |
7
+ | help: consider introducing lifetime `'missing` here: `<'missing>`
8
+
9
+ error[E0261]: use of undeclared lifetime name `'missing`
10
+ --> $DIR/region-error-ice-109072.rs:9:15
11
+ |
12
+ LL | type T = &'missing ();
13
+ | ^^^^^^^^ undeclared lifetime
14
+ |
15
+ help: consider introducing lifetime `'missing` here
16
+ |
17
+ LL | type T<'missing> = &'missing ();
18
+ | ++++++++++
19
+ help: consider introducing lifetime `'missing` here
20
+ |
21
+ LL | impl<'missing> Lt<'missing> for () {
22
+ | ++++++++++
23
+
24
+ error: aborting due to 2 previous errors
25
+
26
+ For more information about this error, try `rustc --explain E0261`.
You can’t perform that action at this time.
0 commit comments