diff options
| author | Jake Goulding <jake.goulding@gmail.com> | 2020-11-07 13:26:42 -0500 |
|---|---|---|
| committer | Jake Goulding <jake.goulding@gmail.com> | 2020-11-07 13:36:42 -0500 |
| commit | 8cae2f167c0c332c5d04006afdd56d7a40c4dccb (patch) | |
| tree | a2cdca6e8b4a7c712876086294b41f8e2bf52fe4 | |
| parent | 0256d065d4901b63def6c04013da4f781d0752bb (diff) | |
| download | rust-8cae2f167c0c332c5d04006afdd56d7a40c4dccb.tar.gz rust-8cae2f167c0c332c5d04006afdd56d7a40c4dccb.zip | |
Honor the rustfmt setting in config.toml
Prior to this, setting the rustfmt configuration was ignored: ``` % mkdir example % cd example % ../configure --set build.rustfmt=/usr/bin/true % ../x.py fmt ./x.py fmt is not supported on this channel failed to run: /Users/shep/Projects/rust/example/build/bootstrap/debug/bootstrap fmt Build completed unsuccessfully in 0:00:01 ``` And after: ``` % ../x.py fmt Build completed successfully in 0:00:11 ```
| -rw-r--r-- | src/bootstrap/config.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 7698ff62880..40ea9afb6f6 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -913,11 +913,18 @@ impl Config { set(&mut config.missing_tools, t.missing_tools); } - // Cargo does not provide a RUSTFMT environment variable, so we - // synthesize it manually. Note that we also later check the config.toml - // and set this to that path if necessary. - let rustfmt = config.initial_rustc.with_file_name(exe("rustfmt", config.build)); - config.initial_rustfmt = if rustfmt.exists() { Some(rustfmt) } else { None }; + config.initial_rustfmt = config.initial_rustfmt.or_else({ + let build = config.build; + let initial_rustc = &config.initial_rustc; + + move || { + // Cargo does not provide a RUSTFMT environment variable, so we + // synthesize it manually. + let rustfmt = initial_rustc.with_file_name(exe("rustfmt", build)); + + if rustfmt.exists() { Some(rustfmt) } else { None } + } + }); // Now that we've reached the end of our configuration, infer the // default values for all options that we haven't otherwise stored yet. |
