@@ -12,7 +12,7 @@ use crate::astconv::errors::prohibit_assoc_ty_binding;
12
12
use crate :: astconv:: generics:: { check_generic_arg_count, create_args_for_parent_generic_args} ;
13
13
use crate :: bounds:: Bounds ;
14
14
use crate :: collect:: HirPlaceholderCollector ;
15
- use crate :: errors:: { AmbiguousLifetimeBound , TypeofReservedKeywordUsed } ;
15
+ use crate :: errors:: { AmbiguousLifetimeBound , TypeofReservedKeywordUsed , WildPatTy } ;
16
16
use crate :: middle:: resolve_bound_vars as rbv;
17
17
use crate :: require_c_abi_if_c_variadic;
18
18
use rustc_ast:: TraitObjectSyntax ;
@@ -2559,7 +2559,25 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2559
2559
// handled specially and will not descend into this routine.
2560
2560
self . ty_infer ( None , ast_ty. span )
2561
2561
}
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
+ } ,
2563
2581
hir:: TyKind :: Err ( guar) => Ty :: new_error ( tcx, * guar) ,
2564
2582
} ;
2565
2583
0 commit comments