Skip to content

Commit 15ce96c

Browse files
Fix InterpError emission
1 parent a1077a1 commit 15ce96c

File tree

1 file changed

+3
-5
lines changed
  • compiler/rustc_const_eval/src/const_eval

1 file changed

+3
-5
lines changed

compiler/rustc_const_eval/src/const_eval/error.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,16 @@ where
163163
// Report as hard error.
164164
let (our_span, frames) = get_span_and_frames();
165165
let span = span.unwrap_or(our_span);
166-
let err = tcx.sess.create_err(Spanned { span, node: InterpErrorExt(error) });
167166

168-
let Some((mut err, handler)) = err.into_diagnostic() else {
169-
panic!("did not emit diag");
170-
};
167+
let handler = &tcx.sess.parse_sess.span_diagnostic;
168+
let mut err = handler.create_err(Spanned { span, node: InterpErrorExt(error)});
171169

172170
for frame in frames {
173171
err.eager_subdiagnostic(handler, frame);
174172
}
175173

176174
// Use *our* span to label the interp error
177-
ErrorHandled::Reported(handler.emit_diagnostic(&mut err).unwrap().into())
175+
ErrorHandled::Reported(err.emit().into())
178176
}
179177
}
180178
}

0 commit comments

Comments
 (0)