File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,21 @@ fn main() {
9393 env:: join_paths ( & dylib_path) . unwrap ( ) ) ;
9494 let mut maybe_crate = None ;
9595
96+ // Get the name of the crate we're compiling, if any.
97+ let maybe_crate_name = args. windows ( 2 )
98+ . find ( |a| & * a[ 0 ] == "--crate-name" )
99+ . map ( |crate_name| & * crate_name[ 1 ] ) ;
100+
101+ if let Some ( current_crate) = maybe_crate_name {
102+ if let Some ( target) = env:: var_os ( "RUSTC_TIME" ) {
103+ if target == "all" ||
104+ target. into_string ( ) . unwrap ( ) . split ( "," ) . any ( |c| c. trim ( ) == current_crate)
105+ {
106+ cmd. arg ( "-Ztime" ) ;
107+ }
108+ }
109+ }
110+
96111 // Non-zero stages must all be treated uniformly to avoid problems when attempting to uplift
97112 // compiler libraries and such from stage 1 to 2.
98113 if stage == "0" {
@@ -152,10 +167,7 @@ fn main() {
152167 cmd. arg ( format ! ( "-Clinker={}" , target_linker) ) ;
153168 }
154169
155- let crate_name = args. windows ( 2 )
156- . find ( |a| & * a[ 0 ] == "--crate-name" )
157- . unwrap ( ) ;
158- let crate_name = & * crate_name[ 1 ] ;
170+ let crate_name = maybe_crate_name. unwrap ( ) ;
159171 maybe_crate = Some ( crate_name) ;
160172
161173 // If we're compiling specifically the `panic_abort` crate then we pass
You can’t perform that action at this time.
0 commit comments