diff options
| author | Jonathan Gruner <jogru0@gmail.com> | 2025-04-08 20:49:50 +0200 |
|---|---|---|
| committer | Jonathan Gruner <jogru0@gmail.com> | 2025-04-08 20:49:50 +0200 |
| commit | df6254f7a204b383bd8346880247a68dc32cab32 (patch) | |
| tree | a4f3c6107baf072de83f30027e0738c445dbfe29 /compiler/rustc_monomorphize/src | |
| parent | f820b75feef00654924c9351a2faca8d34818339 (diff) | |
report call site of inlined scopes for large assignment lints
Diffstat (limited to 'compiler/rustc_monomorphize/src')
| -rw-r--r-- | compiler/rustc_monomorphize/src/mono_checks/move_check.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/compiler/rustc_monomorphize/src/mono_checks/move_check.rs b/compiler/rustc_monomorphize/src/mono_checks/move_check.rs index 838bfdab1ea..946714e3e48 100644 --- a/compiler/rustc_monomorphize/src/mono_checks/move_check.rs +++ b/compiler/rustc_monomorphize/src/mono_checks/move_check.rs @@ -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); } } |
