Skip to content

Commit

Permalink
Auto merge of #2539 - oli-obk:rustup, r=oli-obk
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Sep 10, 2022
2 parents ef3f649 + e91db9f commit beed5ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e7c7aa7288559f8e5ea7ce3543ff946b09783628
5197c96c49fc3b7de3ce9a31f7cc62d2cbd1f70c
13 changes: 5 additions & 8 deletions src/shims/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx

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.
Expand Down
4 changes: 2 additions & 2 deletions tests/pass/pointers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit beed5ed

Please sign in to comment.