diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2021-03-07 14:51:35 -0800 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2021-03-07 15:15:19 -0800 |
| commit | 0eeae1abfcd8e588b41b01100db4dbc9384f6144 (patch) | |
| tree | 8c3b38c869fcd7ae077e8717b47bc32244f51269 | |
| parent | 9d5d669b77f8c100f3e01a7bd5924d30c8bad152 (diff) | |
| download | rust-0eeae1abfcd8e588b41b01100db4dbc9384f6144.tar.gz rust-0eeae1abfcd8e588b41b01100db4dbc9384f6144.zip | |
diagnostics: Don't mention external crates when hitting import errors on crate imports in 2018
| -rw-r--r-- | compiler/rustc_resolve/src/lib.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/editions-crate-root-2015.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/editions-crate-root-2018.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/editions-crate-root-2018.stderr | 4 |
4 files changed, 8 insertions, 6 deletions
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 11b0ade1e83..2ce54658c0b 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -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 diff --git a/src/test/ui/editions-crate-root-2015.rs b/src/test/ui/editions-crate-root-2015.rs index fc35b001a60..4c890e3ae69 100644 --- a/src/test/ui/editions-crate-root-2015.rs +++ b/src/test/ui/editions-crate-root-2015.rs @@ -18,4 +18,4 @@ mod inner { fn main() { -} \ No newline at end of file +} diff --git a/src/test/ui/editions-crate-root-2018.rs b/src/test/ui/editions-crate-root-2018.rs index 7b96c1d294b..61e4329bbb3 100644 --- a/src/test/ui/editions-crate-root-2018.rs +++ b/src/test/ui/editions-crate-root-2018.rs @@ -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() { -} \ No newline at end of file +} diff --git a/src/test/ui/editions-crate-root-2018.stderr b/src/test/ui/editions-crate-root-2018.stderr index 7dfd3442260..967a5a2fca1 100644 --- a/src/test/ui/editions-crate-root-2018.stderr +++ b/src/test/ui/editions-crate-root-2018.stderr @@ -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 |
