Skip to content

Commit

Permalink
diagnostics: Don't mention external crates when hitting import errors…
Browse files Browse the repository at this point in the history
… on crate imports in 2018
  • Loading branch information
Manishearth committed Mar 7, 2021
1 parent 9d5d669 commit 0eeae1a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion compiler/rustc_resolve/src/lib.rs
Expand Up @@ -2433,8 +2433,10 @@ impl<'a> Resolver<'a> {
Applicability::MaybeIncorrect,
)),
)
} else {
} else if self.session.edition() == Edition::Edition2015 {
(format!("maybe a missing crate `{}`?", ident), None)
} else {
(format!("could not find `{}` in the crate root", ident), None)
}
} else if i == 0 {
if ident
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/editions-crate-root-2015.rs
Expand Up @@ -18,4 +18,4 @@ mod inner {

fn main() {

}
}
4 changes: 2 additions & 2 deletions src/test/ui/editions-crate-root-2018.rs
Expand Up @@ -5,7 +5,7 @@ mod inner {
//~^ ERROR failed to resolve: could not find `nonexistant` in the list of imported crates
}
fn crate_inner(_: crate::nonexistant::Foo) {
//~^ ERROR failed to resolve: maybe a missing crate `nonexistant`?
//~^ ERROR failed to resolve: could not find `nonexistant` in the crate root
}

fn bare_global(_: ::nonexistant) {
Expand All @@ -18,4 +18,4 @@ mod inner {

fn main() {

}
}
4 changes: 2 additions & 2 deletions src/test/ui/editions-crate-root-2018.stderr
Expand Up @@ -4,11 +4,11 @@ error[E0433]: failed to resolve: could not find `nonexistant` in the list of imp
LL | fn global_inner(_: ::nonexistant::Foo) {
| ^^^^^^^^^^^ could not find `nonexistant` in the list of imported crates

error[E0433]: failed to resolve: maybe a missing crate `nonexistant`?
error[E0433]: failed to resolve: could not find `nonexistant` in the crate root
--> $DIR/editions-crate-root-2018.rs:7:30
|
LL | fn crate_inner(_: crate::nonexistant::Foo) {
| ^^^^^^^^^^^ maybe a missing crate `nonexistant`?
| ^^^^^^^^^^^ could not find `nonexistant` in the crate root

error[E0412]: cannot find crate `nonexistant` in the list of imported crates
--> $DIR/editions-crate-root-2018.rs:11:25
Expand Down

0 comments on commit 0eeae1a

Please sign in to comment.