@@ -77,22 +77,20 @@ pub struct RenderContext<'a> {
7777 pub requested_targets : & ' a [ & ' a str ] ,
7878 /// The number of jobs specified for this build.
7979 pub jobs : u32 ,
80+ /// Fatal error during the build.
81+ pub error : & ' a Option < anyhow:: Error > ,
8082}
8183
8284/// Writes an HTML report.
83- pub ( super ) fn write_html (
84- ctx : RenderContext < ' _ > ,
85- f : & mut impl Write ,
86- error : & Option < anyhow:: Error > ,
87- ) -> CargoResult < ( ) > {
85+ pub ( super ) fn write_html ( ctx : RenderContext < ' _ > , f : & mut impl Write ) -> CargoResult < ( ) > {
8886 let duration = ctx. start . elapsed ( ) . as_secs_f64 ( ) ;
8987 let roots: Vec < & str > = ctx
9088 . root_units
9189 . iter ( )
9290 . map ( |( name, _targets) | name. as_str ( ) )
9391 . collect ( ) ;
9492 f. write_all ( HTML_TMPL . replace ( "{ROOTS}" , & roots. join ( ", " ) ) . as_bytes ( ) ) ?;
95- write_summary_table ( & ctx, f, duration, error ) ?;
93+ write_summary_table ( & ctx, f, duration) ?;
9694 f. write_all ( HTML_CANVAS . as_bytes ( ) ) ?;
9795 write_unit_table ( & ctx, f) ?;
9896 // It helps with pixel alignment to use whole numbers.
@@ -121,7 +119,6 @@ fn write_summary_table(
121119 ctx : & RenderContext < ' _ > ,
122120 f : & mut impl Write ,
123121 duration : f64 ,
124- error : & Option < anyhow:: Error > ,
125122) -> CargoResult < ( ) > {
126123 let targets = ctx
127124 . root_units
@@ -146,7 +143,7 @@ fn write_summary_table(
146143
147144 let requested_targets = ctx. requested_targets . join ( ", " ) ;
148145
149- let error_msg = match error {
146+ let error_msg = match ctx . error {
150147 Some ( e) => format ! ( r#"<tr><td class="error-text">Error:</td><td>{e}</td></tr>"# ) ,
151148 None => "" . to_string ( ) ,
152149 } ;
0 commit comments