Skip to content

Commit 26a29c5

Browse files
committed
Give an error instead of a panic if the lockfile is missing
1 parent f5bcecb commit 26a29c5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/tools/tidy/src/deps.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,11 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
434434
let mut rust_metadata = None;
435435

436436
for &(workspace, exceptions, permitted_deps) in WORKSPACES {
437+
if !root.join(workspace).join("Cargo.lock").exists() {
438+
tidy_error!(bad, "the `{workspace}` workspace doesn't have a Cargo.lock");
439+
continue;
440+
}
441+
437442
let mut cmd = cargo_metadata::MetadataCommand::new();
438443
cmd.cargo_path(cargo)
439444
.manifest_path(root.join(workspace).join("Cargo.toml"))

src/tools/tidy/src/extdeps.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ pub fn check(root: &Path, bad: &mut bool) {
1414
// `Cargo.lock` of rust.
1515
let path = root.join(workspace).join("Cargo.lock");
1616

17+
if !path.exists() {
18+
tidy_error!(bad, "the `{workspace}` workspace doesn't have a Cargo.lock");
19+
continue;
20+
}
21+
1722
// Open and read the whole file.
1823
let cargo_lock = t!(fs::read_to_string(&path));
1924

0 commit comments

Comments
 (0)