diagnostics: Don't mention external crates when hitting import errors on crate imports in 2018

This commit is contained in:
Manish Goregaokar 2021-03-07 14:51:35 -08:00
parent 9d5d669b77
commit 0eeae1abfc
4 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -18,4 +18,4 @@ mod inner {
fn main() {
}
}

View File

@ -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) {
@ -18,4 +18,4 @@ mod inner {
fn main() {
}
}

View File

@ -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