Skip to content

Commit 6d71fc1

Browse files
committed
for large assignment lint, use the correct span for checking for duplicate lints
1 parent df6254f commit 6d71fc1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: compiler/rustc_monomorphize/src/mono_checks/move_check.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,7 @@ impl<'tcx> MoveCheckVisitor<'tcx> {
148148
span: Span,
149149
) {
150150
let source_info = self.body.source_info(location);
151-
for reported_span in &self.move_size_spans {
152-
if reported_span.overlaps(span) {
153-
return;
154-
}
155-
}
151+
156152
let lint_root = source_info.scope.lint_root(&self.body.source_scopes);
157153
let Some(lint_root) = lint_root else {
158154
// This happens when the issue is in a function from a foreign crate that
@@ -172,6 +168,12 @@ impl<'tcx> MoveCheckVisitor<'tcx> {
172168
.map(|(_, call_site)| call_site)
173169
.unwrap_or(span);
174170

171+
for previously_reported_span in &self.move_size_spans {
172+
if previously_reported_span.overlaps(reported_span) {
173+
return;
174+
}
175+
}
176+
175177
self.tcx.emit_node_span_lint(
176178
LARGE_ASSIGNMENTS,
177179
lint_root,
@@ -182,6 +184,7 @@ impl<'tcx> MoveCheckVisitor<'tcx> {
182184
limit: limit as u64,
183185
},
184186
);
187+
185188
self.move_size_spans.push(reported_span);
186189
}
187190
}

0 commit comments

Comments
 (0)