@@ -95,7 +95,7 @@ enum EnvironmentCmd {
95
95
#[ arg( long) ]
96
96
benchmark_cargo_config : Vec < String > ,
97
97
98
- /// Perform tests after final build if it's not a try build
98
+ /// Perform tests after final build if it's not a fast try build
99
99
#[ arg( long) ]
100
100
run_tests : bool ,
101
101
} ,
@@ -111,11 +111,14 @@ enum EnvironmentCmd {
111
111
} ,
112
112
}
113
113
114
- fn is_try_build ( ) -> bool {
114
+ /// For a fast try build, we want to only build the bare minimum of components to get a
115
+ /// working toolchain, and not run any tests.
116
+ fn is_fast_try_build ( ) -> bool {
115
117
std:: env:: var ( "DIST_TRY_BUILD" ) . unwrap_or_else ( |_| "0" . to_string ( ) ) != "0"
116
118
}
117
119
118
120
fn create_environment ( args : Args ) -> anyhow:: Result < ( Environment , Vec < String > ) > {
121
+ let is_fast_try_build = is_fast_try_build ( ) ;
119
122
let ( env, args) = match args. env {
120
123
EnvironmentCmd :: Local {
121
124
target_triple,
@@ -144,6 +147,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
144
147
. skipped_tests ( skipped_tests)
145
148
. benchmark_cargo_config ( benchmark_cargo_config)
146
149
. run_tests ( run_tests)
150
+ . fast_try_build ( is_fast_try_build)
147
151
. build ( ) ?;
148
152
149
153
( env, shared. build_args )
@@ -167,6 +171,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
167
171
. use_bolt ( !is_aarch64)
168
172
. skipped_tests ( vec ! [ ] )
169
173
. run_tests ( true )
174
+ . fast_try_build ( is_fast_try_build)
170
175
. build ( ) ?;
171
176
172
177
( env, shared. build_args )
@@ -187,6 +192,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
187
192
. use_bolt ( false )
188
193
. skipped_tests ( vec ! [ ] )
189
194
. run_tests ( true )
195
+ . fast_try_build ( is_fast_try_build)
190
196
. build ( ) ?;
191
197
192
198
( env, shared. build_args )
@@ -350,9 +356,8 @@ fn execute_pipeline(
350
356
351
357
// After dist has finished, run a subset of the test suite on the optimized artifacts to discover
352
358
// possible regressions.
353
- // The tests are not executed for try builds, which can be in various broken states, so we don't
354
- // want to gatekeep them with tests.
355
- if !is_try_build ( ) && env. run_tests ( ) {
359
+ // The tests are not executed for fast try builds, which can be broken and might not pass them.
360
+ if !is_fast_try_build ( ) && env. run_tests ( ) {
356
361
timer. section ( "Run tests" , |_| run_tests ( env) ) ?;
357
362
}
358
363
@@ -361,7 +366,10 @@ fn execute_pipeline(
361
366
362
367
fn main ( ) -> anyhow:: Result < ( ) > {
363
368
// Make sure that we get backtraces for easier debugging in CI
364
- std:: env:: set_var ( "RUST_BACKTRACE" , "1" ) ;
369
+ unsafe {
370
+ // SAFETY: we are the only thread running at this point
371
+ std:: env:: set_var ( "RUST_BACKTRACE" , "1" ) ;
372
+ }
365
373
366
374
env_logger:: builder ( )
367
375
. filter_level ( LevelFilter :: Info )
@@ -393,9 +401,9 @@ fn main() -> anyhow::Result<()> {
393
401
394
402
let ( env, mut build_args) = create_environment ( args) . context ( "Cannot create environment" ) ?;
395
403
396
- // Skip components that are not needed for try builds to speed them up
397
- if is_try_build ( ) {
398
- log:: info!( "Skipping building of unimportant components for a try build" ) ;
404
+ // Skip components that are not needed for fast try builds to speed them up
405
+ if is_fast_try_build ( ) {
406
+ log:: info!( "Skipping building of unimportant components for a fast try build" ) ;
399
407
for target in [
400
408
"rust-docs" ,
401
409
"rustc-docs" ,
0 commit comments