@@ -95,7 +95,7 @@ enum EnvironmentCmd {
9595 #[ arg( long) ]
9696 benchmark_cargo_config : Vec < String > ,
9797
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
9999 #[ arg( long) ]
100100 run_tests : bool ,
101101 } ,
@@ -111,11 +111,14 @@ enum EnvironmentCmd {
111111 } ,
112112}
113113
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 {
115117 std:: env:: var ( "DIST_TRY_BUILD" ) . unwrap_or_else ( |_| "0" . to_string ( ) ) != "0"
116118}
117119
118120fn create_environment ( args : Args ) -> anyhow:: Result < ( Environment , Vec < String > ) > {
121+ let is_fast_try_build = is_fast_try_build ( ) ;
119122 let ( env, args) = match args. env {
120123 EnvironmentCmd :: Local {
121124 target_triple,
@@ -144,6 +147,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
144147 . skipped_tests ( skipped_tests)
145148 . benchmark_cargo_config ( benchmark_cargo_config)
146149 . run_tests ( run_tests)
150+ . fast_try_build ( is_fast_try_build)
147151 . build ( ) ?;
148152
149153 ( env, shared. build_args )
@@ -167,6 +171,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
167171 . use_bolt ( !is_aarch64)
168172 . skipped_tests ( vec ! [ ] )
169173 . run_tests ( true )
174+ . fast_try_build ( is_fast_try_build)
170175 . build ( ) ?;
171176
172177 ( env, shared. build_args )
@@ -187,6 +192,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
187192 . use_bolt ( false )
188193 . skipped_tests ( vec ! [ ] )
189194 . run_tests ( true )
195+ . fast_try_build ( is_fast_try_build)
190196 . build ( ) ?;
191197
192198 ( env, shared. build_args )
@@ -350,9 +356,8 @@ fn execute_pipeline(
350356
351357 // After dist has finished, run a subset of the test suite on the optimized artifacts to discover
352358 // 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 ( ) {
356361 timer. section ( "Run tests" , |_| run_tests ( env) ) ?;
357362 }
358363
@@ -361,7 +366,10 @@ fn execute_pipeline(
361366
362367fn main ( ) -> anyhow:: Result < ( ) > {
363368 // 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+ }
365373
366374 env_logger:: builder ( )
367375 . filter_level ( LevelFilter :: Info )
@@ -393,9 +401,9 @@ fn main() -> anyhow::Result<()> {
393401
394402 let ( env, mut build_args) = create_environment ( args) . context ( "Cannot create environment" ) ?;
395403
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" ) ;
399407 for target in [
400408 "rust-docs" ,
401409 "rustc-docs" ,
0 commit comments