File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,12 @@ pub fn take_ulong_1(mut x: u64) -> u64 {
1515pub fn sub_signed_2 ( mut a : isize , mut b : isize ) -> isize {
1616 return ( a - b) ;
1717}
18+ pub fn next_size_3 ( x : Ptr < usize > ) -> usize {
19+ return ( x. read ( ) ) . wrapping_add ( 1_usize ) ;
20+ }
21+ pub fn next_ulong_4 ( x : Ptr < u64 > ) -> u64 {
22+ return ( x. read ( ) ) . wrapping_add ( 1_u64 ) ;
23+ }
1824pub fn main ( ) {
1925 __cpp2rust_init_globals ( ) ;
2026 std:: process:: exit ( main_0 ( ) ) ;
@@ -202,6 +208,23 @@ fn main_0() -> i32 {
202208 Rc :: new ( RefCell :: new ( 1 . try_into ( ) . expect ( "failed conversion" ) ) ) ,
203209 ) ) ) ;
204210 assert ! ( ( ( * ( * pr. borrow( ) ) . 0 . borrow( ) ) == 21_u64 ) ) ;
211+ let ref_ul: Value < u64 > = Rc :: new ( RefCell :: new ( 5_u64 ) ) ;
212+ let ref_sz: Value < usize > = Rc :: new ( RefCell :: new ( 7_usize ) ) ;
213+ assert ! (
214+ ( ( {
215+ let _x: Value <usize > = Rc :: new( RefCell :: new( ( ( * ref_ul. borrow( ) ) as usize ) ) ) ;
216+ next_size_3( _x. as_pointer( ) )
217+ } ) == 6_usize )
218+ ) ;
219+ assert ! (
220+ ( ( {
221+ let _x: Value <u64 > = Rc :: new( RefCell :: new( ( ( * ref_sz. borrow( ) ) as u64 ) ) ) ;
222+ next_ulong_4( _x. as_pointer( ) )
223+ } ) == 8_u64 )
224+ ) ;
225+ assert ! ( ( ( { next_size_3( ref_sz. as_pointer( ) , ) } ) == 8_usize ) ) ;
226+ assert ! ( ( ( * ref_ul. borrow( ) ) == 5_u64 ) ) ;
227+ assert ! ( ( ( * ref_sz. borrow( ) ) == 7_usize ) ) ;
205228 return 0 ;
206229}
207230pub fn __cpp2rust_init_globals ( ) { }
Original file line number Diff line number Diff line change @@ -15,6 +15,12 @@ pub unsafe fn take_ulong_1(mut x: u64) -> u64 {
1515pub unsafe fn sub_signed_2 ( mut a : isize , mut b : isize ) -> isize {
1616 return ( ( a) - ( b) ) ;
1717}
18+ pub unsafe fn next_size_3 ( x : * const usize ) -> usize {
19+ return ( * x) . wrapping_add ( 1_usize ) ;
20+ }
21+ pub unsafe fn next_ulong_4 ( x : * const u64 ) -> u64 {
22+ return ( * x) . wrapping_add ( 1_u64 ) ;
23+ }
1824pub fn main ( ) {
1925 unsafe {
2026 __cpp2rust_init_globals ( ) ;
@@ -188,6 +194,23 @@ unsafe fn main_0() -> i32 {
188194 assert ! ( ( ( mins[ ( 2 ) as usize ] ) == ( 2_usize ) ) ) ;
189195 let mut pr: ( u64 , i32 ) = ( ( sz as u64 ) . into ( ) , 1 . into ( ) ) ;
190196 assert ! ( ( ( pr. 0 ) == ( 21_u64 ) ) ) ;
197+ let mut ref_ul: u64 = 5_u64 ;
198+ let mut ref_sz: usize = 7_usize ;
199+ assert ! (
200+ ( ( unsafe {
201+ let mut _x: usize = ( ref_ul as usize ) ;
202+ next_size_3( & mut _x)
203+ } ) == ( 6_usize ) )
204+ ) ;
205+ assert ! (
206+ ( ( unsafe {
207+ let mut _x: u64 = ( ref_sz as u64 ) ;
208+ next_ulong_4( & mut _x)
209+ } ) == ( 8_u64 ) )
210+ ) ;
211+ assert ! ( ( ( unsafe { next_size_3( & ref_sz, ) } ) == ( 8_usize ) ) ) ;
212+ assert ! ( ( ( ref_ul) == ( 5_u64 ) ) ) ;
213+ assert ! ( ( ( ref_sz) == ( 7_usize ) ) ) ;
191214 return 0 ;
192215}
193216pub unsafe fn __cpp2rust_init_globals ( ) { }
You can’t perform that action at this time.
0 commit comments