@@ -71,25 +71,26 @@ fn main_0() -> i32 {
7171 assert ! ( ( ( { call_nttp_1( 5 , ) } ) == 4 ) ) ;
7272 assert ! ( ( ( { call_nttp_2( 5 , ) } ) == 50 ) ) ;
7373 assert ! ( ( ( { call_nttp_3( 5 , ) } ) == 105 ) ) ;
74- let sum: Value < FnPtr < fn ( i32 ) -> i32 > > = Rc :: new ( RefCell :: new ( FnPtr :: < fn ( i32 ) -> i32 > :: new (
75- |n : i32 | -> i32 {
76- {
77- let __args: Value < Box < [ VaArg ] > > = Rc :: new ( RefCell :: new ( __args. into ( ) ) ) ;
78- let n: Value < i32 > = Rc :: new ( RefCell :: new ( n) ) ;
79- let ap: Value < Ptr < VaArg > > = Rc :: new ( RefCell :: new ( Ptr :: < VaArg > :: default ( ) ) ) ;
80- ( * ap. borrow_mut ( ) ) = __args. as_pointer ( ) ;
81- let s: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
82- let mut i: i32 = 0 ;
83- ' loop_: while ( i < ( * n. borrow ( ) ) ) {
84- ( * s. borrow_mut ( ) ) += ( * ap. borrow_mut ( ) ) . arg :: < i32 > ( ) ;
85- i. postfix_inc ( ) ;
74+ let sum: Value < FnPtr < fn ( i32 , Box < [ VaArg ] > ) -> i32 > > =
75+ Rc :: new ( RefCell :: new ( FnPtr :: < fn ( i32 , Box < [ VaArg ] > ) -> i32 > :: new (
76+ |n : i32 , __args : Box < [ VaArg ] > | -> i32 {
77+ {
78+ let __args: Value < Box < [ VaArg ] > > = Rc :: new ( RefCell :: new ( __args. into ( ) ) ) ;
79+ let n: Value < i32 > = Rc :: new ( RefCell :: new ( n) ) ;
80+ let ap: Value < Ptr < VaArg > > = Rc :: new ( RefCell :: new ( Ptr :: < VaArg > :: default ( ) ) ) ;
81+ ( * ap. borrow_mut ( ) ) = __args. as_pointer ( ) ;
82+ let s: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
83+ let mut i: i32 = 0 ;
84+ ' loop_: while ( i < ( * n. borrow ( ) ) ) {
85+ ( * s. borrow_mut ( ) ) += ( * ap. borrow_mut ( ) ) . arg :: < i32 > ( ) ;
86+ i. postfix_inc ( ) ;
87+ }
88+ return ( * s. borrow ( ) ) ;
8689 }
87- return ( * s. borrow ( ) ) ;
88- }
89- } ,
90- ) ) ) ;
91- assert ! ( ( ( { ( * sum. borrow( ) ) . call( 2 , & [ ( 5 ) . into( ) , ( 5 ) . into( ) , ] ) } ) == 10 ) ) ;
92- assert ! ( ( ( { ( * sum. borrow( ) ) . call( 3 , & [ ( 1 ) . into( ) , ( 2 ) . into( ) , ( 3 ) . into( ) , ] ) } ) == 6 ) ) ;
90+ } ,
91+ ) ) ) ;
92+ assert ! ( ( ( { ( * sum. borrow( ) ) . call( 2 , Box :: new( [ ( 5 ) . into( ) , ( 5 ) . into( ) , ] ) ) } ) == 10 ) ) ;
93+ assert ! ( ( ( { ( * sum. borrow( ) ) . call( 3 , Box :: new( [ ( 1 ) . into( ) , ( 2 ) . into( ) , ( 3 ) . into( ) , ] ) ) } ) == 6 ) ) ;
9394 return 0 ;
9495}
9596pub fn __cpp2rust_init_globals ( ) { }
0 commit comments