Auto merge of #2539 - oli-obk:rustup, r=oli-obk

Rustup

for https://github.com/rust-lang/rust/issues/101649
This commit is contained in:
bors 2022-09-10 13:56:56 +00:00
commit beed5eddb0
3 changed files with 8 additions and 11 deletions

View File

@ -1 +1 @@
e7c7aa7288559f8e5ea7ce3543ff946b09783628
5197c96c49fc3b7de3ce9a31f7cc62d2cbd1f70c

View File

@ -75,17 +75,14 @@ fn emulate_intrinsic_by_name(
match intrinsic_name {
// Miri overwriting CTFE intrinsics.
"ptr_guaranteed_eq" => {
"ptr_guaranteed_cmp" => {
let [left, right] = check_arg_count(args)?;
let left = this.read_immediate(left)?;
let right = this.read_immediate(right)?;
this.binop_ignore_overflow(mir::BinOp::Eq, &left, &right, dest)?;
}
"ptr_guaranteed_ne" => {
let [left, right] = check_arg_count(args)?;
let left = this.read_immediate(left)?;
let right = this.read_immediate(right)?;
this.binop_ignore_overflow(mir::BinOp::Ne, &left, &right, dest)?;
let (val, _overflowed, _ty) =
this.overflowing_binary_op(mir::BinOp::Eq, &left, &right)?;
// We're type punning a bool as an u8 here.
this.write_scalar(val, dest)?;
}
"const_allocate" => {
// For now, for compatibility with the run-time implementation of this, we just return null.

View File

@ -135,8 +135,8 @@ fn main() {
// CTFE-specific equality tests, need to also work at runtime.
let addr = &13 as *const i32;
let addr2 = (addr as usize).wrapping_add(usize::MAX).wrapping_add(1);
assert!(addr.guaranteed_eq(addr2 as *const _));
assert!(addr.guaranteed_ne(0x100 as *const _));
assert_eq!(addr.guaranteed_eq(addr2 as *const _), Some(true));
assert_eq!(addr.guaranteed_ne(0x100 as *const _), Some(true));
wide_ptr_ops();
metadata_vtable();