-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #127203 - chenyukang:yukang-fix-120074-import, r=Nadr…
…ieril Fix import suggestion error when path segment failed not from starting Fixes #120074
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pub mod foo { | ||
pub mod bar { | ||
pub fn do_the_thing() -> usize { | ||
42 | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
println!("Hello, {}!", crate::bar::do_the_thing); //~ ERROR failed to resolve: unresolved import | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error[E0433]: failed to resolve: unresolved import | ||
--> $DIR/suggest-import-issue-120074.rs:10:35 | ||
| | ||
LL | println!("Hello, {}!", crate::bar::do_the_thing); | ||
| ^^^ unresolved import | ||
| | ||
help: a similar path exists | ||
| | ||
LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); | ||
| ~~~~~~~~ | ||
help: consider importing this module | ||
| | ||
LL + use foo::bar; | ||
| | ||
help: if you import `bar`, refer to it directly | ||
| | ||
LL - println!("Hello, {}!", crate::bar::do_the_thing); | ||
LL + println!("Hello, {}!", bar::do_the_thing); | ||
| | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0433`. |