Skip to content

Commit 0eeae1a

Browse files
committed
diagnostics: Don't mention external crates when hitting import errors on crate imports in 2018
1 parent 9d5d669 commit 0eeae1a

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

compiler/rustc_resolve/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2433,8 +2433,10 @@ impl<'a> Resolver<'a> {
24332433
Applicability::MaybeIncorrect,
24342434
)),
24352435
)
2436-
} else {
2436+
} else if self.session.edition() == Edition::Edition2015 {
24372437
(format!("maybe a missing crate `{}`?", ident), None)
2438+
} else {
2439+
(format!("could not find `{}` in the crate root", ident), None)
24382440
}
24392441
} else if i == 0 {
24402442
if ident

src/test/ui/editions-crate-root-2015.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ mod inner {
1818

1919
fn main() {
2020

21-
}
21+
}

src/test/ui/editions-crate-root-2018.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod inner {
55
//~^ ERROR failed to resolve: could not find `nonexistant` in the list of imported crates
66
}
77
fn crate_inner(_: crate::nonexistant::Foo) {
8-
//~^ ERROR failed to resolve: maybe a missing crate `nonexistant`?
8+
//~^ ERROR failed to resolve: could not find `nonexistant` in the crate root
99
}
1010

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

1919
fn main() {
2020

21-
}
21+
}

src/test/ui/editions-crate-root-2018.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error[E0433]: failed to resolve: could not find `nonexistant` in the list of imp
44
LL | fn global_inner(_: ::nonexistant::Foo) {
55
| ^^^^^^^^^^^ could not find `nonexistant` in the list of imported crates
66

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

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

0 commit comments

Comments
 (0)