Skip to content

Commit 60c8f35

Browse files
committed
Auto merge of #119751 - nnethercote:error-api-fixes, r=oli-obk
Diagnostic API fixes Some improvements to diagnostic APIs: improve some naming, use shortcuts in more places, and add a couple of missing methods. r? `@compiler-errors`
2 parents c368b4c + 1f582be commit 60c8f35

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)