@@ -7,8 +7,6 @@ use std::time::Instant;
77use itertools:: Itertools as _;
88
99use crate :: CargoResult ;
10- use crate :: core:: compiler:: BuildContext ;
11- use crate :: core:: compiler:: BuildRunner ;
1210use crate :: core:: compiler:: CompilationSection ;
1311use crate :: core:: compiler:: Unit ;
1412
@@ -71,13 +69,20 @@ pub struct HtmlRenderContext<'a> {
7169 /// recording was taken and second element is percentage usage of the
7270 /// system.
7371 pub cpu_usage : & ' a [ ( f64 , f64 ) ] ,
72+ /// Compiler version info, i.e., `rustc 1.92.0-beta.2 (0a411606e 2025-10-31)`.
73+ pub rustc_version : & ' a str ,
74+ /// The host triple (arch-platform-OS).
75+ pub host : & ' a str ,
76+ /// The requested target platforms of compilation for this build.
77+ pub requested_targets : & ' a [ & ' a str ] ,
78+ /// The number of jobs specified for this build.
79+ pub jobs : u32 ,
7480}
7581
7682/// Save HTML report to disk.
7783pub ( super ) fn report_html (
7884 ctx : HtmlRenderContext < ' _ > ,
7985 f : & mut impl Write ,
80- build_runner : & BuildRunner < ' _ , ' _ > ,
8186 error : & Option < anyhow:: Error > ,
8287) -> CargoResult < ( ) > {
8388 let duration = ctx. start . elapsed ( ) . as_secs_f64 ( ) ;
@@ -87,7 +92,7 @@ pub(super) fn report_html(
8792 . map ( |( name, _targets) | name. as_str ( ) )
8893 . collect ( ) ;
8994 f. write_all ( HTML_TMPL . replace ( "{ROOTS}" , & roots. join ( ", " ) ) . as_bytes ( ) ) ?;
90- write_summary_table ( & ctx, f, duration, build_runner . bcx , error) ?;
95+ write_summary_table ( & ctx, f, duration, error) ?;
9196 f. write_all ( HTML_CANVAS . as_bytes ( ) ) ?;
9297 write_unit_table ( & ctx, f) ?;
9398 // It helps with pixel alignment to use whole numbers.
@@ -116,7 +121,6 @@ fn write_summary_table(
116121 ctx : & HtmlRenderContext < ' _ > ,
117122 f : & mut impl Write ,
118123 duration : f64 ,
119- bcx : & BuildContext < ' _ , ' _ > ,
120124 error : & Option < anyhow:: Error > ,
121125) -> CargoResult < ( ) > {
122126 let targets: Vec < String > = ctx
@@ -135,12 +139,12 @@ fn write_summary_table(
135139 let total_time = format ! ( "{:.1}s{}" , duration, time_human) ;
136140
137141 let max_concurrency = ctx. concurrency . iter ( ) . map ( |c| c. active ) . max ( ) . unwrap ( ) ;
138- let jobs = bcx. jobs ( ) ;
139142 let num_cpus = std:: thread:: available_parallelism ( )
140143 . map ( |x| x. get ( ) . to_string ( ) )
141144 . unwrap_or_else ( |_| "n/a" . into ( ) ) ;
142145
143- let rustc_info = render_rustc_info ( bcx) ;
146+ let requested_targets = ctx. requested_targets . join ( ", " ) ;
147+
144148 let error_msg = match error {
145149 Some ( e) => format ! ( r#"<tr><td class="error-text">Error:</td><td>{e}</td></tr>"# ) ,
146150 None => "" . to_string ( ) ,
@@ -151,6 +155,9 @@ fn write_summary_table(
151155 profile,
152156 total_fresh,
153157 total_dirty,
158+ rustc_version,
159+ host,
160+ jobs,
154161 ..
155162 } = & ctx;
156163
@@ -183,7 +190,7 @@ fn write_summary_table(
183190<td>Total time:</td><td>{total_time}</td>
184191</tr>
185192<tr>
186- <td>rustc:</td><td>{rustc_info }</td>
193+ <td>rustc:</td><td>{rustc_version}<br>Host: {host}<br>Target: {requested_targets }</td>
187194</tr>
188195{error_msg}
189196</table>
@@ -347,28 +354,6 @@ fn write_unit_table(ctx: &HtmlRenderContext<'_>, f: &mut impl Write) -> CargoRes
347354 Ok ( ( ) )
348355}
349356
350- fn render_rustc_info ( bcx : & BuildContext < ' _ , ' _ > ) -> String {
351- let version = bcx
352- . rustc ( )
353- . verbose_version
354- . lines ( )
355- . next ( )
356- . expect ( "rustc version" ) ;
357- let requested_target = bcx
358- . build_config
359- . requested_kinds
360- . iter ( )
361- . map ( |kind| bcx. target_data . short_name ( kind) )
362- . collect :: < Vec < _ > > ( )
363- . join ( ", " ) ;
364- format ! (
365- "{}<br>Host: {}<br>Target: {}" ,
366- version,
367- bcx. rustc( ) . host,
368- requested_target
369- )
370- }
371-
372357fn to_unit_data ( unit_times : & [ UnitTime ] ) -> Vec < UnitData > {
373358 // Create a map to link indices of unlocked units.
374359 let unit_map: HashMap < Unit , usize > = unit_times
0 commit comments