Skip to content

Commit d537067

Browse files
committed
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`.
1 parent 1d5a865 commit d537067

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
@@ -515,7 +515,6 @@ impl Config {
515515
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
516516
config.deny_warnings = true;
517517
config.missing_tools = false;
518-
config.config = PathBuf::from("config.toml");
519518

520519
// set by bootstrap.py
521520
config.build = TargetSelection::from_user(&env!("BUILD_TRIPLE"));
@@ -558,10 +557,10 @@ impl Config {
558557
#[cfg(test)]
559558
let get_toml = |_| TomlConfig::default();
560559
#[cfg(not(test))]
561-
let get_toml = |file: PathBuf| {
560+
let get_toml = |file: &Path| {
562561
use std::process;
563562

564-
let contents = t!(fs::read_to_string(&file), "`include` config not found");
563+
let contents = t!(fs::read_to_string(file), "`include` config not found");
565564
match toml::from_str(&contents) {
566565
Ok(table) => table,
567566
Err(err) => {
@@ -571,18 +570,21 @@ impl Config {
571570
}
572571
};
573572

574-
let mut toml = flags.config.map(get_toml).unwrap_or_else(TomlConfig::default);
573+
let mut toml = flags.config.as_deref().map(get_toml).unwrap_or_else(TomlConfig::default);
575574
if let Some(include) = &toml.profile {
576575
let mut include_path = config.src.clone();
577576
include_path.push("src");
578577
include_path.push("bootstrap");
579578
include_path.push("defaults");
580579
include_path.push(format!("config.toml.{}", include));
581-
let included_toml = get_toml(include_path);
580+
let included_toml = get_toml(&include_path);
582581
toml.merge(included_toml);
583582
}
584583

585584
config.changelog_seen = toml.changelog_seen;
585+
if let Some(cfg) = flags.config {
586+
config.config = cfg;
587+
}
586588

587589
let build = toml.build.unwrap_or_default();
588590

0 commit comments

Comments
 (0)