@@ -21,7 +21,7 @@ mod object_safety;
21
21
22
22
use crate :: bounds:: Bounds ;
23
23
use crate :: collect:: HirPlaceholderCollector ;
24
- use crate :: errors:: AmbiguousLifetimeBound ;
24
+ use crate :: errors:: { AmbiguousLifetimeBound , WildPatTy } ;
25
25
use crate :: hir_ty_lowering:: errors:: { prohibit_assoc_item_binding, GenericsArgsErrExtend } ;
26
26
use crate :: hir_ty_lowering:: generics:: { check_generic_arg_count, lower_generic_args} ;
27
27
use crate :: middle:: resolve_bound_vars as rbv;
@@ -2195,7 +2195,15 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2195
2195
// handled specially and will not descend into this routine.
2196
2196
self . ty_infer ( None , hir_ty. span )
2197
2197
}
2198
- hir:: TyKind :: Pat ( ..) => span_bug ! ( hir_ty. span, "{hir_ty:#?}" ) ,
2198
+ hir:: TyKind :: Pat ( _ty, pat) => match pat. kind {
2199
+ hir:: PatKind :: Wild => {
2200
+ let err = tcx. dcx ( ) . emit_err ( WildPatTy { span : pat. span } ) ;
2201
+ Ty :: new_error ( tcx, err)
2202
+ }
2203
+ hir:: PatKind :: Range ( _, _, _) => Ty :: new_misc_error ( tcx) ,
2204
+ hir:: PatKind :: Err ( e) => Ty :: new_error ( tcx, e) ,
2205
+ _ => span_bug ! ( pat. span, "unsupported pattern for pattern type: {pat:#?}" ) ,
2206
+ } ,
2199
2207
hir:: TyKind :: Err ( guar) => Ty :: new_error ( tcx, * guar) ,
2200
2208
} ;
2201
2209
0 commit comments