Auto merge of #2392 - RalfJung:rustup, r=RalfJung

rustup
This commit is contained in:
bors 2022-07-19 19:45:27 +00:00
commit a7e51ac99e
7 changed files with 10 additions and 11 deletions

View File

@ -1 +1 @@
4603ac31b0655793a82f110f544dc1c6abc57bb7
29c5a028b0c92aa5da6a8eb6d6585a389fcf1035

View File

@ -258,7 +258,7 @@ fn call_function(
// Push frame.
let mir = this.load_mir(f.def, None)?;
let dest = match dest {
Some(dest) => *dest,
Some(dest) => dest.clone(),
None => MPlaceTy::fake_alloc_zst(this.layout_of(mir.return_ty())?).into(),
};
this.push_stack_frame(f, mir, &dest, stack_pop)?;

View File

@ -224,7 +224,7 @@ fn emulate_intrinsic_by_name(
"frem_fast" => mir::BinOp::Rem,
_ => bug!(),
};
let float_finite = |x: ImmTy<'tcx, _>| -> InterpResult<'tcx, bool> {
let float_finite = |x: &ImmTy<'tcx, _>| -> InterpResult<'tcx, bool> {
Ok(match x.layout.ty.kind() {
ty::Float(FloatTy::F32) => x.to_scalar()?.to_f32()?.is_finite(),
ty::Float(FloatTy::F64) => x.to_scalar()?.to_f64()?.is_finite(),
@ -234,7 +234,7 @@ fn emulate_intrinsic_by_name(
),
})
};
match (float_finite(a)?, float_finite(b)?) {
match (float_finite(&a)?, float_finite(&b)?) {
(false, false) => throw_ub_format!(
"`{intrinsic_name}` intrinsic called with non-finite value as both parameters",
),

View File

@ -108,7 +108,7 @@ fn handle_try(
// when we pop this frame.
if this.tcx.sess.panic_strategy() == PanicStrategy::Unwind {
this.frame_mut().extra.catch_unwind =
Some(CatchUnwindData { catch_fn, data, dest: *dest, ret });
Some(CatchUnwindData { catch_fn, data, dest: dest.clone(), ret });
}
Ok(())

View File

@ -188,8 +188,8 @@ pub fn futex<'tcx>(
this.write_scalar(Scalar::from_machine_isize(0, this), dest)?;
// Register a timeout callback if a timeout was specified.
// This callback will override the return value when the timeout triggers.
let dest = *dest;
if let Some(timeout_time) = timeout_time {
let dest = dest.clone();
this.register_timeout_callback(
thread,
timeout_time,

View File

@ -828,9 +828,8 @@ fn pthread_cond_timedwait(
// We return success for now and override it in the timeout callback.
this.write_scalar(Scalar::from_i32(0), dest)?;
let dest = *dest;
// Register the timeout callback.
let dest = dest.clone();
this.register_timeout_callback(
active_thread,
timeout_time,

View File

@ -985,7 +985,7 @@ fn retag_reference(
// See https://github.com/rust-lang/unsafe-code-guidelines/issues/276.
let size = match size {
Some(size) => size,
None => return Ok(*val),
None => return Ok(val.clone()),
};
// Compute new borrow.
@ -1116,13 +1116,13 @@ fn visit_value(&mut self, place: &PlaceTy<'tcx, Tag>) -> InterpResult<'tcx> {
/// explicit. Also see <https://github.com/rust-lang/rust/issues/71117>.
fn retag_return_place(&mut self) -> InterpResult<'tcx> {
let this = self.eval_context_mut();
let return_place = this.frame_mut().return_place;
let return_place = &this.frame().return_place;
if return_place.layout.is_zst() {
// There may not be any memory here, nothing to do.
return Ok(());
}
// We need this to be in-memory to use tagged pointers.
let return_place = this.force_allocation(&return_place)?;
let return_place = this.force_allocation(&return_place.clone())?;
// We have to turn the place into a pointer to use the existing code.
// (The pointer type does not matter, so we use a raw pointer.)