Skip to content

Commit d92d28e

Browse files
committed
Auto merge of #77298 - jyn514:bootstrap-config, r=Mark-Simulacrum
Don't warn if the config file is somewhere other than `config.toml` Previously, `config.config` was always hardcoded as `"config.toml"`. I thought that it was being overridden with the actual value later, but it turns out `flags.config` was being completely discarded. This keeps `config.config` in sync with `flags.config`. Fixes #77293 r? `@Mark-Simulacrum` cc `@davidtwco`
2 parents 939cc3e + d537067 commit d92d28e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/bootstrap/config.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ impl Config {
513513
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
514514
config.deny_warnings = true;
515515
config.missing_tools = false;
516-
config.config = PathBuf::from("config.toml");
517516

518517
// set by bootstrap.py
519518
config.build = TargetSelection::from_user(&env!("BUILD_TRIPLE"));
@@ -556,10 +555,10 @@ impl Config {
556555
#[cfg(test)]
557556
let get_toml = |_| TomlConfig::default();
558557
#[cfg(not(test))]
559-
let get_toml = |file: PathBuf| {
558+
let get_toml = |file: &Path| {
560559
use std::process;
561560

562-
let contents = t!(fs::read_to_string(&file), "`include` config not found");
561+
let contents = t!(fs::read_to_string(file), "`include` config not found");
563562
match toml::from_str(&contents) {
564563
Ok(table) => table,
565564
Err(err) => {
@@ -569,18 +568,21 @@ impl Config {
569568
}
570569
};
571570

572-
let mut toml = flags.config.map(get_toml).unwrap_or_else(TomlConfig::default);
571+
let mut toml = flags.config.as_deref().map(get_toml).unwrap_or_else(TomlConfig::default);
573572
if let Some(include) = &toml.profile {
574573
let mut include_path = config.src.clone();
575574
include_path.push("src");
576575
include_path.push("bootstrap");
577576
include_path.push("defaults");
578577
include_path.push(format!("config.toml.{}", include));
579-
let included_toml = get_toml(include_path);
578+
let included_toml = get_toml(&include_path);
580579
toml.merge(included_toml);
581580
}
582581

583582
config.changelog_seen = toml.changelog_seen;
583+
if let Some(cfg) = flags.config {
584+
config.config = cfg;
585+
}
584586

585587
let build = toml.build.unwrap_or_default();
586588

0 commit comments

Comments
 (0)