Skip to content

test for no-validation-only failure #757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
627486af15d222bcba336b12ea92a05237cc9ab1
021a5033098ff0e3f7126acc7ac35149d325f16d
24 changes: 24 additions & 0 deletions tests/run-pass/without-validation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// When we notice something breaks only without validation, we add a test here.
// compile-flags: -Zmiri-disable-validation
use std::cell::*;

fn refcell_unsize() {
let cell: RefCell<[i32; 3]> = RefCell::new([1, 2, 3]);
{
let mut cellref: RefMut<'_, [i32; 3]> = cell.borrow_mut();
cellref[0] = 4;
let mut coerced: RefMut<'_, [i32]> = cellref;
coerced[2] = 5;
}
{
let comp: &mut [i32] = &mut [4, 2, 5];
let cellref: Ref<'_, [i32; 3]> = cell.borrow();
assert_eq!(&*cellref, comp);
let coerced: Ref<'_, [i32]> = cellref;
assert_eq!(&*coerced, comp);
}
}

fn main() {
refcell_unsize();
}