Skip to content

Commit 1427b7b

Browse files
committed
detect another variant of missing package error
the message is slightly different if there exists a potentially typoed crate
1 parent a9602f0 commit 1427b7b

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

src/prepare.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ fn run_command(cmd: Command) -> anyhow::Result<()> {
153153
yanked_deps = true;
154154
} else if line.contains("failed to load source for dependency")
155155
|| line.contains("no matching package named")
156+
|| line.contains("no matching package found")
156157
{
157158
missing_deps = true;
158159
} else if line.contains("failed to parse manifest at")
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "missing-deps-typo"
3+
version = "0.1.0"
4+
authors = ["Pietro Albini <pietro@pietroalbini.org>"]
5+
edition = "2018"
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[dependencies]
10+
# it's build-rs (dash vs. underscore)
11+
build_rs = "*"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("Hello, world!");
3+
}

tests/buildtest/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,10 @@ test_prepare_error_stderr!(
229229
MissingDependencies,
230230
"error: no matching package named `macro` found"
231231
);
232+
233+
test_prepare_error_stderr!(
234+
test_missing_deps_typo,
235+
"missing-deps-typo",
236+
MissingDependencies,
237+
"error: no matching package found"
238+
);

0 commit comments

Comments
 (0)