use defkind.descr in wrong namespace resolve failure
This commit is contained in:
parent
bb1eedb026
commit
eb8a7031ef
3 changed files with 24 additions and 21 deletions
|
@ -2213,25 +2213,28 @@ impl<'a> Resolver<'a> {
|
||||||
} else {
|
} else {
|
||||||
let mut msg =
|
let mut msg =
|
||||||
format!("could not find `{}` in `{}`", ident, path[i - 1].ident);
|
format!("could not find `{}` in `{}`", ident, path[i - 1].ident);
|
||||||
if ns == TypeNS {
|
if ns == TypeNS || ns == ValueNS {
|
||||||
if let FindBindingResult::Binding(Ok(_)) =
|
let ns_to_try = if ns == TypeNS { ValueNS } else { TypeNS };
|
||||||
find_binding_in_ns(self, ValueNS)
|
if let FindBindingResult::Binding(Ok(binding)) =
|
||||||
|
find_binding_in_ns(self, ns_to_try)
|
||||||
{
|
{
|
||||||
msg = format!(
|
let mut found = |what| {
|
||||||
"`{}` in `{}` is a concrete value, not a module or Struct you specified",
|
msg = format!(
|
||||||
ident,
|
"expected {}, found {} `{}` in `{}`",
|
||||||
path[i - 1].ident
|
ns.descr(),
|
||||||
);
|
what,
|
||||||
};
|
ident,
|
||||||
} else if ns == ValueNS {
|
path[i - 1].ident
|
||||||
if let FindBindingResult::Binding(Ok(_)) =
|
)
|
||||||
find_binding_in_ns(self, TypeNS)
|
};
|
||||||
{
|
if binding.module().is_some() {
|
||||||
msg = format!(
|
found("module")
|
||||||
"`{}` in `{}` is a type, not a concrete value you specified",
|
} else {
|
||||||
ident,
|
match binding.res() {
|
||||||
path[i - 1].ident
|
def::Res::<NodeId>::Def(kind, id) => found(kind.descr(id)),
|
||||||
);
|
_ => found(ns_to_try.descr()),
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(msg, None)
|
(msg, None)
|
||||||
|
|
|
@ -2,5 +2,5 @@ use std::sync::mpsc;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let (tx, rx) = mpsc::channel::new(1);
|
let (tx, rx) = mpsc::channel::new(1);
|
||||||
//~^ ERROR `channel` in `mpsc` is a concrete value, not a module or Struct you specified
|
//~^ ERROR expected type, found function `channel` in `mpsc`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error[E0433]: failed to resolve: `channel` in `mpsc` is a concrete value, not a module or Struct you specified
|
error[E0433]: failed to resolve: expected type, found function `channel` in `mpsc`
|
||||||
--> $DIR/issue-71406.rs:4:26
|
--> $DIR/issue-71406.rs:4:26
|
||||||
|
|
|
|
||||||
LL | let (tx, rx) = mpsc::channel::new(1);
|
LL | let (tx, rx) = mpsc::channel::new(1);
|
||||||
| ^^^^^^^ `channel` in `mpsc` is a concrete value, not a module or Struct you specified
|
| ^^^^^^^ expected type, found function `channel` in `mpsc`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue