interpret: less debug-printing of types
This commit is contained in:
parent
da08a3f40c
commit
bdbf545f42
@ -87,7 +87,7 @@ pub fn cast(
|
|||||||
let fn_ptr = self.fn_ptr(FnVal::Instance(instance));
|
let fn_ptr = self.fn_ptr(FnVal::Instance(instance));
|
||||||
self.write_pointer(fn_ptr, dest)?;
|
self.write_pointer(fn_ptr, dest)?;
|
||||||
}
|
}
|
||||||
_ => span_bug!(self.cur_span(), "reify fn pointer on {:?}", src.layout.ty),
|
_ => span_bug!(self.cur_span(), "reify fn pointer on {}", src.layout.ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ pub fn cast(
|
|||||||
// No change to value
|
// No change to value
|
||||||
self.write_immediate(*src, dest)?;
|
self.write_immediate(*src, dest)?;
|
||||||
}
|
}
|
||||||
_ => span_bug!(self.cur_span(), "fn to unsafe fn cast on {:?}", cast_ty),
|
_ => span_bug!(self.cur_span(), "fn to unsafe fn cast on {}", cast_ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ pub fn cast(
|
|||||||
let fn_ptr = self.fn_ptr(FnVal::Instance(instance));
|
let fn_ptr = self.fn_ptr(FnVal::Instance(instance));
|
||||||
self.write_pointer(fn_ptr, dest)?;
|
self.write_pointer(fn_ptr, dest)?;
|
||||||
}
|
}
|
||||||
_ => span_bug!(self.cur_span(), "closure fn pointer on {:?}", src.layout.ty),
|
_ => span_bug!(self.cur_span(), "closure fn pointer on {}", src.layout.ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ pub fn float_to_float_or_int(
|
|||||||
Float(FloatTy::F32) => self.cast_from_float(src.to_scalar().to_f32()?, cast_ty),
|
Float(FloatTy::F32) => self.cast_from_float(src.to_scalar().to_f32()?, cast_ty),
|
||||||
Float(FloatTy::F64) => self.cast_from_float(src.to_scalar().to_f64()?, cast_ty),
|
Float(FloatTy::F64) => self.cast_from_float(src.to_scalar().to_f64()?, cast_ty),
|
||||||
_ => {
|
_ => {
|
||||||
bug!("Can't cast 'Float' type into {:?}", cast_ty);
|
bug!("Can't cast 'Float' type into {}", cast_ty);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ok(ImmTy::from_scalar(val, layout))
|
Ok(ImmTy::from_scalar(val, layout))
|
||||||
@ -218,7 +218,7 @@ pub fn ptr_to_ptr(
|
|||||||
Immediate::ScalarPair(data, _) => Ok(ImmTy::from_scalar(data, dest_layout)),
|
Immediate::ScalarPair(data, _) => Ok(ImmTy::from_scalar(data, dest_layout)),
|
||||||
Immediate::Scalar(..) => span_bug!(
|
Immediate::Scalar(..) => span_bug!(
|
||||||
self.cur_span(),
|
self.cur_span(),
|
||||||
"{:?} input to a fat-to-thin cast ({:?} -> {:?})",
|
"{:?} input to a fat-to-thin cast ({} -> {})",
|
||||||
*src,
|
*src,
|
||||||
src.layout.ty,
|
src.layout.ty,
|
||||||
cast_ty
|
cast_ty
|
||||||
@ -302,7 +302,7 @@ fn cast_from_int_like(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Casts to bool are not permitted by rustc, no need to handle them here.
|
// Casts to bool are not permitted by rustc, no need to handle them here.
|
||||||
_ => span_bug!(self.cur_span(), "invalid int to {:?} cast", cast_ty),
|
_ => span_bug!(self.cur_span(), "invalid int to {} cast", cast_ty),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ fn cast_from_float<F>(&self, f: F, dest_ty: Ty<'tcx>) -> Scalar<M::Provenance>
|
|||||||
// float -> f64
|
// float -> f64
|
||||||
Float(FloatTy::F64) => Scalar::from_f64(f.convert(&mut false).value),
|
Float(FloatTy::F64) => Scalar::from_f64(f.convert(&mut false).value),
|
||||||
// That's it.
|
// That's it.
|
||||||
_ => span_bug!(self.cur_span(), "invalid float to {:?} cast", dest_ty),
|
_ => span_bug!(self.cur_span(), "invalid float to {} cast", dest_ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ fn unsize_into_ptr(
|
|||||||
|
|
||||||
span_bug!(
|
span_bug!(
|
||||||
self.cur_span(),
|
self.cur_span(),
|
||||||
"invalid pointer unsizing {:?} -> {:?}",
|
"invalid pointer unsizing {} -> {}",
|
||||||
src.layout.ty,
|
src.layout.ty,
|
||||||
cast_ty
|
cast_ty
|
||||||
)
|
)
|
||||||
@ -407,7 +407,7 @@ fn unsize_into(
|
|||||||
cast_ty: TyAndLayout<'tcx>,
|
cast_ty: TyAndLayout<'tcx>,
|
||||||
dest: &PlaceTy<'tcx, M::Provenance>,
|
dest: &PlaceTy<'tcx, M::Provenance>,
|
||||||
) -> InterpResult<'tcx> {
|
) -> InterpResult<'tcx> {
|
||||||
trace!("Unsizing {:?} of type {} into {:?}", *src, src.layout.ty, cast_ty.ty);
|
trace!("Unsizing {:?} of type {} into {}", *src, src.layout.ty, cast_ty.ty);
|
||||||
match (&src.layout.ty.kind(), &cast_ty.ty.kind()) {
|
match (&src.layout.ty.kind(), &cast_ty.ty.kind()) {
|
||||||
(&ty::Ref(_, s, _), &ty::Ref(_, c, _) | &ty::RawPtr(TypeAndMut { ty: c, .. }))
|
(&ty::Ref(_, s, _), &ty::Ref(_, c, _) | &ty::RawPtr(TypeAndMut { ty: c, .. }))
|
||||||
| (&ty::RawPtr(TypeAndMut { ty: s, .. }), &ty::RawPtr(TypeAndMut { ty: c, .. })) => {
|
| (&ty::RawPtr(TypeAndMut { ty: s, .. }), &ty::RawPtr(TypeAndMut { ty: c, .. })) => {
|
||||||
|
@ -416,7 +416,7 @@ pub(super) fn from_known_layout<'tcx>(
|
|||||||
if !mir_assign_valid_types(tcx.tcx, param_env, check_layout, known_layout) {
|
if !mir_assign_valid_types(tcx.tcx, param_env, check_layout, known_layout) {
|
||||||
span_bug!(
|
span_bug!(
|
||||||
tcx.span,
|
tcx.span,
|
||||||
"expected type differs from actual type.\nexpected: {:?}\nactual: {:?}",
|
"expected type differs from actual type.\nexpected: {}\nactual: {}",
|
||||||
known_layout.ty,
|
known_layout.ty,
|
||||||
check_layout.ty,
|
check_layout.ty,
|
||||||
);
|
);
|
||||||
@ -712,7 +712,7 @@ pub(super) fn size_and_align_of(
|
|||||||
|
|
||||||
ty::Foreign(_) => Ok(None),
|
ty::Foreign(_) => Ok(None),
|
||||||
|
|
||||||
_ => span_bug!(self.cur_span(), "size_and_align_of::<{:?}> not supported", layout.ty),
|
_ => span_bug!(self.cur_span(), "size_and_align_of::<{}> not supported", layout.ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -982,7 +982,7 @@ fn is_very_trivially_sized(ty: Ty<'_>) -> bool {
|
|||||||
|
|
||||||
ty::Bound(..)
|
ty::Bound(..)
|
||||||
| ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
|
| ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
|
||||||
bug!("`is_very_trivially_sized` applied to unexpected type: {:?}", ty)
|
bug!("`is_very_trivially_sized` applied to unexpected type: {}", ty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -514,11 +514,7 @@ pub fn read_immediate(
|
|||||||
Abi::Scalar(abi::Scalar::Initialized { .. })
|
Abi::Scalar(abi::Scalar::Initialized { .. })
|
||||||
| Abi::ScalarPair(abi::Scalar::Initialized { .. }, abi::Scalar::Initialized { .. })
|
| Abi::ScalarPair(abi::Scalar::Initialized { .. }, abi::Scalar::Initialized { .. })
|
||||||
) {
|
) {
|
||||||
span_bug!(
|
span_bug!(self.cur_span(), "primitive read not possible for type: {}", op.layout().ty);
|
||||||
self.cur_span(),
|
|
||||||
"primitive read not possible for type: {:?}",
|
|
||||||
op.layout().ty
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
let imm = self.read_immediate_raw(op)?.right().unwrap();
|
let imm = self.read_immediate_raw(op)?.right().unwrap();
|
||||||
if matches!(*imm, Immediate::Uninit) {
|
if matches!(*imm, Immediate::Uninit) {
|
||||||
@ -669,7 +665,7 @@ pub fn eval_place_to_op(
|
|||||||
)?)?,
|
)?)?,
|
||||||
op.layout,
|
op.layout,
|
||||||
),
|
),
|
||||||
"eval_place of a MIR place with type {:?} produced an interpreter operand with type {:?}",
|
"eval_place of a MIR place with type {:?} produced an interpreter operand with type {}",
|
||||||
mir_place.ty(&self.frame().body.local_decls, *self.tcx).ty,
|
mir_place.ty(&self.frame().body.local_decls, *self.tcx).ty,
|
||||||
op.layout.ty,
|
op.layout.ty,
|
||||||
);
|
);
|
||||||
|
@ -207,12 +207,9 @@ fn binary_int_op(
|
|||||||
if left_layout.ty != right_layout.ty {
|
if left_layout.ty != right_layout.ty {
|
||||||
span_bug!(
|
span_bug!(
|
||||||
self.cur_span(),
|
self.cur_span(),
|
||||||
"invalid asymmetric binary op {:?}: {:?} ({:?}), {:?} ({:?})",
|
"invalid asymmetric binary op {bin_op:?}: {l:?} ({l_ty}), {r:?} ({r_ty})",
|
||||||
bin_op,
|
l_ty = left_layout.ty,
|
||||||
l,
|
r_ty = right_layout.ty,
|
||||||
left_layout.ty,
|
|
||||||
r,
|
|
||||||
right_layout.ty,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +306,7 @@ fn binary_int_op(
|
|||||||
|
|
||||||
_ => span_bug!(
|
_ => span_bug!(
|
||||||
self.cur_span(),
|
self.cur_span(),
|
||||||
"invalid binary op {:?}: {:?}, {:?} (both {:?})",
|
"invalid binary op {:?}: {:?}, {:?} (both {})",
|
||||||
bin_op,
|
bin_op,
|
||||||
l,
|
l,
|
||||||
r,
|
r,
|
||||||
@ -355,7 +352,7 @@ pub fn overflowing_binary_op(
|
|||||||
right: &ImmTy<'tcx, M::Provenance>,
|
right: &ImmTy<'tcx, M::Provenance>,
|
||||||
) -> InterpResult<'tcx, (ImmTy<'tcx, M::Provenance>, bool)> {
|
) -> InterpResult<'tcx, (ImmTy<'tcx, M::Provenance>, bool)> {
|
||||||
trace!(
|
trace!(
|
||||||
"Running binary op {:?}: {:?} ({:?}), {:?} ({:?})",
|
"Running binary op {:?}: {:?} ({}), {:?} ({})",
|
||||||
bin_op,
|
bin_op,
|
||||||
*left,
|
*left,
|
||||||
left.layout.ty,
|
left.layout.ty,
|
||||||
@ -394,7 +391,7 @@ pub fn overflowing_binary_op(
|
|||||||
// the RHS type can be different, e.g. for shifts -- but it has to be integral, too
|
// the RHS type can be different, e.g. for shifts -- but it has to be integral, too
|
||||||
assert!(
|
assert!(
|
||||||
right.layout.ty.is_integral(),
|
right.layout.ty.is_integral(),
|
||||||
"Unexpected types for BinOp: {:?} {:?} {:?}",
|
"Unexpected types for BinOp: {} {:?} {}",
|
||||||
left.layout.ty,
|
left.layout.ty,
|
||||||
bin_op,
|
bin_op,
|
||||||
right.layout.ty
|
right.layout.ty
|
||||||
@ -409,7 +406,7 @@ pub fn overflowing_binary_op(
|
|||||||
// (Even when both sides are pointers, their type might differ, see issue #91636)
|
// (Even when both sides are pointers, their type might differ, see issue #91636)
|
||||||
assert!(
|
assert!(
|
||||||
right.layout.ty.is_any_ptr() || right.layout.ty.is_integral(),
|
right.layout.ty.is_any_ptr() || right.layout.ty.is_integral(),
|
||||||
"Unexpected types for BinOp: {:?} {:?} {:?}",
|
"Unexpected types for BinOp: {} {:?} {}",
|
||||||
left.layout.ty,
|
left.layout.ty,
|
||||||
bin_op,
|
bin_op,
|
||||||
right.layout.ty
|
right.layout.ty
|
||||||
@ -419,7 +416,7 @@ pub fn overflowing_binary_op(
|
|||||||
}
|
}
|
||||||
_ => span_bug!(
|
_ => span_bug!(
|
||||||
self.cur_span(),
|
self.cur_span(),
|
||||||
"Invalid MIR: bad LHS type for binop: {:?}",
|
"Invalid MIR: bad LHS type for binop: {}",
|
||||||
left.layout.ty
|
left.layout.ty
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
@ -447,7 +444,7 @@ pub fn overflowing_unary_op(
|
|||||||
|
|
||||||
let layout = val.layout;
|
let layout = val.layout;
|
||||||
let val = val.to_scalar();
|
let val = val.to_scalar();
|
||||||
trace!("Running unary op {:?}: {:?} ({:?})", un_op, val, layout.ty);
|
trace!("Running unary op {:?}: {:?} ({})", un_op, val, layout.ty);
|
||||||
|
|
||||||
match layout.ty.kind() {
|
match layout.ty.kind() {
|
||||||
ty::Bool => {
|
ty::Bool => {
|
||||||
|
@ -460,7 +460,7 @@ pub fn deref_pointer(
|
|||||||
trace!("deref to {} on {:?}", val.layout.ty, *val);
|
trace!("deref to {} on {:?}", val.layout.ty, *val);
|
||||||
|
|
||||||
if val.layout.ty.is_box() {
|
if val.layout.ty.is_box() {
|
||||||
bug!("dereferencing {:?}", val.layout.ty);
|
bug!("dereferencing {}", val.layout.ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mplace = self.ref_to_mplace(&val)?;
|
let mplace = self.ref_to_mplace(&val)?;
|
||||||
@ -582,7 +582,7 @@ pub fn eval_place(
|
|||||||
)?)?,
|
)?)?,
|
||||||
place.layout,
|
place.layout,
|
||||||
),
|
),
|
||||||
"eval_place of a MIR place with type {:?} produced an interpreter place with type {:?}",
|
"eval_place of a MIR place with type {:?} produced an interpreter place with type {}",
|
||||||
mir_place.ty(&self.frame().body.local_decls, *self.tcx).ty,
|
mir_place.ty(&self.frame().body.local_decls, *self.tcx).ty,
|
||||||
place.layout.ty,
|
place.layout.ty,
|
||||||
);
|
);
|
||||||
@ -835,7 +835,7 @@ fn copy_op_no_validate(
|
|||||||
if !allow_transmute && !layout_compat {
|
if !allow_transmute && !layout_compat {
|
||||||
span_bug!(
|
span_bug!(
|
||||||
self.cur_span(),
|
self.cur_span(),
|
||||||
"type mismatch when copying!\nsrc: {:?},\ndest: {:?}",
|
"type mismatch when copying!\nsrc: {},\ndest: {}",
|
||||||
src.layout().ty,
|
src.layout().ty,
|
||||||
dest.layout().ty,
|
dest.layout().ty,
|
||||||
);
|
);
|
||||||
|
@ -149,7 +149,7 @@ pub(super) fn eval_terminator(
|
|||||||
}
|
}
|
||||||
_ => span_bug!(
|
_ => span_bug!(
|
||||||
terminator.source_info.span,
|
terminator.source_info.span,
|
||||||
"invalid callee of type {:?}",
|
"invalid callee of type {}",
|
||||||
func.layout.ty
|
func.layout.ty
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
@ -679,10 +679,7 @@ pub(crate) fn eval_fn_call(
|
|||||||
self.storage_live(local)?;
|
self.storage_live(local)?;
|
||||||
// Must be a tuple
|
// Must be a tuple
|
||||||
let ty::Tuple(fields) = ty.kind() else {
|
let ty::Tuple(fields) = ty.kind() else {
|
||||||
span_bug!(
|
span_bug!(self.cur_span(), "non-tuple type for `spread_arg`: {ty}")
|
||||||
self.cur_span(),
|
|
||||||
"non-tuple type for `spread_arg`: {ty:?}"
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
for (i, field_ty) in fields.iter().enumerate() {
|
for (i, field_ty) in fields.iter().enumerate() {
|
||||||
let dest = dest.project_deeper(
|
let dest = dest.project_deeper(
|
||||||
@ -924,7 +921,7 @@ fn drop_in_place(
|
|||||||
target: mir::BasicBlock,
|
target: mir::BasicBlock,
|
||||||
unwind: mir::UnwindAction,
|
unwind: mir::UnwindAction,
|
||||||
) -> InterpResult<'tcx> {
|
) -> InterpResult<'tcx> {
|
||||||
trace!("drop_in_place: {:?},\n {:?}, {:?}", *place, place.layout.ty, instance);
|
trace!("drop_in_place: {:?},\n instance={:?}", place, instance);
|
||||||
// We take the address of the object. This may well be unaligned, which is fine
|
// We take the address of the object. This may well be unaligned, which is fine
|
||||||
// for us here. However, unaligned accesses will probably make the actual drop
|
// for us here. However, unaligned accesses will probably make the actual drop
|
||||||
// implementation fail -- a problem shared by rustc.
|
// implementation fail -- a problem shared by rustc.
|
||||||
|
Loading…
Reference in New Issue
Block a user