diagnostics: if AssocFn has self argument, describe as method
Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515 This commit also changes the tooltips on rustdoc intra-doc links targeting methods.
This commit is contained in:
parent
3b4d6e0804
commit
3d056c3125
25 changed files with 91 additions and 58 deletions
|
@ -124,6 +124,11 @@ pub enum DefKind {
|
|||
}
|
||||
|
||||
impl DefKind {
|
||||
/// Get an English description for the item's kind.
|
||||
///
|
||||
/// If you have access to `TyCtxt`, use `TyCtxt::def_descr` or
|
||||
/// `TyCtxt::def_kind_descr` instead, because they give better
|
||||
/// information for generators and associated functions.
|
||||
pub fn descr(self, def_id: DefId) -> &'static str {
|
||||
match self {
|
||||
DefKind::Fn => "function",
|
||||
|
@ -166,6 +171,10 @@ impl DefKind {
|
|||
}
|
||||
|
||||
/// Gets an English article for the definition.
|
||||
///
|
||||
/// If you have access to `TyCtxt`, use `TyCtxt::def_descr_article` or
|
||||
/// `TyCtxt::def_kind_descr_article` instead, because they give better
|
||||
/// information for generators and associated functions.
|
||||
pub fn article(&self) -> &'static str {
|
||||
match *self {
|
||||
DefKind::AssocTy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue