mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
Auto merge of #1260 - RalfJung:unreachable, r=RalfJung
Implement unreachable intrinsic Fixes https://github.com/rust-lang/miri/issues/1254
This commit is contained in:
+1
-2
@@ -106,8 +106,7 @@ pub fn new(rng: StdRng, stacked_borrows: bool, tracked_pointer_tag: Option<PtrId
|
||||
pub fn init_extern_statics<'tcx, 'mir>(
|
||||
this: &mut MiriEvalContext<'mir, 'tcx>,
|
||||
) -> InterpResult<'tcx> {
|
||||
let target_os = this.tcx.sess.target.target.target_os.as_str();
|
||||
match target_os {
|
||||
match this.tcx.sess.target.target.target_os.as_str() {
|
||||
"linux" => {
|
||||
// "__cxa_thread_atexit_impl"
|
||||
// This should be all-zero, pointer-sized.
|
||||
|
||||
+1
-1
@@ -802,7 +802,7 @@ fn mkdir(
|
||||
|
||||
this.check_no_isolation("mkdir")?;
|
||||
|
||||
let _mode = if this.tcx.sess.target.target.target_os.as_str() == "macos" {
|
||||
let _mode = if this.tcx.sess.target.target.target_os == "macos" {
|
||||
u32::from(this.read_scalar(mode_op)?.not_undef()?.to_u16()?)
|
||||
} else {
|
||||
this.read_scalar(mode_op)?.to_u32()?
|
||||
|
||||
@@ -36,6 +36,7 @@ fn call_intrinsic(
|
||||
let (dest, ret) = match ret {
|
||||
None => match intrinsic_name {
|
||||
"miri_start_panic" => return this.handle_miri_start_panic(args, unwind),
|
||||
"unreachable" => throw_ub!(Unreachable),
|
||||
_ => throw_unsup_format!("unimplemented (diverging) intrinsic: {}", intrinsic_name),
|
||||
},
|
||||
Some(p) => p,
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// error-pattern: entering unreachable code
|
||||
fn main() {
|
||||
unsafe { std::hint::unreachable_unchecked() }
|
||||
}
|
||||
Reference in New Issue
Block a user