Skip to content

Commit d8fd8df

Browse files
Mark-Simulacrumbrson
authored andcommitted
Use custom cargo/rustc paths when parsing flags.
1 parent 433450a commit d8fd8df

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/bootstrap/flags.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,18 @@ Arguments:
237237
let cwd = t!(env::current_dir());
238238
let paths = matches.free[1..].iter().map(|p| cwd.join(p)).collect::<Vec<_>>();
239239

240+
let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
241+
if fs::metadata("config.toml").is_ok() {
242+
Some(PathBuf::from("config.toml"))
243+
} else {
244+
None
245+
}
246+
});
240247

241248
// All subcommands can have an optional "Available paths" section
242249
if matches.opt_present("verbose") {
243250
let flags = Flags::parse(&["build".to_string()]);
244-
let mut config = Config::default();
251+
let mut config = Config::parse(&flags.build, cfg_file.clone());
245252
config.build = flags.build.clone();
246253
let mut build = Build::new(flags, config);
247254
metadata::build(&mut build);
@@ -302,14 +309,6 @@ Arguments:
302309
};
303310

304311

305-
let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
306-
if fs::metadata("config.toml").is_ok() {
307-
Some(PathBuf::from("config.toml"))
308-
} else {
309-
None
310-
}
311-
});
312-
313312
let mut stage = matches.opt_str("stage").map(|j| j.parse().unwrap());
314313

315314
if matches.opt_present("incremental") {

0 commit comments

Comments
 (0)