Rename Res::kind_name to Res::descr for consistency

This commit is contained in:
Vadim Petrochenkov 2019-05-04 15:22:00 +03:00
parent 917a0fbc1b
commit 85ddd1dc58
8 changed files with 17 additions and 17 deletions

View file

@ -41,7 +41,7 @@ impl<'a> Resolver<'a> {
let item_str = path.last().unwrap().ident;
let code = source.error_code(res.is_some());
let (base_msg, fallback_label, base_span) = if let Some(res) = res {
(format!("expected {}, found {} `{}`", expected, res.kind_name(), path_str),
(format!("expected {}, found {} `{}`", expected, res.descr(), path_str),
format!("not a {}", expected),
span)
} else {

View file

@ -1532,7 +1532,7 @@ impl<'a> NameBinding<'a> {
}
fn descr(&self) -> &'static str {
if self.is_extern_crate() { "extern crate" } else { self.res().kind_name() }
if self.is_extern_crate() { "extern crate" } else { self.res().descr() }
}
fn article(&self) -> &'static str {
@ -3868,7 +3868,7 @@ impl<'a> Resolver<'a> {
"`{}` is {} {}, not a module",
ident,
res.article(),
res.kind_name(),
res.descr(),
);
return PathResult::Failed {
@ -4220,7 +4220,7 @@ impl<'a> Resolver<'a> {
names.push(TypoSuggestion {
candidate: ident.name,
article: binding.res().article(),
kind: binding.res().kind_name(),
kind: binding.res().descr(),
});
}
}
@ -4238,7 +4238,7 @@ impl<'a> Resolver<'a> {
names.push(TypoSuggestion {
candidate: ident.name,
article: res.article(),
kind: res.kind_name(),
kind: res.descr(),
});
}
}

View file

@ -333,7 +333,7 @@ impl<'a> Resolver<'a> {
// Not only attributes, but anything in macro namespace can result in
// `Res::NonMacroAttr` definition (e.g., `inline!()`), so we must report
// an error for those cases.
let msg = format!("expected a macro, found {}", res.kind_name());
let msg = format!("expected a macro, found {}", res.descr());
self.session.span_err(path.span, &msg);
return Err(Determinacy::Determined);
}
@ -913,7 +913,7 @@ impl<'a> Resolver<'a> {
// (which is a best effort error recovery tool, basically), so we can't
// promise their resolution won't change later.
let msg = format!("inconsistent resolution for a macro: first {}, then {}",
initial_res.kind_name(), res.kind_name());
initial_res.descr(), res.descr());
this.session.span_err(span, &msg);
} else {
span_bug!(span, "inconsistent resolution for a macro");