diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-08-26 12:23:31 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-10-10 12:47:26 +0000 |
| commit | 9f63776121db2f5cb8833e2f7d2fac37165dde87 (patch) | |
| tree | e31046e86f93ec3af7f2db4be428c9767900573b | |
| parent | 8bce7116fa8b4cef51ff52398ee659c44d79930d (diff) | |
| download | rust-9f63776121db2f5cb8833e2f7d2fac37165dde87.tar.gz rust-9f63776121db2f5cb8833e2f7d2fac37165dde87.zip | |
Give an error instead of a panic if the lockfile is missing
| -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)); |
