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 22//@[tree]compile-flags: -Zmiri-tree-borrows
33#![ feature( unsized_tuple_coercion) ]
44#![ feature( unsized_fn_params) ]
5+ #![ feature( custom_mir, core_intrinsics) ]
56
67use std:: mem;
78
@@ -32,7 +33,30 @@ fn unsized_params() {
3233 f3 ( * p) ;
3334}
3435
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+
3558fn main ( ) {
3659 unsized_tuple ( ) ;
3760 unsized_params ( ) ;
61+ unsized_field_projection ( ) ;
3862}
You can’t perform that action at this time.
0 commit comments