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};
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
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) {
// 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))
}