Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 6a9daf8

Browse files
committed
Properly warn if a package lacks [lib] target
Otherwise it errors out with a "lost build artifact", which may be hard to decipher.
1 parent 78f0426 commit 6a9daf8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/bin/cargo_semver.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ fn run(config: &cargo::Config, matches: &getopts::Matches) -> Result<()> {
119119
};
120120
let name = current.package.name().to_owned();
121121

122+
if !current.package.targets().iter().any(|t| t.is_lib()) {
123+
return Err(anyhow::anyhow!(
124+
"package `{}` lacks required [lib] target",
125+
&name
126+
));
127+
}
128+
122129
// TODO: JSON output here
123130
if matches.opt_present("show-public") {
124131
let (current_rlib, current_deps_output) =

0 commit comments

Comments
 (0)