Skip to content

Commit 2c0bd79

Browse files
committed
Auto merge of #140256 - matthiaskrgr:rollup-8if58zf, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #136083 (Suggest {to,from}_ne_bytes for transmutations between arrays and integers, etc) - #138282 (Add `#[repr(u128)]`/`#[repr(i128)]` enums to `improper_ctypes_definitions`) - #139700 (Autodiff flags) - #140139 (rustc_target: Adjust RISC-V feature implication) - #140141 (Move zkVM constants into `sys::env_consts`) - #140150 (fix MAX_EXP and MIN_EXP docs) - #140172 (Make algebraic functions into `const fn` items.) - #140191 (Remove git repository from git config) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b35714c + e9d5a1a commit 2c0bd79

File tree

9 files changed

+8
-27
lines changed

9 files changed

+8
-27
lines changed

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"

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;

tests/pass/shims/x86/intrinsics-x86-gfni.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ unsafe fn load_m256i_word<T>(data: &[T], word_index: usize) -> __m256i {
368368
#[target_feature(enable = "avx512f")]
369369
unsafe fn load_m512i_word<T>(data: &[T], word_index: usize) -> __m512i {
370370
let byte_offset = word_index * 64 / size_of::<T>();
371-
let pointer = data.as_ptr().add(byte_offset) as *const i32;
371+
let pointer = data.as_ptr().add(byte_offset) as *const __m512i;
372372
_mm512_loadu_si512(black_box(pointer))
373373
}
374374

tests/pass/shims/x86/intrinsics-x86-sse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// We're testing x86 target specific features
22
//@only-target: x86_64 i686
3+
#![allow(unnecessary_transmutes)]
34

45
#[cfg(target_arch = "x86")]
56
use std::arch::x86::*;

0 commit comments

Comments
 (0)