Skip to content

Commit f1730d1

Browse files
authored
Merge pull request #757 from RalfJung/test-ice
test for no-validation-only failure
2 parents 09daf11 + c06134c commit f1730d1

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
627486af15d222bcba336b12ea92a05237cc9ab1
1+
021a5033098ff0e3f7126acc7ac35149d325f16d

tests/run-pass/without-validation.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// When we notice something breaks only without validation, we add a test here.
2+
// compile-flags: -Zmiri-disable-validation
3+
use std::cell::*;
4+
5+
fn refcell_unsize() {
6+
let cell: RefCell<[i32; 3]> = RefCell::new([1, 2, 3]);
7+
{
8+
let mut cellref: RefMut<'_, [i32; 3]> = cell.borrow_mut();
9+
cellref[0] = 4;
10+
let mut coerced: RefMut<'_, [i32]> = cellref;
11+
coerced[2] = 5;
12+
}
13+
{
14+
let comp: &mut [i32] = &mut [4, 2, 5];
15+
let cellref: Ref<'_, [i32; 3]> = cell.borrow();
16+
assert_eq!(&*cellref, comp);
17+
let coerced: Ref<'_, [i32]> = cellref;
18+
assert_eq!(&*coerced, comp);
19+
}
20+
}
21+
22+
fn main() {
23+
refcell_unsize();
24+
}

0 commit comments

Comments
 (0)