@@ -12,23 +12,29 @@ pub unsafe fn foo_0(mut x: i32) -> i32 {
1212pub unsafe fn foo_1 ( mut x : f64 ) -> f64 {
1313 return x;
1414}
15- pub unsafe fn bar_2 ( mut p : * mut i32 , mut flag : bool ) -> * mut i32 {
15+ pub unsafe fn pick_2 ( ) -> i32 {
16+ return 0 ;
17+ }
18+ pub unsafe fn pick_3 ( ) -> i32 {
19+ return 1 ;
20+ }
21+ pub unsafe fn bar_4 ( mut p : * mut i32 , mut flag : bool ) -> * mut i32 {
1622 return if flag { p } else { std:: ptr:: null_mut ( ) } ;
1723}
18- pub unsafe fn bar_3 ( mut p : * mut f64 , mut flag : bool ) -> * mut f64 {
24+ pub unsafe fn bar_5 ( mut p : * mut f64 , mut flag : bool ) -> * mut f64 {
1925 return if flag { p } else { std:: ptr:: null_mut ( ) } ;
2026}
21- pub unsafe fn func_4 ( mut x1 : i32 , mut x2 : i32 , mut x3 : i32 ) -> i32 {
27+ pub unsafe fn func_6 ( mut x1 : i32 , mut x2 : i32 , mut x3 : i32 ) -> i32 {
2228 return ( ( ( x1) + ( x2) ) + ( x3) ) ;
2329}
24- pub unsafe fn func_5 ( mut x1 : f64 , mut x2 : i32 , mut x3 : f64 ) -> i32 {
30+ pub unsafe fn func_7 ( mut x1 : f64 , mut x2 : i32 , mut x3 : f64 ) -> i32 {
2531 return ( ( ( ( x1) + ( x2 as f64 ) ) + ( x3) ) as i32 ) ;
2632}
27- pub static mut half_6 : std:: cell:: LazyCell < i32 > =
33+ pub static mut half_8 : std:: cell:: LazyCell < i32 > =
2834 std:: cell:: LazyCell :: new ( || unsafe { ( ( 1 ) / ( 2 ) ) } ) ;
29- pub static mut half_7 : std:: cell:: LazyCell < f64 > =
35+ pub static mut half_9 : std:: cell:: LazyCell < f64 > =
3036 std:: cell:: LazyCell :: new ( || unsafe { ( ( 1_f64 ) / ( 2_f64 ) ) } ) ;
31- pub static mut half_8 : std:: cell:: LazyCell < * mut i32 > =
37+ pub static mut half_10 : std:: cell:: LazyCell < * mut i32 > =
3238 std:: cell:: LazyCell :: new ( || unsafe { std:: ptr:: null_mut ( ) } ) ;
3339pub fn main ( ) {
3440 unsafe {
@@ -41,24 +47,26 @@ unsafe fn main_0() -> i32 {
4147 let mut y: f64 = ( x as f64 ) ;
4248 assert ! (
4349 ( ( ( ( ( ( ( ( unsafe { foo_0( x, ) } ) as f64 ) + ( unsafe { foo_1( y, ) } ) )
44- + ( ( * ( unsafe { bar_2 ( ( & mut x as * mut i32 ) , true , ) } ) ) as f64 ) )
45- + ( * ( unsafe { bar_3 ( ( & mut y as * mut f64 ) , true , ) } ) ) )
46- + ( ( unsafe { func_4 ( 1 , 2 , 3 , ) } ) as f64 ) )
47- + ( ( unsafe { func_5 ( 2_f64 , x, y, ) } ) as f64 ) )
50+ + ( ( * ( unsafe { bar_4 ( ( & mut x as * mut i32 ) , true , ) } ) ) as f64 ) )
51+ + ( * ( unsafe { bar_5 ( ( & mut y as * mut f64 ) , true , ) } ) ) )
52+ + ( ( unsafe { func_6 ( 1 , 2 , 3 , ) } ) as f64 ) )
53+ + ( ( unsafe { func_7 ( 2_f64 , x, y, ) } ) as f64 ) )
4854 == ( 68_f64 ) )
4955 ) ;
50- assert ! ( ( ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_6) ) == ( 0 ) ) ) ;
51- assert ! ( ( ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_7) ) == ( 0.5_f64 ) ) ) ;
52- ( * std:: cell:: LazyCell :: force_mut ( & mut * & raw mut half_6) ) = 7 ;
53- assert ! ( ( ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_6) ) == ( 7 ) ) ) ;
54- assert ! ( ( ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_7) ) == ( 0.5_f64 ) ) ) ;
55- assert ! ( ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_8) ) . is_null( ) ) ;
56- ( * std:: cell:: LazyCell :: force_mut ( & mut * & raw mut half_8) ) = ( & mut x as * mut i32 ) ;
57- assert ! ( ( ( * ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_8) ) ) == ( 10 ) ) ) ;
56+ assert ! ( ( ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_8) ) == ( 0 ) ) ) ;
57+ assert ! ( ( ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_9) ) == ( 0.5_f64 ) ) ) ;
58+ ( * std:: cell:: LazyCell :: force_mut ( & mut * & raw mut half_8) ) = 7 ;
59+ assert ! ( ( ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_8) ) == ( 7 ) ) ) ;
60+ assert ! ( ( ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_9) ) == ( 0.5_f64 ) ) ) ;
61+ assert ! ( ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_10) ) . is_null( ) ) ;
62+ ( * std:: cell:: LazyCell :: force_mut ( & mut * & raw mut half_10) ) = ( & mut x as * mut i32 ) ;
63+ assert ! ( ( ( * ( * std:: cell:: LazyCell :: force_mut( & mut * & raw mut half_10) ) ) == ( 10 ) ) ) ;
64+ assert ! ( ( ( unsafe { pick_3( ) } ) == ( 1 ) ) ) ;
65+ assert ! ( ( ( unsafe { pick_2( ) } ) == ( 0 ) ) ) ;
5866 return 0 ;
5967}
6068pub unsafe fn __cpp2rust_init_globals ( ) {
61- std:: cell:: LazyCell :: force ( & * & raw const half_6) ;
62- std:: cell:: LazyCell :: force ( & * & raw const half_7) ;
6369 std:: cell:: LazyCell :: force ( & * & raw const half_8) ;
70+ std:: cell:: LazyCell :: force ( & * & raw const half_9) ;
71+ std:: cell:: LazyCell :: force ( & * & raw const half_10) ;
6472}
0 commit comments