From 4e4569cf4b5f044b030f9a3de61e4167395c5145 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 25 Dec 2018 13:26:40 +0100 Subject: [PATCH 1/3] fix build and tests with latest nightly --- src/operator.rs | 6 ++++-- tests/run-pass/async-fn.rs | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/operator.rs b/src/operator.rs index e1ccdf9199..abc1c98a1d 100644 --- a/src/operator.rs +++ b/src/operator.rs @@ -161,12 +161,14 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, ' if bits == 0 { // Test if the ptr is in-bounds. Then it cannot be NULL. // Even dangling pointers cannot be NULL. - if self.memory().check_bounds_ptr_maybe_dead(ptr).is_ok() { + if self.memory().check_bounds_ptr(ptr, InboundsCheck::MaybeDead).is_ok() { return Ok(false); } } - let (alloc_size, alloc_align) = self.memory().get_size_and_align(ptr.alloc_id); + let (alloc_size, alloc_align) = self.memory() + .get_size_and_align(ptr.alloc_id, InboundsCheck::MaybeDead) + .expect("determining size+align of dead ptr cannot fail"); // Case II: Alignment gives it away if ptr.offset.bytes() % alloc_align.bytes() == 0 { diff --git a/tests/run-pass/async-fn.rs b/tests/run-pass/async-fn.rs index 7c32b026df..9094a9fd3a 100644 --- a/tests/run-pass/async-fn.rs +++ b/tests/run-pass/async-fn.rs @@ -2,7 +2,6 @@ async_await, await_macro, futures_api, - pin, )] use std::{future::Future, pin::Pin, task::Poll}; From 5a8f9e58f72a8b8ad284475c8992c664c548f776 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 25 Dec 2018 13:29:38 +0100 Subject: [PATCH 2/3] properly compare unequal function pointers --- src/operator.rs | 4 ++-- tests/run-pass/function_pointers.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/operator.rs b/src/operator.rs index abc1c98a1d..cc803c4ea9 100644 --- a/src/operator.rs +++ b/src/operator.rs @@ -145,8 +145,8 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, ' // Dead allocations in miri cannot overlap with live allocations, but // on read hardware this can easily happen. Thus for comparisons we require // both pointers to be live. - self.memory().get(left.alloc_id)?.check_bounds_ptr(left)?; - self.memory().get(right.alloc_id)?.check_bounds_ptr(right)?; + self.memory().check_bounds_ptr(left, InboundsCheck::Live)?; + self.memory().check_bounds_ptr(right, InboundsCheck::Live)?; // Two in-bounds pointers, we can compare across allocations left == right } diff --git a/tests/run-pass/function_pointers.rs b/tests/run-pass/function_pointers.rs index 6819a2af3e..cc888630d3 100644 --- a/tests/run-pass/function_pointers.rs +++ b/tests/run-pass/function_pointers.rs @@ -44,4 +44,5 @@ fn main() { let g = f as fn() -> i32; assert!(return_fn_ptr(g) == g); assert!(return_fn_ptr(g) as unsafe fn() -> i32 == g as fn() -> i32 as unsafe fn() -> i32); + assert!(return_fn_ptr(f) != f); } From 55107d5dd34d73af891f117ace2c25bb8ac33680 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 26 Dec 2018 11:01:22 +0100 Subject: [PATCH 3/3] bump Rust version --- rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-version b/rust-version index ea30c4512e..a2909dd328 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -nightly-2018-12-24 +nightly-2018-12-26