about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2017-06-18 10:34:08 -0600
committerGitHub <noreply@github.com>2017-06-18 10:34:08 -0600
commit7eff974454563c05dd142c14ad5bff6ce066194f (patch)
tree2f524c96feb566712c3a1809525a1b0c43f76149 /src/bootstrap
parent28cc0c5a7b538452c7495b42b32e09b006c38b82 (diff)
parent73267374d4176ac1c5d685ff2bac36556cfa4730 (diff)
downloadrust-7eff974454563c05dd142c14ad5bff6ce066194f.tar.gz
rust-7eff974454563c05dd142c14ad5bff6ce066194f.zip
Rollup merge of #42695 - Mark-Simulacrum:fix-verbose, r=alexcrichton
Use custom cargo/rustc paths when parsing flags.

Fixes https://github.com/rust-lang/rust/issues/41779, probably also https://github.com/rust-lang/rust/issues/42543 (I think they're duplicates).

I'm not entirely happy with the implementation, since it means we parse the configuration twice, but it's the minimal solution. I think the other choice is to move both calls to Config::parse inside Flags::parse and merge them, but I don't know if that's a good idea.

r? @alexcrichton
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/flags.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 56cbb4cecf2..dc9dac73627 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -242,11 +242,18 @@ Arguments:
         let cwd = t!(env::current_dir());
         let paths = matches.free[1..].iter().map(|p| cwd.join(p)).collect::<Vec<_>>();
 
+        let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
+            if fs::metadata("config.toml").is_ok() {
+                Some(PathBuf::from("config.toml"))
+            } else {
+                None
+            }
+        });
 
         // All subcommands can have an optional "Available paths" section
         if matches.opt_present("verbose") {
             let flags = Flags::parse(&["build".to_string()]);
-            let mut config = Config::default();
+            let mut config = Config::parse(&flags.build, cfg_file.clone());
             config.build = flags.build.clone();
             let mut build = Build::new(flags, config);
             metadata::build(&mut build);
@@ -307,14 +314,6 @@ Arguments:
         };
 
 
-        let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
-            if fs::metadata("config.toml").is_ok() {
-                Some(PathBuf::from("config.toml"))
-            } else {
-                None
-            }
-        });
-
         let mut stage = matches.opt_str("stage").map(|j| j.parse().unwrap());
 
         if matches.opt_present("incremental") {