File tree 3 files changed +14
-9
lines changed
3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -1575,11 +1575,16 @@ fn resolution_failure(
1575
1575
_ => None ,
1576
1576
} ;
1577
1577
// 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
+ } ;
1583
1588
if let Some ( span) = sp {
1584
1589
diag. span_label ( span, & note) ;
1585
1590
} else {
Original file line number Diff line number Diff line change 18
18
19
19
/// [std::io::not::here]
20
20
//~^ ERROR unresolved link
21
- //~| NOTE there is no item named `not` in scope
21
+ //~| NOTE `io` contains no item named `not`
22
22
23
23
/// [type@std::io::not::here]
24
24
//~^ ERROR unresolved link
25
- //~| NOTE there is no item named `not` in scope
25
+ //~| NOTE `io` contains no item named `not`
26
26
27
27
/// [std::io::Error::x]
28
28
//~^ 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`
26
26
--> $DIR/intra-link-errors.rs:19:6
27
27
|
28
28
LL | /// [std::io::not::here]
29
- | ^^^^^^^^^^^^^^^^^^ there is no item named `not` in scope
29
+ | ^^^^^^^^^^^^^^^^^^ the module `io` contains no item named `not`
30
30
31
31
error: unresolved link to `std::io::not::here`
32
32
--> $DIR/intra-link-errors.rs:23:6
33
33
|
34
34
LL | /// [type@std::io::not::here]
35
- | ^^^^^^^^^^^^^^^^^^^^^^^ there is no item named `not` in scope
35
+ | ^^^^^^^^^^^^^^^^^^^^^^^ the module `io` contains no item named `not`
36
36
37
37
error: unresolved link to `std::io::Error::x`
38
38
--> $DIR/intra-link-errors.rs:27:6
You can’t perform that action at this time.
0 commit comments