about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-03-14 19:16:31 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-03-22 20:15:32 -0700
commitd1808aa509f2291644b9dad89e883e3ec0f01400 (patch)
treea79ec715c4583bea6a52c88e96a35d862f0f44a3 /src
parent9f91bee03f3eea93285330354dda54706028671c (diff)
downloadrust-d1808aa509f2291644b9dad89e883e3ec0f01400.tar.gz
rust-d1808aa509f2291644b9dad89e883e3ec0f01400.zip
Remove track_errors from check_match
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/build/matches/mod.rs7
-rw-r--r--src/librustc_mir/hair/pattern/check_match.rs17
2 files changed, 14 insertions, 10 deletions
diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs
index d3731e7c127..12aae2f385e 100644
--- a/src/librustc_mir/build/matches/mod.rs
+++ b/src/librustc_mir/build/matches/mod.rs
@@ -438,7 +438,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
         // always convert all match-pairs into bindings.
         self.simplify_candidate(&mut candidate);
 
-        if !candidate.match_pairs.is_empty() {
+        if !candidate.match_pairs.is_empty() && self.hir.tcx().sess.err_count() == 0 {
+            // Only abort compilation if no other errors have been emitted. This used to be a hard
+            // error that wouldn't be reached because `hair::pattern::check_match::check_match`
+            // wouldn't have let the compiler continue. In our tests this is only ever hit by
+            // `ui/consts/const-match-check.rs` with `--cfg eval1`, and that file already generates
+            // a different error before hand.
             span_bug!(
                 candidate.match_pairs[0].pattern.span,
                 "match pairs {:?} remaining after simplifying \
diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs
index 49967df0889..39f127c07d7 100644
--- a/src/librustc_mir/hair/pattern/check_match.rs
+++ b/src/librustc_mir/hair/pattern/check_match.rs
@@ -37,15 +37,14 @@ pub(crate) fn check_match<'a, 'tcx>(
         return Ok(());
     };
 
-    tcx.sess.track_errors(|| {
-        MatchVisitor {
-            tcx,
-            tables: tcx.body_tables(body_id),
-            region_scope_tree: &tcx.region_scope_tree(def_id),
-            param_env: tcx.param_env(def_id),
-            identity_substs: InternalSubsts::identity_for_item(tcx, def_id),
-        }.visit_body(tcx.hir().body(body_id));
-    })
+    MatchVisitor {
+        tcx,
+        tables: tcx.body_tables(body_id),
+        region_scope_tree: &tcx.region_scope_tree(def_id),
+        param_env: tcx.param_env(def_id),
+        identity_substs: InternalSubsts::identity_for_item(tcx, def_id),
+    }.visit_body(tcx.hir().body(body_id));
+    Ok(())
 }
 
 fn create_e0004<'a>(sess: &'a Session, sp: Span, error_message: String) -> DiagnosticBuilder<'a> {