non_local_defs: use span of the impl def and not the impl block

This commit is contained in:
Urgau 2024-05-14 12:54:26 +02:00
parent de1c122950
commit 26b873d030
9 changed files with 79 additions and 180 deletions

View file

@ -219,7 +219,7 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
cx.emit_span_lint(
NON_LOCAL_DEFINITIONS,
item.span,
item.span.shrink_to_lo().to(impl_.self_ty.span),
NonLocalDefinitionsDiag::Impl {
depth: self.body_depth,
body_kind_descr: cx.tcx.def_kind_descr(parent_def_kind, parent),