diff --git a/rust-version b/rust-version index dce708705b3..1c3f12298f8 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -dd67187965e136bff1ed05e035293441c60f0790 +660326e9791d5caf3186b14521498c2584a494ab diff --git a/src/shims/intrinsics.rs b/src/shims/intrinsics.rs index 6837d45158d..7f437332d93 100644 --- a/src/shims/intrinsics.rs +++ b/src/shims/intrinsics.rs @@ -4,7 +4,7 @@ use std::convert::TryFrom; use rustc::mir; use rustc::mir::interpret::{InterpResult, PointerArithmetic}; use rustc::ty; -use rustc::ty::layout::{self, Align, LayoutOf, Size}; +use rustc::ty::layout::{Align, LayoutOf, Size}; use rustc_apfloat::Float; use rustc_span::source_map::Span; @@ -384,37 +384,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx this.write_immediate(*b, dest)?; } - "init" => { - // Check fast path: we don't want to force an allocation in case the destination is a simple value, - // but we also do not want to create a new allocation with 0s and then copy that over. - // FIXME: We do not properly validate in case of ZSTs and when doing it in memory! - // However, this only affects direct calls of the intrinsic; calls to the stable - // functions wrapping them do get their validation. - // FIXME: should we check that the destination pointer is aligned even for ZSTs? - if !dest.layout.is_zst() { - match dest.layout.abi { - layout::Abi::Scalar(ref s) => { - let x = Scalar::from_int(0, s.value.size(this)); - this.write_scalar(x, dest)?; - } - layout::Abi::ScalarPair(ref s1, ref s2) => { - let x = Scalar::from_int(0, s1.value.size(this)); - let y = Scalar::from_int(0, s2.value.size(this)); - this.write_immediate(Immediate::ScalarPair(x.into(), y.into()), dest)?; - } - _ => { - // Do it in memory - let mplace = this.force_allocation(dest)?; - assert!(!mplace.layout.is_unsized()); - this.memory.write_bytes( - mplace.ptr, - iter::repeat(0u8).take(dest.layout.size.bytes() as usize), - )?; - } - } - } - } - "pref_align_of" => { let ty = substs.type_at(0); let layout = this.layout_of(ty)?; @@ -518,39 +487,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx this.write_scalar(Scalar::from_uint(align.bytes(), ptr_size), dest)?; } - "uninit" => { - // Check fast path: we don't want to force an allocation in case the destination is a simple value, - // but we also do not want to create a new allocation with 0s and then copy that over. - // FIXME: We do not properly validate in case of ZSTs and when doing it in memory! - // However, this only affects direct calls of the intrinsic; calls to the stable - // functions wrapping them do get their validation. - // FIXME: should we check alignment for ZSTs? - if !dest.layout.is_zst() { - match dest.layout.abi { - layout::Abi::Scalar(..) => { - let x = ScalarMaybeUndef::Undef; - this.write_immediate(Immediate::Scalar(x), dest)?; - } - layout::Abi::ScalarPair(..) => { - let x = ScalarMaybeUndef::Undef; - this.write_immediate(Immediate::ScalarPair(x, x), dest)?; - } - _ => { - // Do it in memory - let mplace = this.force_allocation(dest)?; - assert!(!mplace.layout.is_unsized()); - let ptr = mplace.ptr.assert_ptr(); - // We know the return place is in-bounds - this.memory.get_raw_mut(ptr.alloc_id)?.mark_definedness( - ptr, - dest.layout.size, - false, - ); - } - } - } - } - "write_bytes" => { let ty = substs.type_at(0); let ty_layout = this.layout_of(ty)?;