mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 13:06:28 +03:00
Use the machine stop error instead of abusing other error kinds
This commit is contained in:
@@ -33,6 +33,7 @@ pub struct MiriConfig {
|
||||
/// Details of premature program termination.
|
||||
pub enum TerminationInfo {
|
||||
Exit(i64),
|
||||
PoppedTrackedPointerTag(Item),
|
||||
Abort,
|
||||
}
|
||||
|
||||
@@ -218,6 +219,8 @@ pub fn eval_main<'tcx>(tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig) ->
|
||||
.expect("invalid MachineStop payload");
|
||||
match info {
|
||||
TerminationInfo::Exit(code) => return Some(*code),
|
||||
TerminationInfo::PoppedTrackedPointerTag(item) =>
|
||||
format!("popped tracked tag for item {:?}", item),
|
||||
TerminationInfo::Abort =>
|
||||
format!("the evaluated program aborted execution")
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
use rustc::mir::RetagKind;
|
||||
|
||||
use crate::{
|
||||
InterpResult, HelpersEvalContextExt,
|
||||
InterpResult, HelpersEvalContextExt, TerminationInfo,
|
||||
MemoryKind, MiriMemoryKind, RangeMap, AllocId, Pointer, Immediate, ImmTy, PlaceTy, MPlaceTy,
|
||||
};
|
||||
|
||||
@@ -273,7 +273,7 @@ fn find_first_write_incompatible(&self, granting: usize) -> usize {
|
||||
fn check_protector(item: &Item, tag: Option<Tag>, global: &GlobalState) -> InterpResult<'tcx> {
|
||||
if let Tag::Tagged(id) = item.tag {
|
||||
if Some(id) == global.tracked_pointer_tag {
|
||||
throw_unsup!(Unsupported(format!("disabling item {:?} for tag {:?}", item, tag)));
|
||||
throw_machine_stop!(TerminationInfo::PoppedTrackedPointerTag(item.clone()));
|
||||
}
|
||||
}
|
||||
if let Some(call) = item.protector {
|
||||
|
||||
Reference in New Issue
Block a user