Use old error when there's partial resolution
The new error was confusing when there was partial resolution (something like `std::io::nonexistent`); the old one is better for those cases.
This commit is contained in:
parent
0193a8871c
commit
21fb9dfa8d
3 changed files with 14 additions and 9 deletions
|
@ -1575,11 +1575,16 @@ fn resolution_failure(
|
|||
_ => None,
|
||||
};
|
||||
// See if this was a module: `[path]` or `[std::io::nope]`
|
||||
if let Some(_module) = last_found_module {
|
||||
let note = format!(
|
||||
"there is no item named `{}` in scope",
|
||||
unresolved
|
||||
);
|
||||
if let Some(module) = last_found_module {
|
||||
let note = if partial_res.is_some() {
|
||||
let module_name = collector.cx.tcx.item_name(module);
|
||||
format!(
|
||||
"the module `{}` contains no item named `{}`",
|
||||
module_name, unresolved
|
||||
)
|
||||
} else {
|
||||
format!("there is no item named `{}` in scope", unresolved)
|
||||
};
|
||||
if let Some(span) = sp {
|
||||
diag.span_label(span, ¬e);
|
||||
} else {
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
|
||||
/// [std::io::not::here]
|
||||
//~^ ERROR unresolved link
|
||||
//~| NOTE there is no item named `not` in scope
|
||||
//~| NOTE `io` contains no item named `not`
|
||||
|
||||
/// [type@std::io::not::here]
|
||||
//~^ ERROR unresolved link
|
||||
//~| NOTE there is no item named `not` in scope
|
||||
//~| NOTE `io` contains no item named `not`
|
||||
|
||||
/// [std::io::Error::x]
|
||||
//~^ ERROR unresolved link
|
||||
|
|
|
@ -26,13 +26,13 @@ error: unresolved link to `std::io::not::here`
|
|||
--> $DIR/intra-link-errors.rs:19:6
|
||||
|
|
||||
LL | /// [std::io::not::here]
|
||||
| ^^^^^^^^^^^^^^^^^^ there is no item named `not` in scope
|
||||
| ^^^^^^^^^^^^^^^^^^ the module `io` contains no item named `not`
|
||||
|
||||
error: unresolved link to `std::io::not::here`
|
||||
--> $DIR/intra-link-errors.rs:23:6
|
||||
|
|
||||
LL | /// [type@std::io::not::here]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ there is no item named `not` in scope
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ the module `io` contains no item named `not`
|
||||
|
||||
error: unresolved link to `std::io::Error::x`
|
||||
--> $DIR/intra-link-errors.rs:27:6
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue