@@ -5,8 +5,10 @@ static FOO: fn() = || { assert_ne!(42, 43) };
55static  BAR :  fn ( i32 ,  i32 )  = |a,  b| {  assert_ne ! ( a,  b)  } ; 
66
77// use to first make the closure FnOnce() before making it fn() 
8- fn  magic0 < R ,  F :  FnOnce ( )  -> R > ( f :  F )  -> F  {  f } 
9- fn  magic1 < T ,  R ,  F :  FnOnce ( T )  -> R > ( f :  F )  -> F  {  f } 
8+ fn  force_once0 < R ,  F :  FnOnce ( )  -> R > ( f :  F )  -> F  {  f } 
9+ fn  force_once1 < T ,  R ,  F :  FnOnce ( T )  -> R > ( f :  F )  -> F  {  f } 
10+ fn  force_mut0 < R ,  F :  FnMut ( )  -> R > ( f :  F )  -> F  {  f } 
11+ fn  force_mut1 < T ,  R ,  F :  FnMut ( T )  -> R > ( f :  F )  -> F  {  f } 
1012
1113fn  main ( )  { 
1214    FOO ( ) ; 
@@ -18,19 +20,15 @@ fn main() {
1820
1921    let  f:  fn ( )  = ||{ } ; 
2022    f ( ) ; 
21-     let  f = magic0 ( ||{ } )  as  fn ( ) ; 
23+     let  f = force_once0 ( ||{ } )  as  fn ( ) ; 
24+     f ( ) ; 
25+     let  f = force_mut0 ( ||{ } )  as  fn ( ) ; 
2226    f ( ) ; 
2327
2428    let  g:  fn ( i32 )  = |i| assert_eq ! ( i,  2 ) ; 
2529    g ( 2 ) ; 
26-     let  g = magic1 ( |i| assert_eq ! ( i,  2 ) )  as  fn ( i32 ) ; 
30+     let  g = force_once1 ( |i| assert_eq ! ( i,  2 ) )  as  fn ( i32 ) ; 
31+     g ( 2 ) ; 
32+     let  g = force_mut1 ( |i| assert_eq ! ( i,  2 ) )  as  fn ( i32 ) ; 
2733    g ( 2 ) ; 
28- 
29-     // FIXME: This fails with "invalid use of NULL pointer" <https://github.com/rust-lang/miri/issues/1075> 
30-     //let h: fn() -> ! = || std::process::exit(0); 
31-     //h(); 
32-     // FIXME: This does not even compile?!? <https://github.com/rust-lang/rust/issues/66738> 
33-     //let h = magic0(|| std::process::exit(0)) as fn() -> !; 
34-     //h(); 
35-     // Once these tests pass, they should be in separate files as they terminate the process. 
3634} 
0 commit comments