]> git.lizzy.rs Git - rust.git/commitdiff
Use custom cargo/rustc paths when parsing flags.
authorMark Simulacrum <mark.simulacrum@gmail.com>
Fri, 16 Jun 2017 13:44:09 +0000 (07:44 -0600)
committerMark Simulacrum <mark.simulacrum@gmail.com>
Fri, 16 Jun 2017 13:44:09 +0000 (07:44 -0600)
src/bootstrap/flags.rs

index 56cbb4cecf2a5b08f2a3a006ed9f144ce41a3020..dc9dac73627880b864916fc24816c3a23fd185b5 100644 (file)
@@ -242,11 +242,18 @@ pub fn parse(args: &[String]) -> Flags {
         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 @@ pub fn parse(args: &[String]) -> Flags {
         };
 
 
-        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") {