From 526b3558581187c87ca8ca533254c1cbb6275e7b Mon Sep 17 00:00:00 2001 From: Yuki OKUSHI Date: Sat, 23 Mar 2019 00:03:50 +0900 Subject: [PATCH] Remove err_count --- src/librustc_mir/const_eval.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 0cf6c4593e8..80076c6f035 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -645,13 +645,14 @@ pub fn const_eval_raw_provider<'a, 'tcx>( "could not evaluate static initializer"); // Ensure that if the above error was either `TooGeneric` or `Reported` // an error must be reported. - let errs = tcx.sess.track_errors(|| { - tcx.sess.err_count(); + let tracked_err = tcx.sess.track_errors(|| { + err.report_as_error(ecx.tcx, + "could not evaluate static initializer"); }); - match errs { + match tracked_err { Ok(_) => tcx.sess.delay_span_bug(err.span, &format!("static eval failure did not emit an error: {:#?}", - reported_err)), + tracked_err)), Err(_) => (), } reported_err -- 2.44.0