Skip to content

Commit 9f63776

Browse files
committed
Give an error instead of a panic if the lockfile is missing
1 parent 8bce711 commit 9f63776

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/tools/tidy/src/deps.rs

+5
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,11 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
436436
let mut rust_metadata = None;
437437

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

src/tools/tidy/src/extdeps.rs

+5
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)