]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #59199 - estebank:untrack-errors, r=eddyb
authorbors <bors@rust-lang.org>
Sun, 24 Mar 2019 05:38:10 +0000 (05:38 +0000)
committerbors <bors@rust-lang.org>
Sun, 24 Mar 2019 05:38:10 +0000 (05:38 +0000)
Remove `track_errors` from `check_match`, `typeck_item_bodies` and `register_plugins`

In the spirit of continuing through errors in type checking (#39275), remove `track_errors` from a couple of locations in the codebase.

1  2 
src/librustc_mir/const_eval.rs
src/librustc_typeck/check/mod.rs

index 08ede2f5e80a47288ad50f8746b82bffa67b529e,2e15f0de69f7019b064116ed0678daccadf3aa89..8c774e0d54cced74b57d1fb037c4127ed9df4b0e
@@@ -15,7 -15,6 +15,6 @@@ use rustc::ty::layout::{self, LayoutOf
  use rustc::ty::subst::Subst;
  use rustc::traits::Reveal;
  use rustc_data_structures::fx::FxHashMap;
- use rustc::util::common::ErrorReported;
  
  use syntax::ast::Mutability;
  use syntax::source_map::{Span, DUMMY_SP};
@@@ -619,9 -618,8 +618,8 @@@ pub fn const_eval_raw_provider<'a, 'tcx
          let tables = tcx.typeck_tables_of(def_id);
  
          // Do match-check before building MIR
-         if let Err(ErrorReported) = tcx.check_match(def_id) {
-             return Err(ErrorHandled::Reported)
-         }
+         // FIXME(#59378) check_match may have errored but we're not checking for that anymore
+         tcx.check_match(def_id);
  
          if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(id) {
              tcx.mir_const_qualif(def_id);
                          tcx.at(tcx.def_span(def_id)),
                          "any use of this value will cause an error",
                          hir_id,
 +                        Some(err.span),
                      )
                  },
                  // promoting runtime code is only allowed to error if it references broken constants
                              tcx.at(span),
                              "reaching this expression at runtime will panic or abort",
                              tcx.hir().as_local_hir_id(def_id).unwrap(),
 +                            Some(err.span),
                          )
                      }
                  // anything else (array lengths, enum initializers, constant patterns) are reported
index a11327b24beb591b18d21c7cb5d2bf429954c8e5,06ae097d9f08095bbe5e2aab29974e02ae0baf4d..1054619f0f808c042ba62ca9af551d78618556bd
@@@ -702,15 -702,11 +702,11 @@@ fn check_mod_item_types<'tcx>(tcx: TyCt
      tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx });
  }
  
- fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum)
-                                 -> Result<(), ErrorReported>
- {
+ fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) {
      debug_assert!(crate_num == LOCAL_CRATE);
-     Ok(tcx.sess.track_errors(|| {
-         tcx.par_body_owners(|body_owner_def_id| {
-             tcx.ensure().typeck_tables_of(body_owner_def_id);
-         });
-     })?)
+     tcx.par_body_owners(|body_owner_def_id| {
+         tcx.ensure().typeck_tables_of(body_owner_def_id);
+     });
  }
  
  fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) {
@@@ -5016,9 -5012,10 +5012,9 @@@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, '
                      // that highlight errors inline.
                      let mut sp = blk.span;
                      let mut fn_span = None;
 -                    let blk_node_id = self.tcx.hir().hir_to_node_id(blk.hir_id);
 -                    if let Some((decl, ident)) = self.get_parent_fn_decl(blk_node_id) {
 +                    if let Some((decl, ident)) = self.get_parent_fn_decl(blk.hir_id) {
                          let ret_sp = decl.output.span();
 -                        if let Some(block_sp) = self.parent_item_span(blk_node_id) {
 +                        if let Some(block_sp) = self.parent_item_span(blk.hir_id) {
                              // HACK: on some cases (`ui/liveness/liveness-issue-2163.rs`) the
                              // output would otherwise be incorrect and even misleading. Make sure
                              // the span we're aiming at correspond to a `fn` body.
          ty
      }
  
 -    fn parent_item_span(&self, id: ast::NodeId) -> Option<Span> {
 -        let node = self.tcx.hir().get(self.tcx.hir().get_parent(id));
 +    fn parent_item_span(&self, id: hir::HirId) -> Option<Span> {
 +        let node = self.tcx.hir().get_by_hir_id(self.tcx.hir().get_parent_item(id));
          match node {
              Node::Item(&hir::Item {
                  node: hir::ItemKind::Fn(_, _, _, body_id), ..
          None
      }
  
 -    /// Given a function block's `NodeId`, returns its `FnDecl` if it exists, or `None` otherwise.
 -    fn get_parent_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl, ast::Ident)> {
 -        let parent = self.tcx.hir().get(self.tcx.hir().get_parent(blk_id));
 +    /// Given a function block's `HirId`, returns its `FnDecl` if it exists, or `None` otherwise.
 +    fn get_parent_fn_decl(&self, blk_id: hir::HirId) -> Option<(hir::FnDecl, ast::Ident)> {
 +        let parent = self.tcx.hir().get_by_hir_id(self.tcx.hir().get_parent_item(blk_id));
          self.get_node_fn_decl(parent).map(|(fn_decl, ident, _)| (fn_decl, ident))
      }