diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs index fac498bd6dd78..e63fa230b3eba 100644 --- a/src/librustc/infer/error_reporting/need_type_info.rs +++ b/src/librustc/infer/error_reporting/need_type_info.rs @@ -16,9 +16,9 @@ struct FindLocalByTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> FindLocalByTypeVisitor<'a, 'gcx, 'tcx> { - fn node_matches_type(&mut self, node_id: HirId) -> bool { + fn node_matches_type(&mut self, hir_id: HirId) -> bool { let ty_opt = self.infcx.in_progress_tables.and_then(|tables| { - tables.borrow().node_id_to_type_opt(node_id) + tables.borrow().node_type_opt(hir_id) }); match ty_opt { Some(ty) => { diff --git a/src/librustc/infer/error_reporting/nice_region_error/util.rs b/src/librustc/infer/error_reporting/nice_region_error/util.rs index f73f8d8bb82be..6db1bc382afe9 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/util.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/util.rs @@ -64,7 +64,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { // May return None; sometimes the tables are not yet populated. let ty_hir_id = fn_decl.inputs[index].hir_id; let arg_ty_span = hir.span(hir.hir_to_node_id(ty_hir_id)); - let ty = tables.node_id_to_type_opt(arg.hir_id)?; + let ty = tables.node_type_opt(arg.hir_id)?; let mut found_anon_region = false; let new_arg_ty = self.tcx().fold_regions(&ty, &mut false, |r, _| { if *r == *anon_region { diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 6dffe8efba612..569968bd6d4bf 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -112,7 +112,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { fn handle_field_pattern_match(&mut self, lhs: &hir::Pat, def: Def, pats: &[source_map::Spanned]) { - let variant = match self.tables.node_id_to_type(lhs.hir_id).sty { + let variant = match self.tables.node_type(lhs.hir_id).sty { ty::Adt(adt, _) => adt.variant_of_def(def), _ => span_bug!(lhs.span, "non-ADT in struct pattern") }; diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index ee361e9776313..ce20ca39533b1 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -165,7 +165,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ExprVisitor<'a, 'tcx> { }; if let Def::Fn(did) = def { if self.def_id_is_transmute(did) { - let typ = self.tables.node_id_to_type(expr.hir_id); + let typ = self.tables.node_type(expr.hir_id); let sig = typ.fn_sig(self.tcx); let from = sig.inputs().skip_binder()[0]; let to = *sig.output().skip_binder(); diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 04e4a0b39a2ca..edc2a112b95ed 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -174,7 +174,7 @@ pub enum Note { // which the value is stored. // // *WARNING* The field `cmt.type` is NOT necessarily the same as the -// result of `node_id_to_type(cmt.id)`. +// result of `node_type(cmt.id)`. // // (FIXME: rewrite the following comment given that `@x` managed // pointers have been obsolete for quite some time.) @@ -497,7 +497,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { hir_id: hir::HirId) -> McResult> { self.resolve_type_vars_or_error(hir_id, - self.tables.node_id_to_type_opt(hir_id)) + self.tables.node_type_opt(hir_id)) } pub fn expr_ty(&self, expr: &hir::Expr) -> McResult> { diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index c955b042e44d1..6934373e981c8 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -525,17 +525,14 @@ impl<'tcx> TypeckTables<'tcx> { } } - pub fn node_id_to_type(&self, id: hir::HirId) -> Ty<'tcx> { - self.node_id_to_type_opt(id).unwrap_or_else(|| - bug!("node_id_to_type: no type for node `{}`", - tls::with(|tcx| { - let id = tcx.hir().hir_to_node_id(id); - tcx.hir().node_to_string(id) - })) + pub fn node_type(&self, id: hir::HirId) -> Ty<'tcx> { + self.node_type_opt(id).unwrap_or_else(|| + bug!("node_type: no type for node `{}`", + tls::with(|tcx| tcx.hir().hir_to_string(id))) ) } - pub fn node_id_to_type_opt(&self, id: hir::HirId) -> Option> { + pub fn node_type_opt(&self, id: hir::HirId) -> Option> { validate_hir_id_for_typeck_tables(self.local_id_root, id, false); self.node_types.get(&id.local_id).cloned() } @@ -560,11 +557,11 @@ impl<'tcx> TypeckTables<'tcx> { // Returns the type of a pattern as a monotype. Like @expr_ty, this function // doesn't provide type parameter substitutions. pub fn pat_ty(&self, pat: &hir::Pat) -> Ty<'tcx> { - self.node_id_to_type(pat.hir_id) + self.node_type(pat.hir_id) } pub fn pat_ty_opt(&self, pat: &hir::Pat) -> Option> { - self.node_id_to_type_opt(pat.hir_id) + self.node_type_opt(pat.hir_id) } // Returns the type of an expression as a monotype. @@ -578,11 +575,11 @@ impl<'tcx> TypeckTables<'tcx> { // ask for the type of "id" in "id(3)", it will return "fn(&isize) -> isize" // instead of "fn(ty) -> T with T = isize". pub fn expr_ty(&self, expr: &hir::Expr) -> Ty<'tcx> { - self.node_id_to_type(expr.hir_id) + self.node_type(expr.hir_id) } pub fn expr_ty_opt(&self, expr: &hir::Expr) -> Option> { - self.node_id_to_type_opt(expr.hir_id) + self.node_type_opt(expr.hir_id) } pub fn adjustments(&self) -> LocalTableInContext<'_, Vec>> { diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs index 8214c8bacc704..388eafb826fb1 100644 --- a/src/librustc/ty/item_path.rs +++ b/src/librustc/ty/item_path.rs @@ -1,4 +1,3 @@ -use crate::hir; use crate::hir::map::DefPathData; use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use crate::ty::{self, DefIdTree, Ty, TyCtxt}; @@ -77,11 +76,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.item_path_str(self.hir().local_def_id(id)) } - // FIXME(@ljedrz): replace the NodeId variant - pub fn hir_path_str(self, id: hir::HirId) -> String { - self.item_path_str(self.hir().local_def_id_from_hir_id(id)) - } - /// Returns a string identifying this def-id. This string is /// suitable for user output. It always begins with a crate identifier. pub fn absolute_item_path_str(self, def_id: DefId) -> String { diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index c21a43bc68333..ee3aabe89d004 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -149,7 +149,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { fn decl_without_init(&mut self, id: ast::NodeId, _span: Span) { let ty = self.bccx .tables - .node_id_to_type(self.bccx.tcx.hir().node_to_hir_id(id)); + .node_type(self.bccx.tcx.hir().node_to_hir_id(id)); gather_moves::gather_decl(self.bccx, &self.move_data, id, ty); } } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index cbcc7f3574d03..442e54dc48696 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -155,7 +155,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers { } fn check_expr(&mut self, cx: &LateContext<'_, '_>, e: &hir::Expr) { - let ty = cx.tables.node_id_to_type(e.hir_id); + let ty = cx.tables.node_type(e.hir_id); self.check_heap_type(cx, e.span, ty); } } @@ -1000,7 +1000,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes { if !def_id_is_transmute(cx, did) { return None; } - let sig = cx.tables.node_id_to_type(expr.hir_id).fn_sig(cx.tcx); + let sig = cx.tables.node_type(expr.hir_id).fn_sig(cx.tcx); let from = sig.inputs().skip_binder()[0]; let to = *sig.output().skip_binder(); return Some((&from.sty, &to.sty)); diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index f6b7ccfe2ecd8..3e02c14fc1baf 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -85,7 +85,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { } } hir::ExprKind::Lit(ref lit) => { - match cx.tables.node_id_to_type(e.hir_id).sty { + match cx.tables.node_type(e.hir_id).sty { ty::Int(t) => { match lit.node { ast::LitKind::Int(v, ast::LitIntType::Signed(_)) | @@ -257,7 +257,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { // Normalize the binop so that the literal is always on the RHS in // the comparison let norm_binop = if swap { rev_binop(binop) } else { binop }; - match cx.tables.node_id_to_type(expr.hir_id).sty { + match cx.tables.node_type(expr.hir_id).sty { ty::Int(int_ty) => { let (min, max) = int_ty_range(int_ty); let lit_val: i128 = match lit.node { @@ -400,7 +400,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { repr_str, val, t, actually, t )); if let Some(sugg_ty) = - get_type_suggestion(&cx.tables.node_id_to_type(expr.hir_id).sty, val, negative) + get_type_suggestion(&cx.tables.node_type(expr.hir_id).sty, val, negative) { if let Some(pos) = repr_str.chars().position(|c| c == 'i' || c == 'u') { let (sans_suffix, _) = repr_str.split_at(pos); diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index d68ab9750b970..ec49ef3f6e046 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1338,7 +1338,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { let tables = self.tcx.typeck_tables_of(def_id); let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); let hir_id = self.tcx.hir().node_to_hir_id(node_id); - let kind = match tables.node_id_to_type(hir_id).sty { + let kind = match tables.node_type(hir_id).sty { ty::Generator(def_id, ..) => { let layout = self.tcx.generator_layout(def_id); let data = GeneratorData { diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index afb26963217ff..c7d3bf14f5e0c 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -1178,7 +1178,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let escapes_from = if tcx.is_closure(self.mir_def_id) { let tables = tcx.typeck_tables_of(self.mir_def_id); let mir_hir_id = tcx.hir().def_index_to_hir_id(self.mir_def_id.index); - match tables.node_id_to_type(mir_hir_id).sty { + match tables.node_type(mir_hir_id).sty { ty::Closure(..) => "closure", ty::Generator(..) => "generator", _ => bug!("Closure body doesn't have a closure or generator type"), diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index 0a214e60bdd78..cdd0c6f807595 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -482,7 +482,7 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> { tcx.type_of(closure_base_def_id) } else { let tables = tcx.typeck_tables_of(self.mir_def_id); - tables.node_id_to_type(self.mir_hir_id) + tables.node_type(self.mir_hir_id) }; debug!("defining_ty (pre-replacement): {:?}", defining_ty); diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index a52b032aeb508..dfe9c16cb5893 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -92,7 +92,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t Some(ArgInfo(liberated_closure_env_ty(tcx, id, body_id), None, None, None)) } ty::Generator(..) => { - let gen_ty = tcx.body_tables(body_id).node_id_to_type(fn_hir_id); + let gen_ty = tcx.body_tables(body_id).node_type(fn_hir_id); Some(ArgInfo(gen_ty, None, None, None)) } _ => None, @@ -263,7 +263,7 @@ fn liberated_closure_env_ty<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, body_id: hir::BodyId) -> Ty<'tcx> { let closure_expr_hir_id = tcx.hir().node_to_hir_id(closure_expr_id); - let closure_ty = tcx.body_tables(body_id).node_id_to_type(closure_expr_hir_id); + let closure_ty = tcx.body_tables(body_id).node_type(closure_expr_hir_id); let (closure_def_id, closure_substs) = match closure_ty.sty { ty::Closure(closure_def_id, closure_substs) => (closure_def_id, closure_substs), diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index c24cf956504da..4e7bfbc4ab5d2 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -115,7 +115,7 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, pub fn to_expr_ref<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, block: &'tcx hir::Block) -> ExprRef<'tcx> { - let block_ty = cx.tables().node_id_to_type(block.hir_id); + let block_ty = cx.tables().node_type(block.hir_id); let temp_lifetime = cx.region_scope_tree.temporary_scope(block.hir_id.local_id); let expr = Expr { ty: block_ty, diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 7e1365f5dc12d..10d04a80d7341 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -304,7 +304,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, } } else { ExprKind::Call { - ty: cx.tables().node_id_to_type(fun.hir_id), + ty: cx.tables().node_type(fun.hir_id), fun: fun.to_ref(), args: args.to_ref(), from_hir_call: true, @@ -677,7 +677,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let def = cx.tables().qpath_def(qpath, source.hir_id); cx .tables() - .node_id_to_type(source.hir_id) + .node_type(source.hir_id) .ty_adt_def() .and_then(|adt_def| { match def { @@ -919,7 +919,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, debug!("convert_path_expr: user_ty={:?}", user_ty); ExprKind::Literal { literal: cx.tcx.mk_lazy_const(ty::LazyConst::Evaluated(ty::Const::zero_sized( - cx.tables().node_id_to_type(expr.hir_id), + cx.tables().node_type(expr.hir_id), ))), user_ty, } @@ -940,7 +940,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let user_provided_types = cx.tables.user_provided_types(); let user_provided_type = user_provided_types.get(expr.hir_id).map(|u_ty| *u_ty); debug!("convert_path_expr: user_provided_type={:?}", user_provided_type); - match cx.tables().node_id_to_type(expr.hir_id).sty { + match cx.tables().node_type(expr.hir_id).sty { // A unit struct/variant which is used as a value. // We return a completely different ExprKind here to account for this special case. ty::Adt(adt_def, substs) => { @@ -980,11 +980,11 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, index, closure_expr_id); let var_hir_id = cx.tcx.hir().node_to_hir_id(var_id); - let var_ty = cx.tables().node_id_to_type(var_hir_id); + let var_ty = cx.tables().node_type(var_hir_id); // FIXME free regions in closures are not right let closure_ty = cx.tables() - .node_id_to_type(cx.tcx.hir().node_to_hir_id(closure_expr_id)); + .node_type(cx.tcx.hir().node_to_hir_id(closure_expr_id)); // FIXME we're just hard-coding the idea that the // signature will be &self or &mut self and hence will @@ -1188,7 +1188,7 @@ fn capture_freevar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }; let upvar_capture = cx.tables().upvar_capture(upvar_id); let temp_lifetime = cx.region_scope_tree.temporary_scope(closure_expr.hir_id.local_id); - let var_ty = cx.tables().node_id_to_type(var_hir_id); + let var_ty = cx.tables().node_type(var_hir_id); let captured_var = Expr { temp_lifetime, ty: var_ty, diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 978051aab591b..5616a5c2feeba 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -202,7 +202,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { // Then, if the match has no arms, check whether the scrutinee // is uninhabited. - let pat_ty = self.tables.node_id_to_type(scrut.hir_id); + let pat_ty = self.tables.node_type(scrut.hir_id); let module = self.tcx.hir().get_module_parent(scrut.id); if inlined_arms.is_empty() { let scrutinee_is_uninhabited = if self.tcx.features().exhaustive_patterns { @@ -235,7 +235,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { .flat_map(|arm| &arm.0) .map(|pat| smallvec![pat.0]) .collect(); - let scrut_ty = self.tables.node_id_to_type(scrut.hir_id); + let scrut_ty = self.tables.node_type(scrut.hir_id); check_exhaustive(cx, scrut_ty, scrut.span, &matrix); }) } @@ -507,7 +507,7 @@ fn check_legality_of_move_bindings(cx: &MatchVisitor<'_, '_>, if let Some(&bm) = cx.tables.pat_binding_modes().get(p.hir_id) { match bm { ty::BindByValue(..) => { - let pat_ty = cx.tables.node_id_to_type(p.hir_id); + let pat_ty = cx.tables.node_type(p.hir_id); if !pat_ty.is_copy_modulo_regions(cx.tcx, cx.param_env, pat.span) { check_move(p, sub.as_ref().map(|p| &**p), span_vec); } diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 84d8f32954c81..18e1af27bab38 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -406,7 +406,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat) -> Pattern<'tcx> { - let mut ty = self.tables.node_id_to_type(pat.hir_id); + let mut ty = self.tables.node_type(pat.hir_id); let kind = match pat.node { PatKind::Wild => PatternKind::Wild, @@ -539,7 +539,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } PatKind::Binding(_, id, _, ident, ref sub) => { - let var_ty = self.tables.node_id_to_type(pat.hir_id); + let var_ty = self.tables.node_type(pat.hir_id); if let ty::Error = var_ty.sty { // Avoid ICE return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; @@ -773,7 +773,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { id: hir::HirId, span: Span) -> Pattern<'tcx> { - let ty = self.tables.node_id_to_type(id); + let ty = self.tables.node_type(id); let def = self.tables.qpath_def(qpath, id); let is_associated_const = match def { Def::AssociatedConst(_) => true, diff --git a/src/librustc_mir/hair/util.rs b/src/librustc_mir/hair/util.rs index cb4a72387fa16..4618cd42686fa 100644 --- a/src/librustc_mir/hair/util.rs +++ b/src/librustc_mir/hair/util.rs @@ -16,7 +16,7 @@ crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> { let user_provided_types = self.tables().user_provided_types(); let mut user_ty = *user_provided_types.get(hir_id)?; debug!("user_subts_applied_to_ty_of_hir_id: user_ty={:?}", user_ty); - match &self.tables().node_id_to_type(hir_id).sty { + match &self.tables().node_type(hir_id).sty { ty::Adt(adt_def, ..) => { if let UserType::TypeOf(ref mut did, _) = &mut user_ty.value { *did = adt_def.did; diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 8d33fef5303ed..7f245c48166d6 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -244,7 +244,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { } fn check_expr(&mut self, ex: &'tcx hir::Expr) -> Promotability { - let node_ty = self.tables.node_id_to_type(ex.hir_id); + let node_ty = self.tables.node_type(ex.hir_id); let mut outer = check_expr_kind(self, ex, node_ty); outer &= check_adjustments(self, ex); @@ -306,7 +306,7 @@ fn check_expr_kind<'a, 'tcx>( if v.tables.is_method_call(e) { return NotPromotable; } - match v.tables.node_id_to_type(lhs.hir_id).sty { + match v.tables.node_type(lhs.hir_id).sty { ty::RawPtr(_) | ty::FnPtr(..) => { assert!(op.node == hir::BinOpKind::Eq || op.node == hir::BinOpKind::Ne || op.node == hir::BinOpKind::Le || op.node == hir::BinOpKind::Lt || diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 14a0922c47740..c395dffdc9799 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -932,7 +932,7 @@ impl<'a, 'tcx> TypePrivacyVisitor<'a, 'tcx> { // Take node-id of an expression or pattern and check its type for privacy. fn check_expr_pat_type(&mut self, id: hir::HirId, span: Span) -> bool { self.span = span; - if self.visit(self.tables.node_id_to_type(id)) || self.visit(self.tables.node_substs(id)) { + if self.visit(self.tables.node_type(id)) || self.visit(self.tables.node_substs(id)) { return true; } if let Some(adjustments) = self.tables.adjustments().get(id) { @@ -979,7 +979,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { self.span = hir_ty.span; if self.in_body { // Types in bodies. - if self.visit(self.tables.node_id_to_type(hir_ty.hir_id)) { + if self.visit(self.tables.node_type(hir_ty.hir_id)) { return; } } else { diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 1a49056bc7f26..0bb1ce9e4bde9 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -245,7 +245,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { for (id, ident, ..) in collector.collected_idents { let hir_id = self.tcx.hir().node_to_hir_id(id); - let typ = match self.save_ctxt.tables.node_id_to_type_opt(hir_id) { + let typ = match self.save_ctxt.tables.node_type_opt(hir_id) { Some(s) => s.to_string(), None => continue, }; @@ -863,7 +863,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { PatKind::Struct(ref _path, ref fields, _) => { // FIXME do something with _path? let hir_id = self.tcx.hir().node_to_hir_id(p.id); - let adt = match self.save_ctxt.tables.node_id_to_type_opt(hir_id) { + let adt = match self.save_ctxt.tables.node_type_opt(hir_id) { Some(ty) => ty.ty_adt_def().unwrap(), None => { visit::walk_pat(self, p); @@ -910,7 +910,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { let hir_id = self.tcx.hir().node_to_hir_id(id); let typ = self.save_ctxt .tables - .node_id_to_type_opt(hir_id) + .node_type_opt(hir_id) .map(|t| t.to_string()) .unwrap_or_default(); value.push_str(": "); @@ -979,7 +979,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { _ => String::new(), }; let hir_id = self.tcx.hir().node_to_hir_id(id); - let typ = match self.save_ctxt.tables.node_id_to_type_opt(hir_id) { + let typ = match self.save_ctxt.tables.node_type_opt(hir_id) { Some(typ) => { let typ = typ.to_string(); if !value.is_empty() { diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 0d4690c83170a..cc04f84440af1 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -224,7 +224,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { node: hir::ExprKind::MethodCall(path, span, expr), .. })), 1) = (self.tcx.hir().find(parent), decl.inputs.len()) { - let self_ty = self.tables.borrow().node_id_to_type(expr[0].hir_id); + let self_ty = self.tables.borrow().node_type(expr[0].hir_id); let self_ty = format!("{:?}", self_ty); let name = path.ident.as_str(); let is_as_ref_able = ( diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 9dc74c5d63a4e..1c45a75cf4052 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1253,7 +1253,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { }) => { if gen.is_some() { let hir_id = tcx.hir().node_to_hir_id(node_id); - return tcx.typeck_tables_of(def_id).node_id_to_type(hir_id); + return tcx.typeck_tables_of(def_id).node_type(hir_id); } let substs = ty::ClosureSubsts {