@@ -43,6 +43,54 @@ impl Default for Pointers {
4343 }
4444 }
4545}
46+ #[ derive( DeepClone , Record , ByteRepr , VaArg , FnPtrArg ) ]
47+ #[ byte_size( 440 ) ]
48+ pub struct SmallArrays {
49+ #[ offset( 0 ) ]
50+ #[ byte_size( 128 ) ]
51+ pub a : Value < Box < [ i32 ] > > ,
52+ #[ offset( 128 ) ]
53+ #[ byte_size( 8 ) ]
54+ pub f : FnPtr < fn ( i32 ) -> i32 > ,
55+ #[ offset( 136 ) ]
56+ #[ byte_size( 16 ) ]
57+ pub fs : Value < Box < [ FnPtr < fn ( i32 ) -> i32 > ] > > ,
58+ #[ offset( 152 ) ]
59+ #[ byte_size( 288 ) ]
60+ pub p : Value < Box < [ Pointers ] > > ,
61+ }
62+ impl Default for SmallArrays {
63+ fn default ( ) -> Self {
64+ SmallArrays {
65+ a : Rc :: new ( RefCell :: new ( ( 0 ..32 ) . map ( |_| 0_i32 ) . collect :: < Box < [ i32 ] > > ( ) ) ) ,
66+ f : FnPtr :: < fn ( i32 ) -> i32 > :: null ( ) ,
67+ fs : Rc :: new ( RefCell :: new (
68+ ( 0 ..2 )
69+ . map ( |_| FnPtr :: < fn ( i32 ) -> i32 > :: null ( ) )
70+ . collect :: < Box < [ FnPtr < fn ( i32 ) -> i32 > ] > > ( ) ,
71+ ) ) ,
72+ p : Rc :: new ( RefCell :: new (
73+ ( 0 ..2 )
74+ . map ( |_| <Pointers >:: default ( ) )
75+ . collect :: < Box < [ Pointers ] > > ( ) ,
76+ ) ) ,
77+ }
78+ }
79+ }
80+ #[ derive( DeepClone , Record , ByteRepr , VaArg , FnPtrArg ) ]
81+ #[ byte_size( 132 ) ]
82+ pub struct BigArray {
83+ #[ offset( 0 ) ]
84+ #[ byte_size( 132 ) ]
85+ pub a : Value < Box < [ i32 ] > > ,
86+ }
87+ impl Default for BigArray {
88+ fn default ( ) -> Self {
89+ BigArray {
90+ a : Rc :: new ( RefCell :: new ( ( 0 ..33 ) . map ( |_| 0_i32 ) . collect :: < Box < [ i32 ] > > ( ) ) ) ,
91+ }
92+ }
93+ }
4694pub fn main ( ) {
4795 __cpp2rust_init_globals ( ) ;
4896 std:: process:: exit ( main_0 ( ) ) ;
@@ -54,6 +102,18 @@ fn main_0() -> i32 {
54102 . collect :: < Box < [ Pointers ] > > ( ) ,
55103 ) ) ) ;
56104 ( * default_pointers. borrow ( ) ) . delete ( ) ;
105+ let small: Value < Ptr < SmallArrays > > = Rc :: new ( RefCell :: new ( Ptr :: alloc_array (
106+ ( 0 ..2_usize )
107+ . map ( |_| <SmallArrays >:: default ( ) )
108+ . collect :: < Box < [ SmallArrays ] > > ( ) ,
109+ ) ) ) ;
110+ ( * small. borrow ( ) ) . delete ( ) ;
111+ let big: Value < Ptr < BigArray > > = Rc :: new ( RefCell :: new ( Ptr :: alloc_array (
112+ ( 0 ..2_usize )
113+ . map ( |_| <BigArray >:: default ( ) )
114+ . collect :: < Box < [ BigArray ] > > ( ) ,
115+ ) ) ) ;
116+ ( * big. borrow ( ) ) . delete ( ) ;
57117 return 0 ;
58118}
59119pub fn __cpp2rust_init_globals ( ) { }
0 commit comments