Skip to content

Commit 0e76b34

Browse files
committed
WIP: remove report_as_error
1 parent ee0e1b7 commit 0e76b34

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/librustc_mir/const_eval.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -641,19 +641,17 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
641641
let err = error_to_const_error(&ecx, error);
642642
// errors in statics are always emitted as fatal errors
643643
if tcx.is_static(def_id).is_some() {
644-
let reported_err = err.report_as_error(ecx.tcx,
645-
"could not evaluate static initializer");
646644
// Ensure that if the above error was either `TooGeneric` or `Reported`
647645
// an error must be reported.
648-
let tracked_err = tcx.sess.track_errors(|| {
646+
let reported_err = tcx.sess.track_errors(|| {
649647
err.report_as_error(ecx.tcx,
650648
"could not evaluate static initializer");
651649
});
652-
match tracked_err {
653-
Ok(reported_err) => tcx.sess.delay_span_bug(err.span,
650+
match reported_err {
651+
Ok(v) => tcx.sess.delay_span_bug(err.span,
654652
&format!("static eval failure did not emit an error: {:#?}",
655-
reported_err)),
656-
Err(_) => (),
653+
v)),
654+
Err(err) => err,
657655
}
658656
reported_err
659657
} else if def_id.is_local() {

0 commit comments

Comments
 (0)