@@ -131,9 +131,15 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
131
131
match ty {
132
132
Some ( ty) => {
133
133
let ty = self . resolve_vars_if_possible ( ty) ;
134
- if ty. references_error ( ) || ty . is_ty_var ( ) {
134
+ if ty. references_error ( ) {
135
135
debug ! ( "resolve_type_vars_or_error: error from {:?}" , ty) ;
136
136
Err ( ( ) )
137
+ } else if ty. is_ty_var ( ) {
138
+ debug ! ( "resolve_type_vars_or_error: infer var from {:?}" , ty) ;
139
+ self . tcx ( )
140
+ . dcx ( )
141
+ . span_delayed_bug ( self . tcx ( ) . hir ( ) . span ( id) , "encountered type variable" ) ;
142
+ Err ( ( ) )
137
143
} else {
138
144
Ok ( ty)
139
145
}
@@ -210,6 +216,9 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
210
216
Some ( t) => Ok ( t. ty ) ,
211
217
None => {
212
218
debug ! ( "By-ref binding of non-derefable type" ) ;
219
+ self . tcx ( )
220
+ . dcx ( )
221
+ . span_delayed_bug ( pat. span , "by-ref binding of non-derefable type" ) ;
213
222
Err ( ( ) )
214
223
}
215
224
}
@@ -488,6 +497,10 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
488
497
Some ( mt) => mt. ty ,
489
498
None => {
490
499
debug ! ( "explicit deref of non-derefable type: {:?}" , base_curr_ty) ;
500
+ self . tcx ( ) . dcx ( ) . span_delayed_bug (
501
+ self . tcx ( ) . hir ( ) . span ( node. hir_id ( ) ) ,
502
+ "explicit deref of non-derefable type" ,
503
+ ) ;
491
504
return Err ( ( ) ) ;
492
505
}
493
506
} ;
@@ -732,6 +745,9 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
732
745
PatKind :: Slice ( before, ref slice, after) => {
733
746
let Some ( element_ty) = place_with_id. place . ty ( ) . builtin_index ( ) else {
734
747
debug ! ( "explicit index of non-indexable type {:?}" , place_with_id) ;
748
+ self . tcx ( )
749
+ . dcx ( )
750
+ . span_delayed_bug ( pat. span , "explicit index of non-indexable type" ) ;
735
751
return Err ( ( ) ) ;
736
752
} ;
737
753
let elt_place = self . cat_projection (
0 commit comments