Skip to content

Commit 39d9cf7

Browse files
committed
move install config to the top of parse method
1 parent a75326b commit 39d9cf7

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/bootstrap/src/core/config/config.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -546,14 +546,27 @@ impl Config {
546546
exclude: build_exclude_toml,
547547
} = toml.build.unwrap_or_default();
548548

549+
let Install {
550+
prefix: install_prefix_toml,
551+
sysconfdir: install_sysconfdir_toml,
552+
docdir: install_docdir_toml,
553+
bindir: install_bindir_toml,
554+
libdir: install_libdir_toml,
555+
mandir: install_mandir_toml,
556+
datadir: install_datadir_toml,
557+
} = toml.install.unwrap_or_default();
558+
549559
if cfg!(test) {
550560
// When configuring bootstrap for tests, make sure to set the rustc and Cargo to the
551561
// same ones used to call the tests (if custom ones are not defined in the toml). If we
552562
// don't do that, bootstrap will use its own detection logic to find a suitable rustc
553563
// and Cargo, which doesn't work when the caller is specìfying a custom local rustc or
554564
// Cargo in their bootstrap.toml.
555-
build_rustc_toml = build_rustc_toml.take().or(std::env::var_os("RUSTC").map(|p| p.into()));
556-
build_build_toml = build_build_toml.take().or(std::env::var_os("CARGO").map(|p| p.into_string().unwrap()));
565+
build_rustc_toml =
566+
build_rustc_toml.take().or(std::env::var_os("RUSTC").map(|p| p.into()));
567+
build_build_toml = build_build_toml
568+
.take()
569+
.or(std::env::var_os("CARGO").map(|p| p.into_string().unwrap()));
557570
}
558571

559572
build_jobs_toml = flags_jobs.or(build_jobs_toml);
@@ -755,16 +768,6 @@ impl Config {
755768
// Verbose flag is a good default for `rust.verbose-tests`.
756769
config.verbose_tests = config.is_verbose();
757770

758-
let Install {
759-
prefix: install_prefix_toml,
760-
sysconfdir: install_sysconfdir_toml,
761-
docdir: install_docdir_toml,
762-
bindir: install_bindir_toml,
763-
libdir: install_libdir_toml,
764-
mandir: install_mandir_toml,
765-
datadir: install_datadir_toml,
766-
} = toml.install.unwrap_or_default();
767-
768771
let install_prefix = install_prefix_toml.map(PathBuf::from);
769772
let install_sysconfdir = install_sysconfdir_toml.map(PathBuf::from);
770773
let install_docdir = install_docdir_toml.map(PathBuf::from);

0 commit comments

Comments
 (0)