Auto merge of #108324 - notriddle:notriddle/assoc-fn-method, r=compiler-errors,davidtwco,estebank,oli-obk
diagnostics: if AssocFn has self argument, describe as method
Discussed in 329265515
This commit also changes the tooltips on rustdoc intra-doc links targeting methods.
For anyone not sure why this is being done, see the Reference definitions of these terms in <https://doc.rust-lang.org/1.67.1/reference/items/associated-items.html#methods>
> Associated functions whose first parameter is named `self` are called methods and may be invoked using the [method call operator](https://doc.rust-lang.org/1.67.1/reference/expressions/method-call-expr.html), for example, `x.foo()`, as well as the usual function call notation.
In particular, while this means it's technically correct for rustc to refer to a method as an associated function (and there are a few cases where it'll still do so), rustc *must never* use the term "method" to refer to an associated function that does not have a `self` parameter.
This commit is contained in:
commit
0978711950
160 changed files with 761 additions and 706 deletions
|
@ -694,7 +694,7 @@ impl<'tcx> DeadVisitor<'tcx> {
|
|||
})
|
||||
.collect();
|
||||
|
||||
let descr = tcx.def_kind(first_id).descr(first_id.to_def_id());
|
||||
let descr = tcx.def_descr(first_id.to_def_id());
|
||||
let num = dead_codes.len();
|
||||
let multiple = num > 6;
|
||||
let name_list = names.into();
|
||||
|
@ -706,7 +706,7 @@ impl<'tcx> DeadVisitor<'tcx> {
|
|||
};
|
||||
|
||||
let parent_info = if let Some(parent_item) = parent_item {
|
||||
let parent_descr = tcx.def_kind(parent_item).descr(parent_item.to_def_id());
|
||||
let parent_descr = tcx.def_descr(parent_item.to_def_id());
|
||||
Some(ParentInfo {
|
||||
num,
|
||||
descr,
|
||||
|
|
|
@ -523,7 +523,7 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> {
|
|||
&& stab.is_none()
|
||||
&& self.effective_visibilities.is_reachable(def_id)
|
||||
{
|
||||
let descr = self.tcx.def_kind(def_id).descr(def_id.to_def_id());
|
||||
let descr = self.tcx.def_descr(def_id.to_def_id());
|
||||
self.tcx.sess.emit_err(errors::MissingStabilityAttr { span, descr });
|
||||
}
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> {
|
|||
let is_reachable = self.effective_visibilities.is_reachable(def_id);
|
||||
|
||||
if is_const && is_stable && missing_const_stability_attribute && is_reachable {
|
||||
let descr = self.tcx.def_kind(def_id).descr(def_id.to_def_id());
|
||||
let descr = self.tcx.def_descr(def_id.to_def_id());
|
||||
self.tcx.sess.emit_err(errors::MissingConstStabAttr { span, descr });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue