Skip to content

Commit a8027c8

Browse files
committed
print normalized ty
1 parent 4f75af9 commit a8027c8

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

compiler/rustc_const_eval/src/interpret/operand.rs

+15-10
Original file line numberDiff line numberDiff line change
@@ -670,19 +670,24 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
670670

671671
trace!("eval_place_to_op: got {:?}", op);
672672
// Sanity-check the type we ended up with.
673-
debug_assert!(
674-
mir_assign_valid_types(
673+
if cfg!(debug_assertions) {
674+
let normalized_place_ty = self.subst_from_current_frame_and_normalize_erasing_regions(
675+
mir_place.ty(&self.frame().body.local_decls, *self.tcx).ty,
676+
)?;
677+
if !mir_assign_valid_types(
675678
*self.tcx,
676679
self.param_env,
677-
self.layout_of(self.subst_from_current_frame_and_normalize_erasing_regions(
678-
mir_place.ty(&self.frame().body.local_decls, *self.tcx).ty
679-
)?)?,
680+
self.layout_of(normalized_place_ty)?,
680681
op.layout,
681-
),
682-
"eval_place of a MIR place with type {:?} produced an interpreter operand with type {}",
683-
mir_place.ty(&self.frame().body.local_decls, *self.tcx).ty,
684-
op.layout.ty,
685-
);
682+
) {
683+
span_bug!(
684+
self.cur_span(),
685+
"eval_place of a MIR place with type {:?} produced an interpreter operand with type {}",
686+
normalized_place_ty,
687+
op.layout.ty,
688+
)
689+
}
690+
}
686691
Ok(op)
687692
}
688693

0 commit comments

Comments
 (0)