Skip to content

Commit de292a8

Browse files
committed
Reword "crate not found" resolve message
``` error[E0432]: unresolved import `some_novel_crate` --> file.rs:1:5 | 1 | use some_novel_crate::Type; | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `some_novel_crate` ``` On resolve errors where there might be a missing crate, mention `cargo add foo`: ``` error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope` --> $DIR/conflicting-impl-with-err.rs:4:11 | LL | impl From<nope::Thing> for Error { | ^^^^ use of unresolved module or unlinked crate `nope` | = help: if you wanted to use a crate named `nope`, use `cargo add nope` to add it to your `Cargo.toml` ```
1 parent 0159fe3 commit de292a8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/fail/rustc-error2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ struct Struct<T>(T);
44
impl<T> std::ops::Deref for Struct<T> {
55
type Target = dyn Fn(T);
66
fn deref(&self) -> &assert_mem_uninitialized_valid::Target {
7-
//~^ERROR: undeclared crate or module
7+
//~^ERROR: use of unresolved module or unlinked crate
88
unimplemented!()
99
}
1010
}

tests/fail/rustc-error2.stderr

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
error[E0433]: failed to resolve: use of undeclared crate or module `assert_mem_uninitialized_valid`
1+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `assert_mem_uninitialized_valid`
22
--> tests/fail/rustc-error2.rs:LL:CC
33
|
44
LL | fn deref(&self) -> &assert_mem_uninitialized_valid::Target {
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `assert_mem_uninitialized_valid`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `assert_mem_uninitialized_valid`
6+
|
7+
= help: you might be missing a crate named `assert_mem_uninitialized_valid`
68

79
error: aborting due to 1 previous error
810

0 commit comments

Comments
 (0)