mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 03:03:40 +00:00
miri engine: fix treatment of abort intrinsic
This commit is contained in:
parent
54b7d21f59
commit
e9c96570d6
@ -84,14 +84,15 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||||||
let substs = instance.substs;
|
let substs = instance.substs;
|
||||||
let intrinsic_name = self.tcx.item_name(instance.def_id());
|
let intrinsic_name = self.tcx.item_name(instance.def_id());
|
||||||
|
|
||||||
// We currently do not handle any intrinsics that are *allowed* to diverge,
|
// First handle intrinsics without return place.
|
||||||
// but `transmute` could lack a return place in case of UB.
|
|
||||||
let (dest, ret) = match ret {
|
let (dest, ret) = match ret {
|
||||||
Some(p) => p,
|
|
||||||
None => match intrinsic_name {
|
None => match intrinsic_name {
|
||||||
sym::transmute => throw_ub!(Unreachable),
|
sym::transmute => throw_ub_format!("transmuting to uninhabited type"),
|
||||||
|
sym::abort => M::abort(self)?,
|
||||||
|
// Unsupported diverging intrinsic.
|
||||||
_ => return Ok(false),
|
_ => return Ok(false),
|
||||||
},
|
},
|
||||||
|
Some(p) => p,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Keep the patterns in this match ordered the same as the list in
|
// Keep the patterns in this match ordered the same as the list in
|
||||||
@ -103,10 +104,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||||||
self.write_scalar(location.ptr, dest)?;
|
self.write_scalar(location.ptr, dest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
sym::abort => {
|
|
||||||
M::abort(self)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
sym::min_align_of
|
sym::min_align_of
|
||||||
| sym::pref_align_of
|
| sym::pref_align_of
|
||||||
| sym::needs_drop
|
| sym::needs_drop
|
||||||
|
Loading…
Reference in New Issue
Block a user