Skip to content

Commit 534b050

Browse files
authored
Limit --exclude to workspace packages (rust-lang#2808)
Previously, --exclude would start from the set of all packages referenced in a workspace, i.e., the workspace's packages plus any dependencies. Without --exclude, we would at most look at all the workspace's packages, so --exclude would result in possibly verifying a larger set of packages.
1 parent 6d9575e commit 534b050

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kani-driver/src/call_cargo.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,14 @@ fn packages_to_verify<'b>(
319319
.map(|pkg_name| metadata.packages.iter().find(|pkg| pkg.name == *pkg_name).unwrap())
320320
.collect()
321321
} else if !args.cargo.exclude.is_empty() {
322+
// should be ensured by argument validation
323+
assert!(args.cargo.workspace);
322324
validate_package_names(&args.cargo.exclude, &metadata.packages)?;
323-
metadata.packages.iter().filter(|pkg| !args.cargo.exclude.contains(&pkg.name)).collect()
325+
metadata
326+
.workspace_packages()
327+
.into_iter()
328+
.filter(|pkg| !args.cargo.exclude.contains(&pkg.name))
329+
.collect()
324330
} else {
325331
match (args.cargo.workspace, metadata.root_package()) {
326332
(true, _) | (_, None) => metadata.workspace_packages(),

0 commit comments

Comments
 (0)