@@ -21,7 +21,7 @@ mod object_safety;
2121
2222use crate :: bounds:: Bounds ;
2323use crate :: collect:: HirPlaceholderCollector ;
24- use crate :: errors:: AmbiguousLifetimeBound ;
24+ use crate :: errors:: { AmbiguousLifetimeBound , WildPatTy } ;
2525use crate :: hir_ty_lowering:: errors:: { prohibit_assoc_item_binding, GenericsArgsErrExtend } ;
2626use crate :: hir_ty_lowering:: generics:: { check_generic_arg_count, lower_generic_args} ;
2727use crate :: middle:: resolve_bound_vars as rbv;
@@ -2195,7 +2195,15 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
21952195 // handled specially and will not descend into this routine.
21962196 self . ty_infer ( None , hir_ty. span )
21972197 }
2198- hir:: TyKind :: Pat ( ..) => span_bug ! ( ast_ty. span, "{ast_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+ } ,
21992207 hir:: TyKind :: Err ( guar) => Ty :: new_error ( tcx, * guar) ,
22002208 } ;
22012209
0 commit comments