Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion compiler/rustc_resolve/src/diagnostics/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2944,7 +2944,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
};
let scope = match &path[..failed_segment_idx] {
[.., prev] => {
if prev.ident.name == kw::PathRoot {
if prev.ident.name == kw::PathRoot && self.tcx.sess.edition() > Edition::Edition2015
{
format!("the list of imported crates")
} else if prev.ident.name == kw::PathRoot || prev.ident.name == kw::Crate {
format!("the crate root")
Comment thread
bb1yd marked this conversation as resolved.
} else {
format!("`{}`", prev.ident)
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/issues/issue-61732.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This previously triggered an ICE.

pub(in crate::r#mod) fn main() {}
//~^ ERROR cannot find module or crate `r#mod` in `crate`
//~^ ERROR cannot find module or crate `r#mod` in the crate root
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/issues/issue-61732.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0433]: cannot find module or crate `r#mod` in `crate`
error[E0433]: cannot find module or crate `r#mod` in the crate root
--> $DIR/issue-61732.rs:3:15
|
LL | pub(in crate::r#mod) fn main() {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0433]: cannot find `bar` in `crate`
error[E0433]: cannot find `bar` in the crate root
--> $DIR/suggest-import-issue-120074.rs:14:35
|
LL | println!("Hello, {}!", crate::bar::do_the_thing);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0433]: cannot find `bar` in `crate`
error[E0433]: cannot find `bar` in the crate root
--> $DIR/suggest-import-issue-120074.rs:14:35
|
LL | println!("Hello, {}!", crate::bar::do_the_thing);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/imports/suggest-import-issue-120074.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ pub mod foo {
}

fn main() {
println!("Hello, {}!", crate::bar::do_the_thing); //~ ERROR cannot find `bar` in `crate`
println!("Hello, {}!", crate::bar::do_the_thing); //~ ERROR cannot find `bar` in the crate root
}
2 changes: 1 addition & 1 deletion tests/ui/resolve/editions-crate-root-2015.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ help: you might be missing a crate named `nonexistant`, add it to your project a
LL + extern crate nonexistant;
|

error[E0433]: cannot find module or crate `nonexistant` in `crate`
error[E0433]: cannot find module or crate `nonexistant` in the crate root
--> $DIR/editions-crate-root-2015.rs:7:30
|
LL | fn crate_inner(_: crate::nonexistant::Foo) {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/resolve/editions-crate-root-2018.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error[E0433]: cannot find `nonexistant` in the crate root
error[E0433]: cannot find `nonexistant` in the list of imported crates
--> $DIR/editions-crate-root-2018.rs:4:26
|
LL | fn global_inner(_: ::nonexistant::Foo) {
| ^^^^^^^^^^^ could not find `nonexistant` in the list of imported crates

error[E0433]: cannot find `nonexistant` in `crate`
error[E0433]: cannot find `nonexistant` in the crate root
--> $DIR/editions-crate-root-2018.rs:7:30
|
LL | fn crate_inner(_: crate::nonexistant::Foo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub mod unix {
pub mod utils {
pub fn f() {
let _x = crate::linux::system::Y;
//~^ ERROR cannot find `linux` in `crate`
//~^ ERROR cannot find `linux` in the crate root
}
}
pub mod system {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0433]: cannot find `linux` in `crate`
error[E0433]: cannot find `linux` in the crate root
--> $DIR/path-suggestion-duplicated-crate-keyword.rs:10:33
|
LL | let _x = crate::linux::system::Y;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/resolve/visibility-indeterminate.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: cannot find macro `foo` in this scope
LL | foo!();
| ^^^

error[E0433]: cannot find `bar` in the crate root
error[E0433]: cannot find `bar` in the list of imported crates
--> $DIR/visibility-indeterminate.rs:5:10
|
LL | pub(in ::bar) struct Baz {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0433]: cannot find `xcrate` in the crate root
error[E0433]: cannot find `xcrate` in the list of imported crates
--> $DIR/non-existent-2.rs:4:15
|
LL | let s = ::xcrate::S;
Expand Down
Loading