Skip to content

Commit e3f6e6a

Browse files
committed
Reuse parent_args
1 parent c291305 commit e3f6e6a

File tree

1 file changed

+2
-9
lines changed
  • compiler/rustc_mir_build/src/thir/pattern

1 file changed

+2
-9
lines changed

compiler/rustc_mir_build/src/thir/pattern/mod.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -600,26 +600,19 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
600600
let ty = tcx.typeck(def_id).node_type(block.hir_id);
601601

602602
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));
603+
let parent_args = ty::GenericArgs::identity_for_item(tcx, typeck_root_def_id);
605604
let args = ty::InlineConstArgs::new(tcx, ty::InlineConstArgsParts { parent_args, ty }).args;
606605

607-
debug_assert!(!args.has_free_regions());
608-
609606
let ct = ty::UnevaluatedConst { def: def_id.to_def_id(), args };
610607
let c = ty::Const::new_unevaluated(self.tcx, ct);
611608
let pattern = self.const_to_pat(c, ty, id, span);
612609

613610
// Apply a type ascription for the inline constant.
614-
// FIXME: reusing the `args` above causes an ICE
615611
let annotation = {
616612
let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis());
617613
let args = ty::InlineConstArgs::new(
618614
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-
},
615+
ty::InlineConstArgsParts { parent_args, ty: infcx.next_ty_var(span) },
623616
)
624617
.args;
625618
infcx.canonicalize_user_type_annotation(ty::UserType::new(ty::UserTypeKind::TypeOf(

0 commit comments

Comments
 (0)