Skip to content

Commit 3ba7454

Browse files
committed
Use track_errors
1 parent 237bf32 commit 3ba7454

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/librustc_mir/const_eval.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,14 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
645645
"could not evaluate static initializer");
646646
// Ensure that if the above error was either `TooGeneric` or `Reported`
647647
// an error must be reported.
648-
if tcx.sess.err_count() == 0 {
649-
tcx.sess.delay_span_bug(err.span,
648+
let errs = tcx.sess.track_errors(|| {
649+
tcx.sess.err_count();
650+
});
651+
match errs {
652+
Ok(_) => tcx.sess.delay_span_bug(err.span,
650653
&format!("static eval failure did not emit an error: {:#?}",
651-
reported_err));
654+
reported_err)),
655+
Err(_) => (),
652656
}
653657
reported_err
654658
} else if def_id.is_local() {

0 commit comments

Comments
 (0)