Skip to content

Commit 1f582be

Browse files
committed
Add missing DiagnosticBuilder::eager_diagnostic method.
This lets us avoid the use of `DiagnosticBuilder::into_diagnostic` in miri, when then means that `DiagnosticBuilder::into_diagnostic` can become private, being now only used by `stash` and `buffer`.
1 parent ceaec15 commit 1f582be

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/diagnostics.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,22 +499,20 @@ pub fn report_msg<'tcx>(
499499
err.note(if extra_span { "BACKTRACE (of the first span):" } else { "BACKTRACE:" });
500500
}
501501

502-
let (mut err, handler) = err.into_diagnostic().unwrap();
503-
504502
// Add backtrace
505503
for (idx, frame_info) in stacktrace.iter().enumerate() {
506504
let is_local = machine.is_local(frame_info);
507505
// No span for non-local frames and the first frame (which is the error site).
508506
if is_local && idx > 0 {
509-
err.eager_subdiagnostic(handler, frame_info.as_note(machine.tcx));
507+
err.eager_subdiagnostic(err.dcx, frame_info.as_note(machine.tcx));
510508
} else {
511509
let sm = sess.source_map();
512510
let span = sm.span_to_embeddable_string(frame_info.span);
513511
err.note(format!("{frame_info} at {span}"));
514512
}
515513
}
516514

517-
handler.emit_diagnostic(err);
515+
err.emit();
518516
}
519517

520518
impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {

0 commit comments

Comments
 (0)