@@ -19,9 +19,7 @@ use rustc_middle::thir::{
19
19
Ascription , FieldPat , LocalVarId , Pat , PatKind , PatRange , PatRangeBoundary ,
20
20
} ;
21
21
use rustc_middle:: ty:: layout:: IntegerExt ;
22
- use rustc_middle:: ty:: {
23
- self , CanonicalUserTypeAnnotation , Ty , TyCtxt , TypeVisitableExt , TypingMode ,
24
- } ;
22
+ use rustc_middle:: ty:: { self , CanonicalUserTypeAnnotation , Ty , TyCtxt , TypingMode } ;
25
23
use rustc_middle:: { bug, span_bug} ;
26
24
use rustc_span:: def_id:: DefId ;
27
25
use rustc_span:: { ErrorGuaranteed , Span } ;
@@ -600,26 +598,19 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
600
598
let ty = tcx. typeck ( def_id) . node_type ( block. hir_id ) ;
601
599
602
600
let typeck_root_def_id = tcx. typeck_root_def_id ( def_id. to_def_id ( ) ) ;
603
- let parent_args =
604
- tcx. erase_regions ( ty:: GenericArgs :: identity_for_item ( tcx, typeck_root_def_id) ) ;
601
+ let parent_args = ty:: GenericArgs :: identity_for_item ( tcx, typeck_root_def_id) ;
605
602
let args = ty:: InlineConstArgs :: new ( tcx, ty:: InlineConstArgsParts { parent_args, ty } ) . args ;
606
603
607
- debug_assert ! ( !args. has_free_regions( ) ) ;
608
-
609
604
let ct = ty:: UnevaluatedConst { def : def_id. to_def_id ( ) , args } ;
610
605
let c = ty:: Const :: new_unevaluated ( self . tcx , ct) ;
611
606
let pattern = self . const_to_pat ( c, ty, id, span) ;
612
607
613
608
// Apply a type ascription for the inline constant.
614
- // FIXME: reusing the `args` above causes an ICE
615
609
let annotation = {
616
610
let infcx = tcx. infer_ctxt ( ) . build ( TypingMode :: non_body_analysis ( ) ) ;
617
611
let args = ty:: InlineConstArgs :: new (
618
612
tcx,
619
- ty:: InlineConstArgsParts {
620
- parent_args : ty:: GenericArgs :: identity_for_item ( tcx, typeck_root_def_id) ,
621
- ty : infcx. next_ty_var ( span) ,
622
- } ,
613
+ ty:: InlineConstArgsParts { parent_args, ty : infcx. next_ty_var ( span) } ,
623
614
)
624
615
. args ;
625
616
infcx. canonicalize_user_type_annotation ( ty:: UserType :: new ( ty:: UserTypeKind :: TypeOf (
0 commit comments