@@ -19,7 +19,8 @@ fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
1919}
2020
2121fn configure_with_args ( cmd : & [ String ] , host : & [ & str ] , target : & [ & str ] ) -> Config {
22- let mut config = Config :: parse ( Flags :: parse ( cmd) ) ;
22+ let ( flags, exec_ctx) = Flags :: parse ( cmd) ;
23+ let mut config = Config :: parse ( flags, exec_ctx) ;
2324 // don't save toolstates
2425 config. save_toolstates = None ;
2526 config. dry_run = DryRun :: SelfCheck ;
@@ -30,10 +31,11 @@ fn configure_with_args(cmd: &[String], host: &[&str], target: &[&str]) -> Config
3031 // The src/doc/book submodule is needed because TheBook step tries to
3132 // access files even during a dry-run (may want to consider just skipping
3233 // that in a dry run).
34+ let ( flags, exec_ctx) = Flags :: parse ( & [ "check" . to_owned ( ) ] ) ;
3335 let submodule_build = Build :: new ( Config {
3436 // don't include LLVM, so CI doesn't require ninja/cmake to be installed
3537 rust_codegen_backends : vec ! [ ] ,
36- ..Config :: parse ( Flags :: parse ( & [ "check" . to_owned ( ) ] ) )
38+ ..Config :: parse ( flags , exec_ctx )
3739 } ) ;
3840 submodule_build. require_submodule ( "src/doc/book" , None ) ;
3941 config. submodules = Some ( false ) ;
@@ -291,18 +293,16 @@ fn prepare_rustc_checkout(ctx: &mut GitCtx) {
291293
292294/// Parses a Config directory from `path`, with the given value of `download_rustc`.
293295fn parse_config_download_rustc_at ( path : & Path , download_rustc : & str , ci : bool ) -> Config {
294- Config :: parse_inner (
295- Flags :: parse ( & [
296- "build" . to_owned ( ) ,
297- "--dry-run" . to_owned ( ) ,
298- "--ci" . to_owned ( ) ,
299- if ci { "true" } else { "false" } . to_owned ( ) ,
300- format ! ( "--set=rust.download-rustc='{download_rustc}'" ) ,
301- "--src" . to_owned ( ) ,
302- path. to_str ( ) . unwrap ( ) . to_owned ( ) ,
303- ] ) ,
304- |& _| Ok ( Default :: default ( ) ) ,
305- )
296+ let ( flags, exec_ctx) = Flags :: parse ( & [
297+ "build" . to_owned ( ) ,
298+ "--dry-run" . to_owned ( ) ,
299+ "--ci" . to_owned ( ) ,
300+ if ci { "true" } else { "false" } . to_owned ( ) ,
301+ format ! ( "--set=rust.download-rustc='{download_rustc}'" ) ,
302+ "--src" . to_owned ( ) ,
303+ path. to_str ( ) . unwrap ( ) . to_owned ( ) ,
304+ ] ) ;
305+ Config :: parse_inner ( flags, |& _| Ok ( Default :: default ( ) ) , exec_ctx)
306306}
307307
308308mod defaults {
@@ -692,7 +692,8 @@ mod dist {
692692 host = ["i686-unknown-netbsd"]
693693 target = ["i686-unknown-netbsd"]
694694 "# ;
695- let config = Config :: parse_inner ( Flags :: parse ( cmd_args) , |& _| toml:: from_str ( config_str) ) ;
695+ let ( flags, exec_ctx) = Flags :: parse ( cmd_args) ;
696+ let config = Config :: parse_inner ( flags, |& _| toml:: from_str ( config_str) , exec_ctx) ;
696697 let mut cache = run_build ( & [ ] , config) ;
697698
698699 // Stage 2 `compile::Rustc` should **NEVER** be cached here.
@@ -1047,14 +1048,12 @@ fn test_test_coverage() {
10471048#[ test]
10481049fn test_prebuilt_llvm_config_path_resolution ( ) {
10491050 fn configure ( config : & str ) -> Config {
1050- Config :: parse_inner (
1051- Flags :: parse ( & [
1052- "build" . to_string ( ) ,
1053- "--dry-run" . to_string ( ) ,
1054- "--config=/does/not/exist" . to_string ( ) ,
1055- ] ) ,
1056- |& _| toml:: from_str ( & config) ,
1057- )
1051+ let ( flags, exec_ctx) = Flags :: parse ( & [
1052+ "build" . to_string ( ) ,
1053+ "--dry-run" . to_string ( ) ,
1054+ "--config=/does/not/exist" . to_string ( ) ,
1055+ ] ) ;
1056+ Config :: parse_inner ( flags, |& _| toml:: from_str ( & config) , exec_ctx)
10581057 }
10591058
10601059 // Removes Windows disk prefix if present
0 commit comments