File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1
- 627486af15d222bcba336b12ea92a05237cc9ab1
1
+ 021a5033098ff0e3f7126acc7ac35149d325f16d
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments