renaming err to err_unsup
This commit is contained in:
parent
b60a336e86
commit
fc5df1dfbf
@ -244,7 +244,7 @@ pub fn read_c_str(
|
||||
Ok(&self.get_bytes(cx, ptr, size_with_null)?[..size])
|
||||
}
|
||||
// This includes the case where `offset` is out-of-bounds to begin with.
|
||||
None => throw_err!(UnterminatedCString(ptr.erase_tag())),
|
||||
None => throw_err_unsup!(UnterminatedCString(ptr.erase_tag())),
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ fn check_relocations(
|
||||
if self.relocations(cx, ptr, size).is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
throw_err!(ReadPointerAsBytes)
|
||||
throw_err_unsup!(ReadPointerAsBytes)
|
||||
}
|
||||
}
|
||||
|
||||
@ -516,7 +516,7 @@ fn check_defined(&self, ptr: Pointer<Tag>, size: Size) -> InterpResult<'tcx> {
|
||||
self.undef_mask.is_range_defined(
|
||||
ptr.offset,
|
||||
ptr.offset + size,
|
||||
).or_else(|idx| throw_err!(ReadUndefBytes(idx)))
|
||||
).or_else(|idx| throw_err_unsup!(ReadUndefBytes(idx)))
|
||||
}
|
||||
|
||||
pub fn mark_definedness(
|
||||
|
@ -184,8 +184,8 @@ pub fn struct_error<'tcx>(tcx: TyCtxtAt<'tcx>, msg: &str) -> DiagnosticBuilder<'
|
||||
/// Packages the kind of error we got from the const code interpreter
|
||||
/// up with a Rust-level backtrace of where the error occured.
|
||||
/// Thsese should always be constructed by calling `.into()` on
|
||||
/// a `InterpError`. In `librustc_mir::interpret`, we have the `throw_err!`
|
||||
/// macro for this.
|
||||
/// a `InterpError`. In `librustc_mir::interpret`, we have `throw_err_*`
|
||||
/// macros for this.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct InterpErrorInfo<'tcx> {
|
||||
pub kind: InterpError<'tcx>,
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! An interpreter for MIR used in CTFE and by miri
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! throw_err {
|
||||
macro_rules! throw_err_unsup {
|
||||
($($tt:tt)*) => {
|
||||
Err($crate::mir::interpret::InterpError::Unsupported(
|
||||
$crate::mir::interpret::UnsupportedOpInfo::$($tt)*
|
||||
@ -55,7 +55,7 @@ macro_rules! err_inval {
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! err {
|
||||
macro_rules! err_unsup {
|
||||
($($tt:tt)*) => {
|
||||
$crate::mir::interpret::InterpError::Unsupported(
|
||||
$crate::mir::interpret::UnsupportedOpInfo::$($tt)*
|
||||
|
@ -196,7 +196,7 @@ pub fn check_in_alloc(
|
||||
msg: CheckInAllocMsg,
|
||||
) -> InterpResult<'tcx, ()> {
|
||||
if self.offset > allocation_size {
|
||||
throw_err!(PointerOutOfBounds { ptr: self.erase_tag(), msg, allocation_size })
|
||||
throw_err_unsup!(PointerOutOfBounds { ptr: self.erase_tag(), msg, allocation_size })
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ pub fn to_bits(self, target_size: Size) -> InterpResult<'tcx, u128> {
|
||||
Scalar::check_data(data, size);
|
||||
Ok(data)
|
||||
}
|
||||
Scalar::Ptr(_) => throw_err!(ReadPointerAsBytes),
|
||||
Scalar::Ptr(_) => throw_err_unsup!(ReadPointerAsBytes),
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,8 +373,8 @@ pub fn assert_bits(self, target_size: Size) -> u128 {
|
||||
#[inline]
|
||||
pub fn to_ptr(self) -> InterpResult<'tcx, Pointer<Tag>> {
|
||||
match self {
|
||||
Scalar::Raw { data: 0, .. } => throw_err!(InvalidNullPointerUsage),
|
||||
Scalar::Raw { .. } => throw_err!(ReadBytesAsPointer),
|
||||
Scalar::Raw { data: 0, .. } => throw_err_unsup!(InvalidNullPointerUsage),
|
||||
Scalar::Raw { .. } => throw_err_unsup!(ReadBytesAsPointer),
|
||||
Scalar::Ptr(p) => Ok(p),
|
||||
}
|
||||
}
|
||||
@ -406,7 +406,7 @@ pub fn to_bool(self) -> InterpResult<'tcx, bool> {
|
||||
match self {
|
||||
Scalar::Raw { data: 0, size: 1 } => Ok(false),
|
||||
Scalar::Raw { data: 1, size: 1 } => Ok(true),
|
||||
_ => throw_err!(InvalidBool),
|
||||
_ => throw_err_unsup!(InvalidBool),
|
||||
}
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ pub fn to_char(self) -> InterpResult<'tcx, char> {
|
||||
let val = self.to_u32()?;
|
||||
match ::std::char::from_u32(val) {
|
||||
Some(c) => Ok(c),
|
||||
None => throw_err!(InvalidChar(val as u128)),
|
||||
None => throw_err_unsup!(InvalidChar(val as u128)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -537,7 +537,7 @@ pub fn erase_tag(self) -> ScalarMaybeUndef
|
||||
pub fn not_undef(self) -> InterpResult<'static, Scalar<Tag>> {
|
||||
match self {
|
||||
ScalarMaybeUndef::Scalar(scalar) => Ok(scalar),
|
||||
ScalarMaybeUndef::Undef => throw_err!(ReadUndefBytes(Size::from_bytes(0))),
|
||||
ScalarMaybeUndef::Undef => throw_err_unsup!(ReadUndefBytes(Size::from_bytes(0))),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,9 @@ fn find_fn(
|
||||
ecx.goto_block(ret)?; // fully evaluated and done
|
||||
Ok(None)
|
||||
} else {
|
||||
throw_err!(MachineError(format!("calling non-const function `{}`", instance)))
|
||||
throw_err_unsup!(
|
||||
MachineError(format!("calling non-const function `{}`", instance))
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -412,7 +414,7 @@ fn find_foreign_static(
|
||||
_tcx: TyCtxt<'tcx>,
|
||||
_def_id: DefId,
|
||||
) -> InterpResult<'tcx, Cow<'tcx, Allocation<Self::PointerTag>>> {
|
||||
throw_err!(ReadForeignStatic)
|
||||
throw_err_unsup!(ReadForeignStatic)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
@ -199,7 +199,7 @@ fn cast_from_int(
|
||||
},
|
||||
|
||||
// Casts to bool are not permitted by rustc, no need to handle them here.
|
||||
_ => throw_err!(Unimplemented(format!("int to {:?} cast", dest_layout.ty))),
|
||||
_ => throw_err_unsup!(Unimplemented(format!("int to {:?} cast", dest_layout.ty))),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ pub enum LocalValue<Tag=(), Id=AllocId> {
|
||||
impl<'tcx, Tag: Copy + 'static> LocalState<'tcx, Tag> {
|
||||
pub fn access(&self) -> InterpResult<'tcx, Operand<Tag>> {
|
||||
match self.value {
|
||||
LocalValue::Dead => throw_err!(DeadLocal),
|
||||
LocalValue::Dead => throw_err_unsup!(DeadLocal),
|
||||
LocalValue::Uninitialized =>
|
||||
bug!("The type checker should prevent reading from a never-written local"),
|
||||
LocalValue::Live(val) => Ok(val),
|
||||
@ -148,7 +148,7 @@ pub fn access_mut(
|
||||
&mut self,
|
||||
) -> InterpResult<'tcx, Result<&mut LocalValue<Tag>, MemPlace<Tag>>> {
|
||||
match self.value {
|
||||
LocalValue::Dead => throw_err!(DeadLocal),
|
||||
LocalValue::Dead => throw_err_unsup!(DeadLocal),
|
||||
LocalValue::Live(Operand::Indirect(mplace)) => Ok(Err(mplace)),
|
||||
ref mut local @ LocalValue::Live(Operand::Immediate(_)) |
|
||||
ref mut local @ LocalValue::Uninitialized => {
|
||||
@ -346,7 +346,7 @@ pub fn load_mir(
|
||||
ty::InstanceDef::Item(def_id) => if self.tcx.is_mir_available(did) {
|
||||
Ok(self.tcx.optimized_mir(did))
|
||||
} else {
|
||||
throw_err!(NoMirFor(self.tcx.def_path_str(def_id)))
|
||||
throw_err_unsup!(NoMirFor(self.tcx.def_path_str(def_id)))
|
||||
},
|
||||
_ => Ok(self.tcx.instance_mir(instance)),
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ pub fn intern_const_alloc_recursive(
|
||||
}
|
||||
} else if ecx.memory().dead_alloc_map.contains_key(&alloc_id) {
|
||||
// dangling pointer
|
||||
return throw_err!(
|
||||
return throw_err_unsup!(
|
||||
ValidationFailure("encountered dangling pointer in final constant".into())
|
||||
)
|
||||
}
|
||||
|
@ -104,7 +104,9 @@ pub fn emulate_intrinsic(
|
||||
};
|
||||
let out_val = if intrinsic_name.ends_with("_nonzero") {
|
||||
if bits == 0 {
|
||||
return throw_err!(Intrinsic(format!("{} called on 0", intrinsic_name)));
|
||||
return throw_err_unsup!(
|
||||
Intrinsic(format!("{} called on 0", intrinsic_name))
|
||||
);
|
||||
}
|
||||
numeric_intrinsic(intrinsic_name.trim_end_matches("_nonzero"), bits, kind)?
|
||||
} else {
|
||||
@ -190,7 +192,7 @@ pub fn emulate_intrinsic(
|
||||
if overflowed {
|
||||
let layout = self.layout_of(substs.type_at(0))?;
|
||||
let r_val = r.to_scalar()?.to_bits(layout.size)?;
|
||||
return throw_err!(Intrinsic(
|
||||
return throw_err_unsup!(Intrinsic(
|
||||
format!("Overflowing shift by {} in {}", r_val, intrinsic_name),
|
||||
));
|
||||
}
|
||||
|
@ -251,6 +251,6 @@ fn ptr_to_int(
|
||||
_mem: &Memory<'mir, 'tcx, Self>,
|
||||
_ptr: Pointer<Self::PointerTag>,
|
||||
) -> InterpResult<'tcx, u64> {
|
||||
throw_err!(ReadPointerAsBytes)
|
||||
throw_err_unsup!(ReadPointerAsBytes)
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ pub fn as_instance(self) -> InterpResult<'tcx, Instance<'tcx>> {
|
||||
match self {
|
||||
FnVal::Instance(instance) =>
|
||||
Ok(instance),
|
||||
FnVal::Other(_) => throw_err!(MachineError(format!(
|
||||
FnVal::Other(_) => throw_err_unsup!(MachineError(format!(
|
||||
"Expected instance function pointer, got 'other' pointer"
|
||||
))),
|
||||
}
|
||||
@ -202,7 +202,7 @@ pub fn reallocate(
|
||||
kind: MemoryKind<M::MemoryKinds>,
|
||||
) -> InterpResult<'tcx, Pointer<M::PointerTag>> {
|
||||
if ptr.offset.bytes() != 0 {
|
||||
return throw_err!(ReallocateNonBasePtr);
|
||||
return throw_err_unsup!(ReallocateNonBasePtr);
|
||||
}
|
||||
|
||||
// For simplicities' sake, we implement reallocate as "alloc, copy, dealloc".
|
||||
@ -243,7 +243,7 @@ pub fn deallocate(
|
||||
trace!("deallocating: {}", ptr.alloc_id);
|
||||
|
||||
if ptr.offset.bytes() != 0 {
|
||||
return throw_err!(DeallocateNonBasePtr);
|
||||
return throw_err_unsup!(DeallocateNonBasePtr);
|
||||
}
|
||||
|
||||
let (alloc_kind, mut alloc) = match self.alloc_map.remove(&ptr.alloc_id) {
|
||||
@ -251,22 +251,22 @@ pub fn deallocate(
|
||||
None => {
|
||||
// Deallocating static memory -- always an error
|
||||
return match self.tcx.alloc_map.lock().get(ptr.alloc_id) {
|
||||
Some(GlobalAlloc::Function(..)) => throw_err!(DeallocatedWrongMemoryKind(
|
||||
Some(GlobalAlloc::Function(..)) => throw_err_unsup!(DeallocatedWrongMemoryKind(
|
||||
"function".to_string(),
|
||||
format!("{:?}", kind),
|
||||
)),
|
||||
Some(GlobalAlloc::Static(..)) |
|
||||
Some(GlobalAlloc::Memory(..)) => throw_err!(DeallocatedWrongMemoryKind(
|
||||
Some(GlobalAlloc::Memory(..)) => throw_err_unsup!(DeallocatedWrongMemoryKind(
|
||||
"static".to_string(),
|
||||
format!("{:?}", kind),
|
||||
)),
|
||||
None => throw_err!(DoubleFree)
|
||||
None => throw_err_unsup!(DoubleFree)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if alloc_kind != kind {
|
||||
return throw_err!(DeallocatedWrongMemoryKind(
|
||||
return throw_err_unsup!(DeallocatedWrongMemoryKind(
|
||||
format!("{:?}", alloc_kind),
|
||||
format!("{:?}", kind),
|
||||
));
|
||||
@ -274,7 +274,9 @@ pub fn deallocate(
|
||||
if let Some((size, align)) = old_size_and_align {
|
||||
if size.bytes() != alloc.bytes.len() as u64 || align != alloc.align {
|
||||
let bytes = Size::from_bytes(alloc.bytes.len() as u64);
|
||||
return throw_err!(IncorrectAllocationInformation(size, bytes, align, alloc.align));
|
||||
return throw_err_unsup!(
|
||||
IncorrectAllocationInformation(size, bytes, align, alloc.align)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,7 +321,7 @@ fn check_offset_align(offset: u64, align: Align) -> InterpResult<'static> {
|
||||
} else {
|
||||
// The biggest power of two through which `offset` is divisible.
|
||||
let offset_pow2 = 1 << offset.trailing_zeros();
|
||||
throw_err!(AlignmentCheckFailed {
|
||||
throw_err_unsup!(AlignmentCheckFailed {
|
||||
has: Align::from_bytes(offset_pow2).unwrap(),
|
||||
required: align,
|
||||
})
|
||||
@ -341,7 +343,7 @@ fn check_offset_align(offset: u64, align: Align) -> InterpResult<'static> {
|
||||
assert!(size.bytes() == 0);
|
||||
// Must be non-NULL and aligned.
|
||||
if bits == 0 {
|
||||
return throw_err!(InvalidNullPointerUsage);
|
||||
return throw_err_unsup!(InvalidNullPointerUsage);
|
||||
}
|
||||
check_offset_align(bits, align)?;
|
||||
None
|
||||
@ -362,7 +364,7 @@ fn check_offset_align(offset: u64, align: Align) -> InterpResult<'static> {
|
||||
// got picked we might be aligned even if this check fails.
|
||||
// We instead have to fall back to converting to an integer and checking
|
||||
// the "real" alignment.
|
||||
return throw_err!(AlignmentCheckFailed {
|
||||
return throw_err_unsup!(AlignmentCheckFailed {
|
||||
has: alloc_align,
|
||||
required: align,
|
||||
});
|
||||
@ -413,9 +415,9 @@ fn get_static_alloc(
|
||||
Some(GlobalAlloc::Memory(mem)) =>
|
||||
Cow::Borrowed(mem),
|
||||
Some(GlobalAlloc::Function(..)) =>
|
||||
return throw_err!(DerefFunctionPointer),
|
||||
return throw_err_unsup!(DerefFunctionPointer),
|
||||
None =>
|
||||
return throw_err!(DanglingPointerDeref),
|
||||
return throw_err_unsup!(DanglingPointerDeref),
|
||||
Some(GlobalAlloc::Static(def_id)) => {
|
||||
// We got a "lazy" static that has not been computed yet.
|
||||
if tcx.is_foreign_item(def_id) {
|
||||
@ -505,11 +507,11 @@ pub fn get_mut(
|
||||
// to give us a cheap reference.
|
||||
let alloc = Self::get_static_alloc(memory_extra, tcx, id)?;
|
||||
if alloc.mutability == Mutability::Immutable {
|
||||
return throw_err!(ModifiedConstantMemory);
|
||||
return throw_err_unsup!(ModifiedConstantMemory);
|
||||
}
|
||||
match M::STATIC_KIND {
|
||||
Some(kind) => Ok((MemoryKind::Machine(kind), alloc.into_owned())),
|
||||
None => throw_err!(ModifiedStatic),
|
||||
None => throw_err_unsup!(ModifiedStatic),
|
||||
}
|
||||
});
|
||||
// Unpack the error type manually because type inference doesn't
|
||||
@ -519,7 +521,7 @@ pub fn get_mut(
|
||||
Ok(a) => {
|
||||
let a = &mut a.1;
|
||||
if a.mutability == Mutability::Immutable {
|
||||
return throw_err!(ModifiedConstantMemory);
|
||||
return throw_err_unsup!(ModifiedConstantMemory);
|
||||
}
|
||||
Ok(a)
|
||||
}
|
||||
@ -548,7 +550,7 @@ pub fn get_size_and_align(
|
||||
if let Ok(_) = self.get_fn_alloc(id) {
|
||||
return if let AllocCheck::Dereferencable = liveness {
|
||||
// The caller requested no function pointers.
|
||||
throw_err!(DerefFunctionPointer)
|
||||
throw_err_unsup!(DerefFunctionPointer)
|
||||
} else {
|
||||
Ok((Size::ZERO, Align::from_bytes(1).unwrap()))
|
||||
};
|
||||
@ -579,7 +581,7 @@ pub fn get_size_and_align(
|
||||
.expect("deallocated pointers should all be recorded in \
|
||||
`dead_alloc_map`"))
|
||||
} else {
|
||||
throw_err!(DanglingPointerDeref)
|
||||
throw_err_unsup!(DanglingPointerDeref)
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -591,7 +593,7 @@ fn get_fn_alloc(&self, id: AllocId) -> InterpResult<'tcx, FnVal<'tcx, M::ExtraFn
|
||||
} else {
|
||||
match self.tcx.alloc_map.lock().get(id) {
|
||||
Some(GlobalAlloc::Function(instance)) => Ok(FnVal::Instance(instance)),
|
||||
_ => throw_err!(ExecuteMemory),
|
||||
_ => throw_err_unsup!(ExecuteMemory),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -602,7 +604,7 @@ pub fn get_fn(
|
||||
) -> InterpResult<'tcx, FnVal<'tcx, M::ExtraFnVal>> {
|
||||
let ptr = self.force_ptr(ptr)?; // We definitely need a pointer value.
|
||||
if ptr.offset.bytes() != 0 {
|
||||
return throw_err!(InvalidFunctionPointer);
|
||||
return throw_err_unsup!(InvalidFunctionPointer);
|
||||
}
|
||||
self.get_fn_alloc(ptr.alloc_id)
|
||||
}
|
||||
@ -837,7 +839,7 @@ pub fn copy_repeatedly(
|
||||
if (src.offset <= dest.offset && src.offset + size > dest.offset) ||
|
||||
(dest.offset <= src.offset && dest.offset + size > src.offset)
|
||||
{
|
||||
return throw_err!(Intrinsic(
|
||||
return throw_err_unsup!(Intrinsic(
|
||||
"copy_nonoverlapping called on overlapping ranges".to_string(),
|
||||
));
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ pub(super) fn eval_place_to_op(
|
||||
mir_place.iterate(|place_base, place_projection| {
|
||||
let mut op = match place_base {
|
||||
PlaceBase::Local(mir::RETURN_PLACE) =>
|
||||
return throw_err!(ReadFromReturnPointer),
|
||||
return throw_err_unsup!(ReadFromReturnPointer),
|
||||
PlaceBase::Local(local) => {
|
||||
// Do not use the layout passed in as argument if the base we are looking at
|
||||
// here is not the entire place.
|
||||
@ -610,7 +610,7 @@ pub fn read_discriminant(
|
||||
let bits_discr = match raw_discr.to_bits(discr_val.layout.size) {
|
||||
Ok(raw_discr) => raw_discr,
|
||||
Err(_) =>
|
||||
return throw_err!(InvalidDiscriminant(raw_discr.erase_tag())),
|
||||
return throw_err_unsup!(InvalidDiscriminant(raw_discr.erase_tag())),
|
||||
};
|
||||
let real_discr = if discr_val.layout.ty.is_signed() {
|
||||
// going from layout tag type to typeck discriminant type
|
||||
@ -637,7 +637,7 @@ pub fn read_discriminant(
|
||||
.find(|(_, var)| var.val == real_discr),
|
||||
_ => bug!("tagged layout for non-adt non-generator"),
|
||||
}.ok_or_else(
|
||||
|| err!(InvalidDiscriminant(raw_discr.erase_tag()))
|
||||
|| err_unsup!(InvalidDiscriminant(raw_discr.erase_tag()))
|
||||
)?;
|
||||
(real_discr, index.0)
|
||||
},
|
||||
@ -657,7 +657,9 @@ pub fn read_discriminant(
|
||||
let ptr_valid = niche_start == 0 && variants_start == variants_end &&
|
||||
!self.memory.ptr_may_be_null(ptr);
|
||||
if !ptr_valid {
|
||||
return throw_err!(InvalidDiscriminant(raw_discr.erase_tag().into()));
|
||||
return throw_err_unsup!(
|
||||
InvalidDiscriminant(raw_discr.erase_tag().into())
|
||||
);
|
||||
}
|
||||
(dataful_variant.as_u32() as u128, dataful_variant)
|
||||
},
|
||||
|
@ -155,7 +155,7 @@ fn binary_int_op(
|
||||
r,
|
||||
right_layout.ty
|
||||
);
|
||||
return throw_err!(Unimplemented(msg));
|
||||
return throw_err_unsup!(Unimplemented(msg));
|
||||
}
|
||||
|
||||
// Operations that need special treatment for signed integers
|
||||
@ -250,7 +250,7 @@ fn binary_int_op(
|
||||
r,
|
||||
right_layout.ty,
|
||||
);
|
||||
return throw_err!(Unimplemented(msg));
|
||||
return throw_err_unsup!(Unimplemented(msg));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -622,7 +622,7 @@ pub fn eval_place(
|
||||
.layout_of(self.monomorphize(self.frame().body.return_ty())?)?,
|
||||
}
|
||||
}
|
||||
None => return throw_err!(InvalidNullPointerUsage),
|
||||
None => return throw_err_unsup!(InvalidNullPointerUsage),
|
||||
},
|
||||
PlaceBase::Local(local) => PlaceTy {
|
||||
// This works even for dead/uninitialized locals; we check further when writing
|
||||
|
@ -121,7 +121,7 @@ fn statement(&mut self, stmt: &mir::Statement<'tcx>) -> InterpResult<'tcx> {
|
||||
// size of MIR constantly.
|
||||
Nop => {}
|
||||
|
||||
InlineAsm { .. } => return throw_err!(InlineAsm),
|
||||
InlineAsm { .. } => return throw_err_unsup!(InlineAsm),
|
||||
}
|
||||
|
||||
self.stack[frame_idx].stmt += 1;
|
||||
|
@ -89,7 +89,7 @@ pub(super) fn eval_terminator(
|
||||
},
|
||||
_ => {
|
||||
let msg = format!("can't handle callee of type {:?}", func.layout.ty);
|
||||
return throw_err!(Unimplemented(msg));
|
||||
return throw_err_unsup!(Unimplemented(msg));
|
||||
}
|
||||
};
|
||||
let args = self.eval_operands(args)?;
|
||||
@ -220,13 +220,15 @@ fn pass_argument(
|
||||
return Ok(());
|
||||
}
|
||||
let caller_arg = caller_arg.next()
|
||||
.ok_or_else(|| err!(FunctionArgCountMismatch)) ?;
|
||||
.ok_or_else(|| err_unsup!(FunctionArgCountMismatch)) ?;
|
||||
if rust_abi {
|
||||
debug_assert!(!caller_arg.layout.is_zst(), "ZSTs must have been already filtered out");
|
||||
}
|
||||
// Now, check
|
||||
if !Self::check_argument_compat(rust_abi, caller_arg.layout, callee_arg.layout) {
|
||||
return throw_err!(FunctionArgMismatch(caller_arg.layout.ty, callee_arg.layout.ty));
|
||||
return throw_err_unsup!(
|
||||
FunctionArgMismatch(caller_arg.layout.ty, callee_arg.layout.ty)
|
||||
);
|
||||
}
|
||||
// We allow some transmutes here
|
||||
self.copy_op_transmute(caller_arg, callee_arg)
|
||||
@ -254,7 +256,7 @@ fn eval_fn_call(
|
||||
match instance.def {
|
||||
ty::InstanceDef::Intrinsic(..) => {
|
||||
if caller_abi != Abi::RustIntrinsic {
|
||||
return throw_err!(FunctionAbiMismatch(caller_abi, Abi::RustIntrinsic));
|
||||
return throw_err_unsup!(FunctionAbiMismatch(caller_abi, Abi::RustIntrinsic));
|
||||
}
|
||||
// The intrinsic itself cannot diverge, so if we got here without a return
|
||||
// place... (can happen e.g., for transmute returning `!`)
|
||||
@ -295,7 +297,7 @@ fn eval_fn_call(
|
||||
abi,
|
||||
};
|
||||
if normalize_abi(caller_abi) != normalize_abi(callee_abi) {
|
||||
return throw_err!(FunctionAbiMismatch(caller_abi, callee_abi));
|
||||
return throw_err_unsup!(FunctionAbiMismatch(caller_abi, callee_abi));
|
||||
}
|
||||
}
|
||||
|
||||
@ -390,7 +392,7 @@ fn eval_fn_call(
|
||||
// Now we should have no more caller args
|
||||
if caller_iter.next().is_some() {
|
||||
trace!("Caller has passed too many args");
|
||||
return throw_err!(FunctionArgCountMismatch);
|
||||
return throw_err_unsup!(FunctionArgCountMismatch);
|
||||
}
|
||||
// Don't forget to check the return type!
|
||||
if let Some(caller_ret) = dest {
|
||||
@ -402,7 +404,7 @@ fn eval_fn_call(
|
||||
caller_ret.layout,
|
||||
callee_ret.layout,
|
||||
) {
|
||||
return throw_err!(
|
||||
return throw_err_unsup!(
|
||||
FunctionRetMismatch(caller_ret.layout.ty, callee_ret.layout.ty)
|
||||
);
|
||||
}
|
||||
@ -410,7 +412,7 @@ fn eval_fn_call(
|
||||
let local = mir::RETURN_PLACE;
|
||||
let ty = self.frame().body.local_decls[local].ty;
|
||||
if !self.tcx.is_ty_uninhabited_from_any_module(ty) {
|
||||
return throw_err!(FunctionRetMismatch(self.tcx.types.never, ty));
|
||||
return throw_err_unsup!(FunctionRetMismatch(self.tcx.types.never, ty));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
@ -22,7 +22,7 @@ macro_rules! validation_failure {
|
||||
} else {
|
||||
format!(" at {}", where_)
|
||||
};
|
||||
throw_err!(ValidationFailure(format!(
|
||||
throw_err_unsup!(ValidationFailure(format!(
|
||||
"encountered {}{}, but expected {}",
|
||||
$what, where_, $details,
|
||||
)))
|
||||
@ -34,7 +34,7 @@ macro_rules! validation_failure {
|
||||
} else {
|
||||
format!(" at {}", where_)
|
||||
};
|
||||
throw_err!(ValidationFailure(format!(
|
||||
throw_err_unsup!(ValidationFailure(format!(
|
||||
"encountered {}{}",
|
||||
$what, where_,
|
||||
)))
|
||||
|
Loading…
Reference in New Issue
Block a user