diff options
| -rw-r--r-- | src/tools/tidy/src/deps.rs | 5 | ||||
| -rw-r--r-- | src/tools/tidy/src/extdeps.rs | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 87f07f232bb..2f7440cba88 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -436,6 +436,11 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) { let mut rust_metadata = None; for &(workspace, exceptions, permitted_deps) in WORKSPACES { + if !root.join(workspace).join("Cargo.lock").exists() { + tidy_error!(bad, "the `{workspace}` workspace doesn't have a Cargo.lock"); + continue; + } + let mut cmd = cargo_metadata::MetadataCommand::new(); cmd.cargo_path(cargo) .manifest_path(root.join(workspace).join("Cargo.toml")) diff --git a/src/tools/tidy/src/extdeps.rs b/src/tools/tidy/src/extdeps.rs index 2556b19a7d6..44d13043e46 100644 --- a/src/tools/tidy/src/extdeps.rs +++ b/src/tools/tidy/src/extdeps.rs @@ -14,6 +14,11 @@ pub fn check(root: &Path, bad: &mut bool) { // `Cargo.lock` of rust. let path = root.join(workspace).join("Cargo.lock"); + if !path.exists() { + tidy_error!(bad, "the `{workspace}` workspace doesn't have a Cargo.lock"); + continue; + } + // Open and read the whole file. let cargo_lock = t!(fs::read_to_string(&path)); |
