report call site of inlined scopes for large assignment lints
This commit is contained in:
parent
f820b75fee
commit
df6254f7a2
3 changed files with 56 additions and 3 deletions
|
@ -162,13 +162,27 @@ impl<'tcx> MoveCheckVisitor<'tcx> {
|
|||
// but correct span? This would make the lint at least accept crate-level lint attributes.
|
||||
return;
|
||||
};
|
||||
|
||||
// If the source scope is inlined by the MIR inliner, report the lint on the call site.
|
||||
let reported_span = self
|
||||
.body
|
||||
.source_scopes
|
||||
.get(source_info.scope)
|
||||
.and_then(|source_scope_data| source_scope_data.inlined)
|
||||
.map(|(_, call_site)| call_site)
|
||||
.unwrap_or(span);
|
||||
|
||||
self.tcx.emit_node_span_lint(
|
||||
LARGE_ASSIGNMENTS,
|
||||
lint_root,
|
||||
span,
|
||||
LargeAssignmentsLint { span, size: too_large_size.bytes(), limit: limit as u64 },
|
||||
reported_span,
|
||||
LargeAssignmentsLint {
|
||||
span: reported_span,
|
||||
size: too_large_size.bytes(),
|
||||
limit: limit as u64,
|
||||
},
|
||||
);
|
||||
self.move_size_spans.push(span);
|
||||
self.move_size_spans.push(reported_span);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue