]> git.lizzy.rs Git - rust.git/commitdiff
Use track_errors
authorYuki OKUSHI <huyuumi.dev@gmail.com>
Thu, 21 Mar 2019 19:38:22 +0000 (04:38 +0900)
committerYuki OKUSHI <huyuumi.dev@gmail.com>
Thu, 28 Mar 2019 19:32:36 +0000 (04:32 +0900)
src/librustc_mir/const_eval.rs

index 6ab89f80ef528433535e3d5e3a95558e328d1de0..0cf6c4593e8ddae5c6abcbf5c0baeaacfddc0fd9 100644 (file)
@@ -645,10 +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.
-            if tcx.sess.err_count() == 0 {
-                tcx.sess.delay_span_bug(err.span,
+            let errs = tcx.sess.track_errors(|| {
+                tcx.sess.err_count();
+            });
+            match errs {
+                Ok(_) => tcx.sess.delay_span_bug(err.span,
                                         &format!("static eval failure did not emit an error: {:#?}",
-                                                 reported_err));
+                                        reported_err)),
+                Err(_) => (),
             }
             reported_err
         } else if def_id.is_local() {