File tree 1 file changed +16
-4
lines changed
1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,21 @@ fn main() {
93
93
env:: join_paths ( & dylib_path) . unwrap ( ) ) ;
94
94
let mut maybe_crate = None ;
95
95
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
+
96
111
// Non-zero stages must all be treated uniformly to avoid problems when attempting to uplift
97
112
// compiler libraries and such from stage 1 to 2.
98
113
if stage == "0" {
@@ -152,10 +167,7 @@ fn main() {
152
167
cmd. arg ( format ! ( "-Clinker={}" , target_linker) ) ;
153
168
}
154
169
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 ( ) ;
159
171
maybe_crate = Some ( crate_name) ;
160
172
161
173
// If we're compiling specifically the `panic_abort` crate then we pass
You can’t perform that action at this time.
0 commit comments