@@ -111,7 +111,7 @@ impl Default for Holder {
111111 }
112112 }
113113}
114- #[ derive( Record , ByteRepr , FnPtrArg , MoveCtor , Default ) ]
114+ #[ derive( Record , ByteRepr , VaArg , FnPtrArg , MoveCtor , Default ) ]
115115#[ byte_size( 4 ) ]
116116pub struct Box_int_ {
117117 #[ offset( 0 ) ]
@@ -122,26 +122,32 @@ impl Box_int_ {
122122 let v: Value < i32 > = Rc :: new ( RefCell :: new ( v) ) ;
123123 Self { val : ( * v. borrow ( ) ) }
124124 }
125+ pub fn copy_from ( o : Ptr < Box_int_ > ) -> Self {
126+ Self {
127+ val : o. with ( |__s| __s. val ) ,
128+ }
129+ }
125130 pub fn move_from ( _a0 : Ptr < Box_int_ > ) -> Self {
126131 Self {
127132 val : { ( * _a0. upgrade ( ) . deref ( ) ) . val } ,
128133 }
129134 }
130135}
131- #[ derive( Record , ByteRepr , FnPtrArg , MoveCtor , Default ) ]
136+ impl Clone for Box_int_ {
137+ fn clone ( & self ) -> Self {
138+ let __src: Value < Box_int_ > = Rc :: new ( RefCell :: new ( Box_int_ {
139+ val : self . val . clone ( ) ,
140+ } ) ) ;
141+ Box_int_ :: copy_from ( __src. as_pointer ( ) )
142+ }
143+ }
144+ #[ derive( Clone , Record , ByteRepr , VaArg , FnPtrArg , Default ) ]
132145#[ byte_size( 4 ) ]
133146pub struct Owner {
134147 #[ offset( 0 ) ]
135148 #[ byte_size( 4 ) ]
136149 pub box_ : Box_int_ ,
137150}
138- impl Owner {
139- pub fn move_from ( _a0 : Ptr < Owner > ) -> Self {
140- Self {
141- box_ : Box_int_ :: move_from ( { field_ptr ! ( _a0, box_) } ) ,
142- }
143- }
144- }
145151#[ derive( Record , ByteRepr , VaArg , FnPtrArg , Default ) ]
146152#[ byte_size( 4 ) ]
147153pub struct OutOfLine {
@@ -235,7 +241,7 @@ fn main_0() -> i32 {
235241 let o: Value < Owner > = Rc :: new ( RefCell :: new ( Owner {
236242 box_ : Box_int_ :: new ( { 3 } ) ,
237243 } ) ) ;
238- let mut o2: Owner = Owner :: move_from ( { o . as_pointer ( ) } ) ;
244+ let mut o2: Owner = ( * o . borrow ( ) ) . clone ( ) ;
239245 assert ! ( ( o2. box_. val == 3 ) ) ;
240246 let ol1: Value < OutOfLine > = Rc :: new ( RefCell :: new ( OutOfLine :: new ( { 5 } ) ) ) ;
241247 let mut ol2: OutOfLine = OutOfLine :: copy_from ( { ol1. as_pointer ( ) } ) ;
0 commit comments