Skip to content

Commit 7352e0f

Browse files
authored
Merge pull request #4292 from rust-lang/rustup-2025-04-25
Automatic Rustup
2 parents 4df7078 + 7780ec5 commit 7352e0f

File tree

12 files changed

+10
-30
lines changed

12 files changed

+10
-30
lines changed

bench-cargo-miri/mse/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn read_i16(buffer: &[u8], index: usize) -> i16 {
1313
const SIZE: usize = size_of::<i16>();
1414
let mut bytes: [u8; SIZE] = [0u8; SIZE];
1515
bytes.copy_from_slice(&buffer[(index * SIZE)..(index * SIZE + SIZE)]);
16-
unsafe { std::mem::transmute(bytes) }
16+
i16::from_ne_bytes(bytes)
1717
}
1818

1919
fn mse(samples: usize, frame_buf: &[i16], buf_ref: &[u8]) -> f64 {

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7f695232a80fa1833e2282f2577c5e1ff066bf39
1+
847e3ee6b0e614937eee4e6d8f61094411eadcc0

src/intrinsics/mod.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -391,32 +391,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
391391
this.write_scalar(res, dest)?;
392392
}
393393

394-
#[rustfmt::skip]
395-
| "fadd_algebraic"
396-
| "fsub_algebraic"
397-
| "fmul_algebraic"
398-
| "fdiv_algebraic"
399-
| "frem_algebraic"
400-
=> {
401-
let [a, b] = check_intrinsic_arg_count(args)?;
402-
let a = this.read_immediate(a)?;
403-
let b = this.read_immediate(b)?;
404-
let op = match intrinsic_name {
405-
"fadd_algebraic" => mir::BinOp::Add,
406-
"fsub_algebraic" => mir::BinOp::Sub,
407-
"fmul_algebraic" => mir::BinOp::Mul,
408-
"fdiv_algebraic" => mir::BinOp::Div,
409-
"frem_algebraic" => mir::BinOp::Rem,
410-
_ => bug!(),
411-
};
412-
let res = this.binary_op(op, &a, &b)?;
413-
// `binary_op` already called `generate_nan` if needed.
414-
// Apply a relative error of 4ULP to simulate non-deterministic precision loss
415-
// due to optimizations.
416-
let res = apply_random_float_error_to_imm(this, res, 2 /* log2(4) */)?;
417-
this.write_immediate(*res, dest)?;
418-
}
419-
420394
#[rustfmt::skip]
421395
| "fadd_fast"
422396
| "fsub_fast"

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![feature(rustc_private)]
22
#![feature(cfg_match)]
3-
#![feature(cell_update)]
43
#![feature(float_gamma)]
54
#![feature(float_erf)]
65
#![feature(map_try_insert)]

tests/fail/validity/invalid_bool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(unnecessary_transmutes)]
12
fn main() {
23
let _b = unsafe { std::mem::transmute::<u8, bool>(2) }; //~ ERROR: expected a boolean
34
}

tests/fail/validity/invalid_bool_op.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Make sure we find these even with many checks disabled.
33
//@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
44

5+
#![allow(unnecessary_transmutes)]
56
fn main() {
67
let b = unsafe { std::mem::transmute::<u8, bool>(2) };
78
let _x = b == std::hint::black_box(true); //~ ERROR: interpreting an invalid 8-bit value as a bool

tests/fail/validity/invalid_char.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(unnecessary_transmutes)]
12
fn main() {
23
assert!(std::char::from_u32(-1_i32 as u32).is_none());
34
let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } {

tests/fail/validity/invalid_char_op.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Make sure we find these even with many checks disabled.
33
//@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
44

5+
#![allow(unnecessary_transmutes)]
56
fn main() {
67
let c = 0xFFFFFFu32;
78
assert!(std::char::from_u32(c).is_none());

tests/pass/float.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#![feature(f16)]
77
#![allow(arithmetic_overflow)]
88
#![allow(internal_features)]
9+
#![allow(unnecessary_transmutes)]
910

1011
use std::any::type_name;
1112
use std::cmp::min;

tests/pass/issues/issue-miri-184.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(unnecessary_transmutes)]
12
pub fn main() {
23
let bytes: [u8; 8] = unsafe { ::std::mem::transmute(0u64) };
34
let _val: &[u8] = &bytes;

0 commit comments

Comments
 (0)