Skip to content

Commit 6264327

Browse files
Set span before emitting statement errors
1 parent 20ce01d commit 6264327

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc_mir/transform/qualify_min_const_fn.rs

+3
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ impl Visitor<'tcx, McfResult> for IsMinConstFn<'mir, 'tcx> {
221221
statement: &Statement<'tcx>,
222222
location: Location,
223223
) -> McfResult {
224+
// Setting `span` here is necessary because we don't call `super_statement` until later.
225+
self.span = statement.source_info.span;
224226
let IsMinConstFn { tcx, span, .. } = *self;
225227

226228
match &statement.kind {
@@ -323,6 +325,7 @@ impl Visitor<'tcx, McfResult> for IsMinConstFn<'mir, 'tcx> {
323325
location: Location,
324326
) -> McfResult {
325327
let IsMinConstFn { tcx, span, body, .. } = *self;
328+
326329
match kind {
327330
| TerminatorKind::FalseEdges { .. }
328331
| TerminatorKind::SwitchInt { .. }

0 commit comments

Comments
 (0)