Skip to content

Commit 625c081

Browse files
authored
Merge pull request #20761 from rust-lang/rustc-pull
Rustc pull update
2 parents 1382aea + 39263e4 commit 625c081

File tree

6 files changed

+16
-48
lines changed

6 files changed

+16
-48
lines changed

src/intrinsics/math.rs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use rand::Rng;
21
use rustc_apfloat::{self, Float, FloatConvert, Round};
32
use rustc_middle::mir;
43
use rustc_middle::ty::{self, FloatTy};
@@ -39,46 +38,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3938
"sqrtf64" => sqrt::<rustc_apfloat::ieee::Double>(this, args, dest)?,
4039
"sqrtf128" => sqrt::<rustc_apfloat::ieee::Quad>(this, args, dest)?,
4140

42-
"fmaf32" => {
43-
let [a, b, c] = check_intrinsic_arg_count(args)?;
44-
let a = this.read_scalar(a)?.to_f32()?;
45-
let b = this.read_scalar(b)?.to_f32()?;
46-
let c = this.read_scalar(c)?.to_f32()?;
47-
let res = a.mul_add(b, c).value;
48-
let res = this.adjust_nan(res, &[a, b, c]);
49-
this.write_scalar(res, dest)?;
50-
}
51-
"fmaf64" => {
52-
let [a, b, c] = check_intrinsic_arg_count(args)?;
53-
let a = this.read_scalar(a)?.to_f64()?;
54-
let b = this.read_scalar(b)?.to_f64()?;
55-
let c = this.read_scalar(c)?.to_f64()?;
56-
let res = a.mul_add(b, c).value;
57-
let res = this.adjust_nan(res, &[a, b, c]);
58-
this.write_scalar(res, dest)?;
59-
}
60-
61-
"fmuladdf32" => {
62-
let [a, b, c] = check_intrinsic_arg_count(args)?;
63-
let a = this.read_scalar(a)?.to_f32()?;
64-
let b = this.read_scalar(b)?.to_f32()?;
65-
let c = this.read_scalar(c)?.to_f32()?;
66-
let fuse: bool = this.machine.float_nondet && this.machine.rng.get_mut().random();
67-
let res = if fuse { a.mul_add(b, c).value } else { ((a * b).value + c).value };
68-
let res = this.adjust_nan(res, &[a, b, c]);
69-
this.write_scalar(res, dest)?;
70-
}
71-
"fmuladdf64" => {
72-
let [a, b, c] = check_intrinsic_arg_count(args)?;
73-
let a = this.read_scalar(a)?.to_f64()?;
74-
let b = this.read_scalar(b)?.to_f64()?;
75-
let c = this.read_scalar(c)?.to_f64()?;
76-
let fuse: bool = this.machine.float_nondet && this.machine.rng.get_mut().random();
77-
let res = if fuse { a.mul_add(b, c).value } else { ((a * b).value + c).value };
78-
let res = this.adjust_nan(res, &[a, b, c]);
79-
this.write_scalar(res, dest)?;
80-
}
81-
8241
#[rustfmt::skip]
8342
| "fadd_fast"
8443
| "fsub_fast"

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![cfg_attr(bootstrap, feature(strict_overflow_ops))]
21
#![feature(abort_unwind)]
32
#![feature(cfg_select)]
43
#![feature(rustc_private)]

src/machine.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,11 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
12931293
ecx.equal_float_min_max(a, b)
12941294
}
12951295

1296+
#[inline(always)]
1297+
fn float_fuse_mul_add(ecx: &mut InterpCx<'tcx, Self>) -> bool {
1298+
ecx.machine.float_nondet && ecx.machine.rng.get_mut().random()
1299+
}
1300+
12961301
#[inline(always)]
12971302
fn ub_checks(ecx: &InterpCx<'tcx, Self>) -> InterpResult<'tcx, bool> {
12981303
interp_ok(ecx.tcx.sess.ub_checks())

tests/panic/mir-validation.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
// and we don't even get a regular panic; rustc aborts with a different exit code instead.
1010
//@ignore-host: windows
1111

12-
// FIXME: this tests a crash in rustc. For stage1, rustc is built with the downloaded standard
13-
// library which doesn't yet print the thread ID. Normalization can be removed at the stage bump.
14-
// For the grep: cfg(bootstrap)
15-
//@normalize-stderr-test: "thread 'rustc' panicked" -> "thread 'rustc' ($$TID) panicked"
16-
1712
#![feature(custom_mir, core_intrinsics)]
1813
use core::intrinsics::mir::*;
1914

tests/pass/both_borrows/smallvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl<T, const N: usize> RawSmallVec<T, N> {
2525
}
2626

2727
const fn as_mut_ptr_inline(&mut self) -> *mut T {
28-
(unsafe { &raw mut self.inline }) as *mut T
28+
&raw mut self.inline as *mut T
2929
}
3030

3131
const unsafe fn as_mut_ptr_heap(&mut self) -> *mut T {

tests/pass/vec.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ fn miri_issue_2759() {
169169
input.replace_range(0..0, "0");
170170
}
171171

172+
/// This was skirting the edge of UB, let's make sure it remains on the sound side.
173+
/// Context: <https://github.com/rust-lang/rust/pull/141032>.
174+
fn extract_if() {
175+
let mut v = vec![Box::new(0u64), Box::new(1u64)];
176+
for item in v.extract_if(.., |x| **x == 0) {
177+
drop(item);
178+
}
179+
}
180+
172181
fn main() {
173182
assert_eq!(vec_reallocate().len(), 5);
174183

@@ -199,4 +208,5 @@ fn main() {
199208
swap_remove();
200209
reverse();
201210
miri_issue_2759();
211+
extract_if();
202212
}

0 commit comments

Comments
 (0)