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
20 changes: 20 additions & 0 deletions tests/ui/resolve/path-suggestion-duplicated-crate-keyword.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/115858>.
//!
//! The compiler used to suggest `crate::crate::unix::linux::system::Y`
//! (duplicating the `crate` keyword) instead of `crate::unix::linux::system::Y`.

pub mod unix {
pub mod linux {
pub mod utils {
pub fn f() {
let _x = crate::linux::system::Y;
//~^ ERROR cannot find `linux` in `crate`
}
}
pub mod system {
pub const Y: u32 = 0;
}
}
}

fn main() {}
23 changes: 23 additions & 0 deletions tests/ui/resolve/path-suggestion-duplicated-crate-keyword.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
error[E0433]: cannot find `linux` in `crate`
--> $DIR/path-suggestion-duplicated-crate-keyword.rs:10:33
|
LL | let _x = crate::linux::system::Y;
| ^^^^^ unresolved import
|
help: a similar path exists
|
LL | let _x = crate::unix::linux::system::Y;
| ++++++
help: consider importing this module
|
LL + use unix::linux::system;
|
help: if you import `system`, refer to it directly
|
LL - let _x = crate::linux::system::Y;
LL + let _x = system::Y;
|

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0433`.
Loading