@@ -10,16 +10,22 @@ use super::intrinsic_helpers::IntrinsicTypeDefinition;
1010// The number of times each intrinsic will be called. 
1111pub ( crate )  const  PASSES :  u32  = 20 ; 
1212
13+ macro_rules!  concatln { 
14+     ( $( $lines: expr) ,*  $( , ) ?)  => { 
15+         concat!( $(  $lines,  "\n "  ) ,* ) 
16+     } ; 
17+ } 
18+ 
1319fn  write_cargo_toml_header ( w :  & mut  impl  std:: io:: Write ,  name :  & str )  -> std:: io:: Result < ( ) >  { 
1420    writeln ! ( 
1521        w, 
16-         concat !( 
17-             "[package]\n " , 
18-             "name = \" {name}\" \n " , 
19-             "version = \" {version}\" \n " , 
20-             "authors = [{authors}]\n " , 
21-             "license = \" {license}\" \n " , 
22-             "edition = \" 2018\" \n " , 
22+         concatln !( 
23+             "[package]" , 
24+             "name = \" {name}\" " , 
25+             "version = \" {version}\" " , 
26+             "authors = [{authors}]" , 
27+             "license = \" {license}\" " , 
28+             "edition = \" 2018\" " , 
2329        ) , 
2430        name = name, 
2531        version = env!( "CARGO_PKG_VERSION" ) , 
@@ -247,23 +253,23 @@ pub fn generate_rust_test_loop<T: IntrinsicTypeDefinition>(
247253        } 
248254    } 
249255
250-     let  indentation2 = indentation. nested ( ) ; 
251-     let  indentation3 = indentation2. nested ( ) ; 
252-     writeln ! ( 
256+     write ! ( 
253257        w, 
254-         "\  
255- \n \ 
256- \n \ 
257- \n \ 
258- \ 
259- \n \ 
260- \" Result {{id}}-{{}}: {{:?}}\" , i + 1, {return_value});\n \ 
261- \n \ 
262- \n \ 
263- , 
264-         loaded_args = intrinsic. arguments. load_values_rust( indentation3) , 
258+         concatln!( 
259+             "    for (id, f) in specializations {{" , 
260+             "        for i in 0..{passes} {{" , 
261+             "            unsafe {{" , 
262+             "{loaded_args}" , 
263+             "                let __return_value = f({args});" , 
264+             "                println!(\" Result {{id}}-{{}}: {{:?}}\" , i + 1, {return_value});" , 
265+             "            }}" , 
266+             "        }}" , 
267+             "    }}" , 
268+         ) , 
269+         loaded_args = intrinsic. arguments. load_values_rust( indentation. nest_by( 4 ) ) , 
265270        args = intrinsic. arguments. as_call_param_rust( ) , 
266271        return_value = intrinsic. results. print_result_rust( ) , 
272+         passes = passes, 
267273    ) 
268274} 
269275
0 commit comments