diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index 00f90800794..b8686754fa7 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -244,7 +244,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra> Allocation { 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 @@ impl<'tcx, Tag: Copy, Extra> Allocation { if self.relocations(cx, ptr, size).is_empty() { Ok(()) } else { - throw_err!(ReadPointerAsBytes) + throw_err_unsup!(ReadPointerAsBytes) } } @@ -516,7 +516,7 @@ impl<'tcx, Tag, Extra> Allocation { 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( diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 183298ee3f1..7108f69d39e 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -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>, diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 6e8e56a1b11..bc72050de18 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -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)* diff --git a/src/librustc/mir/interpret/pointer.rs b/src/librustc/mir/interpret/pointer.rs index 27a41bba4c1..17f963609f6 100644 --- a/src/librustc/mir/interpret/pointer.rs +++ b/src/librustc/mir/interpret/pointer.rs @@ -196,7 +196,7 @@ impl<'tcx, Tag> Pointer { 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(()) } diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs index 9379054bdfc..01db0e48e21 100644 --- a/src/librustc/mir/interpret/value.rs +++ b/src/librustc/mir/interpret/value.rs @@ -360,7 +360,7 @@ impl<'tcx, Tag> Scalar { Scalar::check_data(data, size); Ok(data) } - Scalar::Ptr(_) => throw_err!(ReadPointerAsBytes), + Scalar::Ptr(_) => throw_err_unsup!(ReadPointerAsBytes), } } @@ -373,8 +373,8 @@ impl<'tcx, Tag> Scalar { #[inline] pub fn to_ptr(self) -> InterpResult<'tcx, Pointer> { 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 @@ impl<'tcx, Tag> Scalar { 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 @@ impl<'tcx, Tag> Scalar { 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 @@ impl<'tcx, Tag> ScalarMaybeUndef { pub fn not_undef(self) -> InterpResult<'static, Scalar> { 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))), } } diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 786e2e71ec6..423449bc95d 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -352,7 +352,9 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir, 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 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir, _tcx: TyCtxt<'tcx>, _def_id: DefId, ) -> InterpResult<'tcx, Cow<'tcx, Allocation>> { - throw_err!(ReadForeignStatic) + throw_err_unsup!(ReadForeignStatic) } #[inline(always)] diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index fb0ad26d566..94f3148aaaf 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -199,7 +199,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { }, // 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))), } } diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 61ebcb58b91..61ee60fd3d5 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -135,7 +135,7 @@ pub enum LocalValue { impl<'tcx, Tag: Copy + 'static> LocalState<'tcx, Tag> { pub fn access(&self) -> InterpResult<'tcx, Operand> { 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 @@ impl<'tcx, Tag: Copy + 'static> LocalState<'tcx, Tag> { &mut self, ) -> InterpResult<'tcx, Result<&mut LocalValue, MemPlace>> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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)), } diff --git a/src/librustc_mir/interpret/intern.rs b/src/librustc_mir/interpret/intern.rs index a47cea9a70a..4539a1c7e1d 100644 --- a/src/librustc_mir/interpret/intern.rs +++ b/src/librustc_mir/interpret/intern.rs @@ -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()) ) } diff --git a/src/librustc_mir/interpret/intrinsics.rs b/src/librustc_mir/interpret/intrinsics.rs index d571d90e896..687265c983f 100644 --- a/src/librustc_mir/interpret/intrinsics.rs +++ b/src/librustc_mir/interpret/intrinsics.rs @@ -104,7 +104,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { }; 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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), )); } diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 5fc43c7712c..3f3d4376d29 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -251,6 +251,6 @@ pub trait Machine<'mir, 'tcx>: Sized { _mem: &Memory<'mir, 'tcx, Self>, _ptr: Pointer, ) -> InterpResult<'tcx, u64> { - throw_err!(ReadPointerAsBytes) + throw_err_unsup!(ReadPointerAsBytes) } } diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index ee5607c4938..8c43fb3dc40 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -66,7 +66,7 @@ impl<'tcx, Other> FnVal<'tcx, Other> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { kind: MemoryKind, ) -> InterpResult<'tcx, Pointer> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { } 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { // 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { // 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { .expect("deallocated pointers should all be recorded in \ `dead_alloc_map`")) } else { - throw_err!(DanglingPointerDeref) + throw_err_unsup!(DanglingPointerDeref) }, } } @@ -591,7 +593,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { } 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { ) -> 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { 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(), )); } diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 346dd83f1d5..8c443c9579f 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -461,7 +461,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { .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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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) }, diff --git a/src/librustc_mir/interpret/operator.rs b/src/librustc_mir/interpret/operator.rs index 5aea423e388..334cf09ba12 100644 --- a/src/librustc_mir/interpret/operator.rs +++ b/src/librustc_mir/interpret/operator.rs @@ -155,7 +155,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { r, right_layout.ty, ); - return throw_err!(Unimplemented(msg)); + return throw_err_unsup!(Unimplemented(msg)); } }; diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 4349c99a619..b385862490a 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -622,7 +622,7 @@ where .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 diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs index 3aa0144fa8f..de798ecee73 100644 --- a/src/librustc_mir/interpret/step.rs +++ b/src/librustc_mir/interpret/step.rs @@ -121,7 +121,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // size of MIR constantly. Nop => {} - InlineAsm { .. } => return throw_err!(InlineAsm), + InlineAsm { .. } => return throw_err_unsup!(InlineAsm), } self.stack[frame_idx].stmt += 1; diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index 53992201081..f1c91058b71 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -89,7 +89,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { }, _ => { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { 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(()) diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index 511ebfd023c..df6fb7a7c63 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -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_, )))