File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 2
2
//@[tree]compile-flags: -Zmiri-tree-borrows
3
3
#![ feature( unsized_tuple_coercion) ]
4
4
#![ feature( unsized_fn_params) ]
5
+ #![ feature( custom_mir, core_intrinsics) ]
5
6
6
7
use std:: mem;
7
8
@@ -32,7 +33,30 @@ fn unsized_params() {
32
33
f3 ( * p) ;
33
34
}
34
35
36
+ fn unsized_field_projection ( ) {
37
+ use std:: intrinsics:: mir:: * ;
38
+
39
+ pub struct S < T : ?Sized > ( T ) ;
40
+
41
+ #[ custom_mir( dialect = "runtime" , phase = "optimized" ) ]
42
+ fn f ( x : S < [ u8 ] > ) {
43
+ mir ! {
44
+ {
45
+ let idx = 0 ;
46
+ // Project to an unsized field of an unsized local.
47
+ x. 0 [ idx] = 0 ;
48
+ let _val = x. 0 [ idx] ;
49
+ Return ( )
50
+ }
51
+ }
52
+ }
53
+
54
+ let x: Box < S < [ u8 ] > > = Box :: new ( S ( [ 0 ] ) ) ;
55
+ f ( * x) ;
56
+ }
57
+
35
58
fn main ( ) {
36
59
unsized_tuple ( ) ;
37
60
unsized_params ( ) ;
61
+ unsized_field_projection ( ) ;
38
62
}
You can’t perform that action at this time.
0 commit comments