@@ -17,7 +17,8 @@ use url::Url;
1717
1818use crate :: report:: {
1919 copy_input_into_report, create_dir_all_utf8, create_report_staging_dir, enable_panic_report,
20- normalize_report_out_path, panic_payload_to_string, tar_gz_dir, write_report_meta,
20+ is_verifier_error_text, normalize_report_out_path, panic_payload_to_string, tar_gz_dir,
21+ write_report_meta,
2122} ;
2223
2324#[ derive( Debug , Clone ) ]
@@ -65,6 +66,13 @@ fn write_report_file(report: &ReportContext, rel: &str, contents: &str) {
6566 let _ = std:: fs:: write ( path, contents) ;
6667}
6768
69+ fn write_codegen_report_error ( report : & ReportContext , contents : & str ) {
70+ write_report_file ( report, "errors/codegen_error.txt" , contents) ;
71+ if is_verifier_error_text ( contents) {
72+ write_report_file ( report, "errors/verifier_error.txt" , contents) ;
73+ }
74+ }
75+
6876pub fn check (
6977 path : & Utf8PathBuf ,
7078 dump_mir : bool ,
@@ -568,7 +576,7 @@ fn check_ingot_and_dependencies(
568576 emit_codegen ( db, root_mod, backend) ;
569577 }
570578 if let Some ( report) = report {
571- write_check_artifacts ( db, root_mod, backend_kind, backend, report) ;
579+ has_errors |= write_check_artifacts ( db, root_mod, backend_kind, backend, report) ;
572580 }
573581 }
574582
@@ -675,8 +683,10 @@ fn check_single_file(
675683 if emit_yul_min {
676684 emit_codegen ( db, top_mod, backend) ;
677685 }
678- if let Some ( report) = report {
679- write_check_artifacts ( db, top_mod, backend_kind, backend, report) ;
686+ if let Some ( report) = report
687+ && write_check_artifacts ( db, top_mod, backend_kind, backend, report)
688+ {
689+ return true ;
680690 }
681691 } else {
682692 eprintln ! ( "❌ Error: Could not process file {file_path}" ) ;
@@ -799,7 +809,7 @@ fn check_ingot_inner(
799809 emit_codegen ( db, root_mod, backend) ;
800810 }
801811 if let Some ( report) = report {
802- write_check_artifacts ( db, root_mod, backend_kind, backend, report) ;
812+ has_errors |= write_check_artifacts ( db, root_mod, backend_kind, backend, report) ;
803813 }
804814 }
805815
@@ -923,7 +933,7 @@ fn write_check_artifacts(
923933 backend_kind : BackendKind ,
924934 backend : & dyn Backend ,
925935 report : & ReportContext ,
926- ) {
936+ ) -> bool {
927937 match lower_module ( db, top_mod) {
928938 Ok ( mir) => {
929939 write_report_file (
@@ -975,6 +985,7 @@ fn write_check_artifacts(
975985 Ok ( Ok ( output) ) => match output {
976986 codegen:: BackendOutput :: Yul ( yul) => {
977987 write_report_file ( report, "artifacts/backend_output.yul" , & yul) ;
988+ false
978989 }
979990 codegen:: BackendOutput :: Bytecode ( bytes) => {
980991 write_report_file (
@@ -987,10 +998,13 @@ fn write_check_artifacts(
987998 "artifacts/backend_bytecode_len.txt" ,
988999 & format ! ( "{}\n " , bytes. len( ) ) ,
9891000 ) ;
1001+ false
9901002 }
9911003 } ,
9921004 Ok ( Err ( err) ) => {
993- write_report_file ( report, "errors/codegen_error.txt" , & format ! ( "{err}" ) ) ;
1005+ let err = format ! ( "{err}" ) ;
1006+ write_codegen_report_error ( report, & err) ;
1007+ true
9941008 }
9951009 Err ( payload) => {
9961010 write_report_file (
@@ -1001,6 +1015,7 @@ fn write_check_artifacts(
10011015 panic_payload_to_string( payload. as_ref( ) )
10021016 ) ,
10031017 ) ;
1018+ true
10041019 }
10051020 }
10061021}
0 commit comments