non_local_defs: point the parent item when appropriate
This commit is contained in:
parent
98273ec612
commit
c7d300442f
13 changed files with 330 additions and 481 deletions
|
@ -1336,8 +1336,7 @@ pub enum NonLocalDefinitionsDiag {
|
|||
body_name: String,
|
||||
cargo_update: Option<NonLocalDefinitionsCargoUpdateNote>,
|
||||
const_anon: Option<Option<Span>>,
|
||||
move_help: Span,
|
||||
may_move: Vec<Span>,
|
||||
move_to: Option<(Span, Vec<Span>)>,
|
||||
may_remove: Option<(Span, String)>,
|
||||
has_trait: bool,
|
||||
self_ty_str: String,
|
||||
|
@ -1362,8 +1361,7 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
|
|||
body_name,
|
||||
cargo_update,
|
||||
const_anon,
|
||||
move_help,
|
||||
may_move,
|
||||
move_to,
|
||||
may_remove,
|
||||
has_trait,
|
||||
self_ty_str,
|
||||
|
@ -1385,11 +1383,13 @@ impl<'a> LintDiagnostic<'a, ()> for NonLocalDefinitionsDiag {
|
|||
diag.note(fluent::lint_without_trait);
|
||||
}
|
||||
|
||||
let mut ms = MultiSpan::from_span(move_help);
|
||||
for sp in may_move {
|
||||
ms.push_span_label(sp, fluent::lint_non_local_definitions_may_move);
|
||||
if let Some((move_help, may_move)) = move_to {
|
||||
let mut ms = MultiSpan::from_span(move_help);
|
||||
for sp in may_move {
|
||||
ms.push_span_label(sp, fluent::lint_non_local_definitions_may_move);
|
||||
}
|
||||
diag.span_help(ms, fluent::lint_non_local_definitions_impl_move_help);
|
||||
}
|
||||
diag.span_help(ms, fluent::lint_move_help);
|
||||
|
||||
if let Some((span, part)) = may_remove {
|
||||
diag.arg("may_remove_part", part);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue