Skip to content

Commit

Permalink
force pointers before reborrowing; fixes cargo miri test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 6, 2019
1 parent 81bed5d commit 3227434
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
.map(|(size, _)| size)
.unwrap_or_else(|| place.layout.size)
);
let place = this.normalize_mplace_ptr(place)?;
// Store how far we proceeded into the place so far. Everything to the left of
// this offset has already been handled, in the sense that the frozen parts
// have had `action` called on them.
Expand Down
1 change: 1 addition & 0 deletions src/stacked_borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
// Nothing to do for ZSTs.
return Ok(*val);
}
let place = this.force_mplace_ptr(place)?;

// Compute new borrow.
let new_tag = match kind {
Expand Down
3 changes: 1 addition & 2 deletions test-cargo-miri/run-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ def test_cargo_miri_run():
)

def test_cargo_miri_test():
# FIXME: enable validation again, once that no longer conflicts with intptrcast
test("cargo miri test",
cargo_miri("test") + ["--", "-Zmiri-seed=feed", "-Zmiri-disable-validation"],
cargo_miri("test") + ["--", "-Zmiri-seed=feed"],
"test.stdout.ref", "test.stderr.ref"
)
test("cargo miri test (with filter)",
Expand Down
5 changes: 5 additions & 0 deletions tests/run-pass/unique-send.rs → tests/run-pass/mpsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ pub fn main() {
tx.send(box 100).unwrap();
let v = rx.recv().unwrap();
assert_eq!(v, box 100);

tx.send(box 101).unwrap();
tx.send(box 102).unwrap();
assert_eq!(rx.recv().unwrap(), box 101);
assert_eq!(rx.recv().unwrap(), box 102);
}

0 comments on commit 3227434

Please sign in to comment.