@@ -12,7 +12,7 @@ use crate::astconv::errors::prohibit_assoc_ty_binding;
1212use crate :: astconv:: generics:: { check_generic_arg_count, create_args_for_parent_generic_args} ;
1313use crate :: bounds:: Bounds ;
1414use crate :: collect:: HirPlaceholderCollector ;
15- use crate :: errors:: { AmbiguousLifetimeBound , TypeofReservedKeywordUsed } ;
15+ use crate :: errors:: { AmbiguousLifetimeBound , TypeofReservedKeywordUsed , WildPatTy } ;
1616use crate :: middle:: resolve_bound_vars as rbv;
1717use crate :: require_c_abi_if_c_variadic;
1818use rustc_ast:: TraitObjectSyntax ;
@@ -2559,7 +2559,25 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
25592559 // handled specially and will not descend into this routine.
25602560 self . ty_infer ( None , ast_ty. span )
25612561 }
2562- hir:: TyKind :: Pat ( ..) => span_bug ! ( ast_ty. span, "{ast_ty:#?}" ) ,
2562+ hir:: TyKind :: Pat ( _ty, pat) => match pat. kind {
2563+ hir:: PatKind :: Wild => {
2564+ let err = tcx. dcx ( ) . emit_err ( WildPatTy { span : pat. span } ) ;
2565+ Ty :: new_error ( tcx, err)
2566+ }
2567+ hir:: PatKind :: Binding ( _, _, _, _) => todo ! ( ) ,
2568+ hir:: PatKind :: Struct ( _, _, _) => todo ! ( ) ,
2569+ hir:: PatKind :: TupleStruct ( _, _, _) => todo ! ( ) ,
2570+ hir:: PatKind :: Or ( _) => todo ! ( ) ,
2571+ hir:: PatKind :: Path ( _) => todo ! ( ) ,
2572+ hir:: PatKind :: Tuple ( _, _) => todo ! ( ) ,
2573+ hir:: PatKind :: Box ( _) => todo ! ( ) ,
2574+ hir:: PatKind :: Ref ( _, _) => todo ! ( ) ,
2575+ hir:: PatKind :: Lit ( _) => todo ! ( ) ,
2576+ hir:: PatKind :: Range ( _, _, _) => Ty :: new_misc_error ( tcx) ,
2577+ hir:: PatKind :: Slice ( _, _, _) => todo ! ( ) ,
2578+ hir:: PatKind :: Never => todo ! ( ) ,
2579+ hir:: PatKind :: Err ( e) => Ty :: new_error ( tcx, e) ,
2580+ } ,
25632581 hir:: TyKind :: Err ( guar) => Ty :: new_error ( tcx, * guar) ,
25642582 } ;
25652583
0 commit comments