File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -1575,11 +1575,16 @@ fn resolution_failure(
15751575 _ => None ,
15761576 } ;
15771577 // See if this was a module: `[path]` or `[std::io::nope]`
1578- if let Some ( _module) = last_found_module {
1579- let note = format ! (
1580- "there is no item named `{}` in scope" ,
1581- unresolved
1582- ) ;
1578+ if let Some ( module) = last_found_module {
1579+ let note = if partial_res. is_some ( ) {
1580+ let module_name = collector. cx . tcx . item_name ( module) ;
1581+ format ! (
1582+ "the module `{}` contains no item named `{}`" ,
1583+ module_name, unresolved
1584+ )
1585+ } else {
1586+ format ! ( "there is no item named `{}` in scope" , unresolved)
1587+ } ;
15831588 if let Some ( span) = sp {
15841589 diag. span_label ( span, & note) ;
15851590 } else {
Original file line number Diff line number Diff line change 1818
1919/// [std::io::not::here]
2020//~^ ERROR unresolved link
21- //~| NOTE there is no item named `not` in scope
21+ //~| NOTE `io` contains no item named `not`
2222
2323/// [type@std::io::not::here]
2424//~^ ERROR unresolved link
25- //~| NOTE there is no item named `not` in scope
25+ //~| NOTE `io` contains no item named `not`
2626
2727/// [std::io::Error::x]
2828//~^ ERROR unresolved link
Original file line number Diff line number Diff line change @@ -26,13 +26,13 @@ error: unresolved link to `std::io::not::here`
2626 --> $DIR/intra-link-errors.rs:19:6
2727 |
2828LL | /// [std::io::not::here]
29- | ^^^^^^^^^^^^^^^^^^ there is no item named `not` in scope
29+ | ^^^^^^^^^^^^^^^^^^ the module `io` contains no item named `not`
3030
3131error: unresolved link to `std::io::not::here`
3232 --> $DIR/intra-link-errors.rs:23:6
3333 |
3434LL | /// [type@std::io::not::here]
35- | ^^^^^^^^^^^^^^^^^^^^^^^ there is no item named `not` in scope
35+ | ^^^^^^^^^^^^^^^^^^^^^^^ the module `io` contains no item named `not`
3636
3737error: unresolved link to `std::io::Error::x`
3838 --> $DIR/intra-link-errors.rs:27:6
You can’t perform that action at this time.
0 commit comments