Auto merge of #87225 - estebank:cleanup, r=oli-obk

Various diagnostics clean ups/tweaks

* Always point at macros, including derive macros
* Point at non-local items that introduce a trait requirement
* On private associated item, point at definition
This commit is contained in:
bors 2021-07-19 18:44:27 +00:00
commit d5af63480f
163 changed files with 1474 additions and 398 deletions

View file

@ -933,6 +933,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
item_name
);
err.span_label(item_name.span, &format!("private {}", kind));
let sp = self
.tcx
.hir()
.span_if_local(def_id)
.unwrap_or_else(|| self.tcx.def_span(def_id));
err.span_label(sp, &format!("private {} defined here", kind));
self.suggest_valid_traits(&mut err, out_of_scope_traits);
err.emit();
}