@@ -52,15 +52,15 @@ impl Clone for Movable {
5252 Movable :: copy_from ( __src. as_pointer ( ) )
5353 }
5454}
55- #[ derive( DeepClone , Record , ByteRepr , VaArg , FnPtrArg , Default ) ]
55+ #[ derive( Clone , Record , ByteRepr , VaArg , FnPtrArg , Default ) ]
5656#[ byte_size( 48 ) ]
5757pub struct Holder {
5858 #[ offset( 0 ) ]
5959 #[ byte_size( 24 ) ]
60- pub xs : Value < Vec < i32 > > ,
60+ pub xs : Vec < i32 > ,
6161 #[ offset( 24 ) ]
6262 #[ byte_size( 24 ) ]
63- pub ys : Value < Vec < i32 > > ,
63+ pub ys : Vec < i32 > ,
6464}
6565pub fn main ( ) {
6666 __cpp2rust_init_globals ( ) ;
@@ -76,31 +76,31 @@ fn main_0() -> i32 {
7676 assert ! ( ( { ( * m. borrow( ) ) . x } == 0 ) ) ;
7777 assert ! ( ( { ( * m. borrow( ) ) . y } == 0 ) ) ;
7878 let h: Value < Holder > = Rc :: new ( RefCell :: new ( Holder {
79- xs : Rc :: new ( RefCell :: new ( vec ! [ 1 , 2 , 3 ] ) ) ,
80- ys : Rc :: new ( RefCell :: new ( vec ! [ 4 , 5 ] ) ) ,
79+ xs : Vec :: from ( [ 1 , 2 , 3 ] ) ,
80+ ys : Vec :: from ( [ 4 , 5 ] ) ,
8181 } ) ) ;
8282 let __decomp_3: Value < Holder > =
8383 Rc :: new ( RefCell :: new ( ( { HolderImpl :: extract ( & h. as_pointer ( ) ) } ) ) ) ;
84- assert ! ( ( ( * { ( * __decomp_3. borrow( ) ) . xs. clone ( ) } . borrow ( ) ) . len( ) == 3_usize ) ) ;
85- assert ! ( ( ( * { ( * __decomp_3. borrow( ) ) . ys. clone ( ) } . borrow ( ) ) . len( ) == 2_usize ) ) ;
84+ assert ! ( ( ( * __decomp_3. borrow( ) ) . xs. len( ) == 3_usize ) ) ;
85+ assert ! ( ( ( * __decomp_3. borrow( ) ) . ys. len( ) == 2_usize ) ) ;
8686 assert ! (
8787 ( ( elem!(
88- ( { ( * __decomp_3. borrow ( ) ) . xs . as_pointer( ) } as Ptr <i32 >) ,
88+ ( field_ref! ( __decomp_3. as_pointer ( ) , xs ) . as_pointer( ) as Ptr <i32 >) ,
8989 2_usize
9090 )
9191 . read( ) )
9292 == 3 )
9393 ) ;
9494 assert ! (
9595 ( ( elem!(
96- ( { ( * __decomp_3. borrow ( ) ) . ys . as_pointer( ) } as Ptr <i32 >) ,
96+ ( field_ref! ( __decomp_3. as_pointer ( ) , ys ) . as_pointer( ) as Ptr <i32 >) ,
9797 0_usize
9898 )
9999 . read( ) )
100100 == 4 )
101101 ) ;
102- assert ! ( ( * { ( * h. borrow( ) ) . xs. clone ( ) } . borrow ( ) ) . is_empty( ) ) ;
103- assert ! ( ( * { ( * h. borrow( ) ) . ys. clone ( ) } . borrow ( ) ) . is_empty( ) ) ;
102+ assert ! ( ( * h. borrow( ) ) . xs. is_empty( ) ) ;
103+ assert ! ( ( * h. borrow( ) ) . ys. is_empty( ) ) ;
104104 return 0 ;
105105}
106106pub trait HolderImpl {
@@ -109,12 +109,8 @@ pub trait HolderImpl {
109109impl HolderImpl for Ptr < Holder > {
110110 fn extract ( & self ) -> Holder {
111111 return Holder {
112- xs : Rc :: new ( RefCell :: new ( std:: mem:: take (
113- & mut ( * ( * self ) . with ( |__s| __s. xs . clone ( ) ) . borrow_mut ( ) ) ,
114- ) ) ) ,
115- ys : Rc :: new ( RefCell :: new ( std:: mem:: take (
116- & mut ( * ( * self ) . with ( |__s| __s. ys . clone ( ) ) . borrow_mut ( ) ) ,
117- ) ) ) ,
112+ xs : field ! ( ( * self ) , xs) . with_mut ( std:: mem:: take) ,
113+ ys : field ! ( ( * self ) , ys) . with_mut ( std:: mem:: take) ,
118114 } ;
119115 }
120116}
0 commit comments