]> git.lizzy.rs Git - rust.git/commitdiff
WIP: remove report_as_error
authorYuki OKUSHI <huyuumi.dev@gmail.com>
Sun, 24 Mar 2019 05:45:27 +0000 (14:45 +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 9f73c2aa06e6b7b0296d02f344c6cc8d6f12a2c6..964f7215088329dd59766d267fcd10026815be03 100644 (file)
@@ -641,19 +641,17 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
         let err = error_to_const_error(&ecx, error);
         // errors in statics are always emitted as fatal errors
         if tcx.is_static(def_id).is_some() {
-            let reported_err = err.report_as_error(ecx.tcx,
-                                                   "could not evaluate static initializer");
             // Ensure that if the above error was either `TooGeneric` or `Reported`
             // an error must be reported.
-            let tracked_err = tcx.sess.track_errors(|| {
+            let reported_err = tcx.sess.track_errors(|| {
                 err.report_as_error(ecx.tcx,
                                     "could not evaluate static initializer");
             });
-            match tracked_err {
-                Ok(reported_err) => tcx.sess.delay_span_bug(err.span,
+            match reported_err {
+                Ok(v) => tcx.sess.delay_span_bug(err.span,
                                         &format!("static eval failure did not emit an error: {:#?}",
-                                        reported_err)),
-                Err(_) => (),
+                                        v)),
+                Err(err) => err,
             }
             reported_err
         } else if def_id.is_local() {