@@ -548,37 +548,8 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
548
548
_ => return pat_from_kind ( self . lower_variant_or_leaf ( res, id, span, ty, vec ! [ ] ) ) ,
549
549
} ;
550
550
551
- // Use `Reveal::All` here because patterns are always monomorphic even if their function
552
- // isn't.
553
- let param_env_reveal_all = self . param_env . with_reveal_all_normalized ( self . tcx ) ;
554
- // N.B. There is no guarantee that args collected in typeck results are fully normalized,
555
- // so they need to be normalized in order to pass to `Instance::resolve`, which will ICE
556
- // if given unnormalized types.
557
- let args = self
558
- . tcx
559
- . normalize_erasing_regions ( param_env_reveal_all, self . typeck_results . node_args ( id) ) ;
560
- let instance = match ty:: Instance :: try_resolve ( self . tcx , param_env_reveal_all, def_id, args)
561
- {
562
- Ok ( Some ( i) ) => i,
563
- Ok ( None ) => {
564
- // It should be assoc consts if there's no error but we cannot resolve it.
565
- debug_assert ! ( is_associated_const) ;
566
-
567
- let e = self . tcx . dcx ( ) . emit_err ( AssocConstInPattern { span } ) ;
568
- return pat_from_kind ( PatKind :: Error ( e) ) ;
569
- }
570
-
571
- Err ( _) => {
572
- let e = self . tcx . dcx ( ) . emit_err ( CouldNotEvalConstPattern { span } ) ;
573
- return pat_from_kind ( PatKind :: Error ( e) ) ;
574
- }
575
- } ;
576
-
577
- let c = ty:: Const :: new_unevaluated (
578
- self . tcx ,
579
- ty:: UnevaluatedConst { def : instance. def_id ( ) , args : instance. args } ,
580
- ) ;
581
-
551
+ let args = self . typeck_results . node_args ( id) ;
552
+ let c = ty:: Const :: new_unevaluated ( self . tcx , ty:: UnevaluatedConst { def : def_id, args } ) ;
582
553
let pattern = self . const_to_pat ( c, ty, id, span) ;
583
554
584
555
if !is_associated_const {
0 commit comments