about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/format.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs
index e253e525526..c8ae2f4e688 100644
--- a/src/bootstrap/format.rs
+++ b/src/bootstrap/format.rs
@@ -37,8 +37,13 @@ pub fn format(build: &Build, check: bool) {
     builder.add_defaults();
     builder.select("rust");
     let matcher = builder.build().unwrap();
-
-    let rustfmt_config = t!(std::fs::read_to_string(build.src.join("rustfmt.toml")));
+    let rustfmt_config = build.src.join("rustfmt.toml");
+    if !rustfmt_config.exists() {
+        eprintln!("Not running formatting checks; rustfmt.toml does not exist.");
+        eprintln!("This may happen in distributed tarballs.");
+        return;
+    }
+    let rustfmt_config = t!(std::fs::read_to_string(&rustfmt_config));
     let rustfmt_config: RustfmtConfig = t!(toml::from_str(&rustfmt_config));
     let mut ignore_fmt = ignore::overrides::OverrideBuilder::new(&build.src);
     for ignore in rustfmt_config.ignore {