diff --git a/rust-version b/rust-version index c710735735c..b70ab6fdd46 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -35a061724802377a21fc6dac1ebcbb9b8d1f558a +7fe022f5aa32bbbb33c3a58755729d6667a461a9 diff --git a/src/machine.rs b/src/machine.rs index 3e45f77d54c..2c9bfe803ad 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -545,11 +545,6 @@ fn enforce_number_init(_ecx: &MiriEvalContext<'mir, 'tcx>) -> bool { true } - #[inline(always)] - fn enforce_number_no_provenance(_ecx: &MiriEvalContext<'mir, 'tcx>) -> bool { - true - } - #[inline(always)] fn enforce_abi(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool { ecx.machine.enforce_abi @@ -753,14 +748,6 @@ fn ptr_from_addr_cast( intptrcast::GlobalStateInner::ptr_from_addr_cast(ecx, addr) } - #[inline(always)] - fn ptr_from_addr_transmute( - ecx: &MiriEvalContext<'mir, 'tcx>, - addr: u64, - ) -> Pointer> { - intptrcast::GlobalStateInner::ptr_from_addr_transmute(ecx, addr) - } - fn expose_ptr( ecx: &mut InterpCx<'mir, 'tcx, Self>, ptr: Pointer, diff --git a/src/operator.rs b/src/operator.rs index 758e747d278..679686b4005 100644 --- a/src/operator.rs +++ b/src/operator.rs @@ -57,7 +57,7 @@ fn binary_ptr_op( Offset => { assert!(left.layout.ty.is_unsafe_ptr()); - let ptr = self.scalar_to_ptr(left.to_scalar()?)?; + let ptr = left.to_scalar()?.to_pointer(self)?; let offset = right.to_scalar()?.to_machine_isize(self)?; let pointee_ty = @@ -71,7 +71,7 @@ fn binary_ptr_op( Add | Sub | BitOr | BitAnd | BitXor => { assert!(left.layout.ty.is_unsafe_ptr()); assert!(right.layout.ty.is_unsafe_ptr()); - let ptr = self.scalar_to_ptr(left.to_scalar()?)?; + let ptr = left.to_scalar()?.to_pointer(self)?; // We do the actual operation with usize-typed scalars. let left = ImmTy::from_uint(ptr.addr().bytes(), self.machine.layouts.usize); let right = ImmTy::from_uint( diff --git a/src/shims/intrinsics/simd.rs b/src/shims/intrinsics/simd.rs index 96e97d79358..d467c3c509f 100644 --- a/src/shims/intrinsics/simd.rs +++ b/src/shims/intrinsics/simd.rs @@ -201,7 +201,7 @@ enum Op { this.saturating_arith(mir_op, &left, &right)? } Op::WrappingOffset => { - let ptr = this.scalar_to_ptr(left.to_scalar()?)?; + let ptr = left.to_scalar()?.to_pointer(this)?; let offset_count = right.to_scalar()?.to_machine_isize(this)?; let pointee_ty = left.layout.ty.builtin_deref(true).unwrap().ty; diff --git a/src/shims/panic.rs b/src/shims/panic.rs index 362b929eabf..687c84308a9 100644 --- a/src/shims/panic.rs +++ b/src/shims/panic.rs @@ -26,7 +26,7 @@ #[derive(Debug)] pub struct CatchUnwindData<'tcx> { /// The `catch_fn` callback to call in case of a panic. - catch_fn: Scalar, + catch_fn: Pointer>, /// The `data` argument for that callback. data: Scalar, /// The return place from the original call to `try`. @@ -86,7 +86,7 @@ fn handle_try( let [try_fn, data, catch_fn] = check_arg_count(args)?; let try_fn = this.read_pointer(try_fn)?; let data = this.read_scalar(data)?.check_init()?; - let catch_fn = this.read_scalar(catch_fn)?.check_init()?; + let catch_fn = this.read_pointer(catch_fn)?; // Now we make a function call, and pass `data` as first and only argument. let f_instance = this.get_ptr_fn(try_fn)?.as_instance()?; @@ -140,8 +140,7 @@ fn handle_stack_pop_unwind( let payload = this.active_thread_mut().panic_payload.take().unwrap(); // Push the `catch_fn` stackframe. - let f_instance = - this.get_ptr_fn(this.scalar_to_ptr(catch_unwind.catch_fn)?)?.as_instance()?; + let f_instance = this.get_ptr_fn(catch_unwind.catch_fn)?.as_instance()?; trace!("catch_fn: {:?}", f_instance); this.call_function( f_instance, diff --git a/src/shims/tls.rs b/src/shims/tls.rs index 13af447f76c..2f0fb41b9e9 100644 --- a/src/shims/tls.rs +++ b/src/shims/tls.rs @@ -241,15 +241,10 @@ fn schedule_windows_tls_dtors(&mut self) -> InterpResult<'tcx> { // (that would be basically https://github.com/rust-lang/miri/issues/450), // we specifically look up the static in libstd that we know is placed // in that section. - let thread_callback = this.eval_path_scalar(&[ - "std", - "sys", - "windows", - "thread_local_key", - "p_thread_callback", - ])?; - let thread_callback = - this.get_ptr_fn(this.scalar_to_ptr(thread_callback)?)?.as_instance()?; + let thread_callback = this + .eval_path_scalar(&["std", "sys", "windows", "thread_local_key", "p_thread_callback"])? + .to_pointer(this)?; + let thread_callback = this.get_ptr_fn(thread_callback)?.as_instance()?; // The signature of this function is `unsafe extern "system" fn(h: c::LPVOID, dwReason: c::DWORD, pv: c::LPVOID)`. let reason = this.eval_path_scalar(&["std", "sys", "windows", "c", "DLL_THREAD_DETACH"])?; diff --git a/src/shims/unix/linux/sync.rs b/src/shims/unix/linux/sync.rs index a11aa8ed849..59de1049874 100644 --- a/src/shims/unix/linux/sync.rs +++ b/src/shims/unix/linux/sync.rs @@ -121,7 +121,7 @@ pub fn futex<'tcx>( // The API requires `addr` to be a 4-byte aligned pointer, and will // use the 4 bytes at the given address as an (atomic) i32. this.check_ptr_access_align( - this.scalar_to_ptr(addr_scalar)?, + addr_scalar.to_pointer(this)?, Size::from_bytes(4), Align::from_bytes(4).unwrap(), CheckInAllocMsg::MemoryAccessTest,