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
|
@ -2135,7 +2135,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
|
||||
let tcx = self.infcx.tcx;
|
||||
|
||||
let (_, escapes_from) = tcx.article_and_description(self.mir_def_id().to_def_id());
|
||||
let escapes_from = tcx.def_descr(self.mir_def_id().to_def_id());
|
||||
|
||||
let mut err =
|
||||
borrowck_errors::borrowed_data_escapes_closure(tcx, escape_span, escapes_from);
|
||||
|
|
|
@ -660,10 +660,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||
errci.outlived_fr,
|
||||
);
|
||||
|
||||
let (_, escapes_from) = self
|
||||
.infcx
|
||||
.tcx
|
||||
.article_and_description(self.regioncx.universal_regions().defining_ty.def_id());
|
||||
let escapes_from =
|
||||
self.infcx.tcx.def_descr(self.regioncx.universal_regions().defining_ty.def_id());
|
||||
|
||||
// Revert to the normal error in these cases.
|
||||
// Assignments aren't "escapes" in function items.
|
||||
|
@ -757,8 +755,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||
..
|
||||
} = errci;
|
||||
|
||||
let (_, mir_def_name) =
|
||||
self.infcx.tcx.article_and_description(self.mir_def_id().to_def_id());
|
||||
let mir_def_name = self.infcx.tcx.def_descr(self.mir_def_id().to_def_id());
|
||||
|
||||
let err = LifetimeOutliveErr { span: *span };
|
||||
let mut diag = self.infcx.tcx.sess.create_err(err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue