Skip to content

Commit f6da289

Browse files
authored
Rollup merge of rust-lang#58137 - ljedrz:cleanup_node_id_to_type, r=estebank
Cleanup: rename node_id_to_type(_opt) Renames `node_id_to_type(_opt)` to `hir_id_to_type(_opt)`; this makes it clear we are dealing with HIR nodes and their IDs here. In addition, a drive-by commit removing `ty::item_path::hir_path_str` (as requested by @eddyb).
2 parents 76b6bda + eb669b3 commit f6da289

File tree

24 files changed

+52
-61
lines changed

24 files changed

+52
-61
lines changed

src/librustc/infer/error_reporting/need_type_info.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ struct FindLocalByTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
1616
}
1717

1818
impl<'a, 'gcx, 'tcx> FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
19-
fn node_matches_type(&mut self, node_id: HirId) -> bool {
19+
fn node_matches_type(&mut self, hir_id: HirId) -> bool {
2020
let ty_opt = self.infcx.in_progress_tables.and_then(|tables| {
21-
tables.borrow().node_id_to_type_opt(node_id)
21+
tables.borrow().node_type_opt(hir_id)
2222
});
2323
match ty_opt {
2424
Some(ty) => {

src/librustc/infer/error_reporting/nice_region_error/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
6464
// May return None; sometimes the tables are not yet populated.
6565
let ty_hir_id = fn_decl.inputs[index].hir_id;
6666
let arg_ty_span = hir.span(hir.hir_to_node_id(ty_hir_id));
67-
let ty = tables.node_id_to_type_opt(arg.hir_id)?;
67+
let ty = tables.node_type_opt(arg.hir_id)?;
6868
let mut found_anon_region = false;
6969
let new_arg_ty = self.tcx().fold_regions(&ty, &mut false, |r, _| {
7070
if *r == *anon_region {

src/librustc/middle/dead.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
112112

113113
fn handle_field_pattern_match(&mut self, lhs: &hir::Pat, def: Def,
114114
pats: &[source_map::Spanned<hir::FieldPat>]) {
115-
let variant = match self.tables.node_id_to_type(lhs.hir_id).sty {
115+
let variant = match self.tables.node_type(lhs.hir_id).sty {
116116
ty::Adt(adt, _) => adt.variant_of_def(def),
117117
_ => span_bug!(lhs.span, "non-ADT in struct pattern")
118118
};

src/librustc/middle/intrinsicck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ExprVisitor<'a, 'tcx> {
165165
};
166166
if let Def::Fn(did) = def {
167167
if self.def_id_is_transmute(did) {
168-
let typ = self.tables.node_id_to_type(expr.hir_id);
168+
let typ = self.tables.node_type(expr.hir_id);
169169
let sig = typ.fn_sig(self.tcx);
170170
let from = sig.inputs().skip_binder()[0];
171171
let to = *sig.output().skip_binder();

src/librustc/middle/mem_categorization.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub enum Note {
174174
// which the value is stored.
175175
//
176176
// *WARNING* The field `cmt.type` is NOT necessarily the same as the
177-
// result of `node_id_to_type(cmt.id)`.
177+
// result of `node_type(cmt.id)`.
178178
//
179179
// (FIXME: rewrite the following comment given that `@x` managed
180180
// pointers have been obsolete for quite some time.)
@@ -497,7 +497,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
497497
hir_id: hir::HirId)
498498
-> McResult<Ty<'tcx>> {
499499
self.resolve_type_vars_or_error(hir_id,
500-
self.tables.node_id_to_type_opt(hir_id))
500+
self.tables.node_type_opt(hir_id))
501501
}
502502

503503
pub fn expr_ty(&self, expr: &hir::Expr) -> McResult<Ty<'tcx>> {

src/librustc/ty/context.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -525,17 +525,14 @@ impl<'tcx> TypeckTables<'tcx> {
525525
}
526526
}
527527

528-
pub fn node_id_to_type(&self, id: hir::HirId) -> Ty<'tcx> {
529-
self.node_id_to_type_opt(id).unwrap_or_else(||
530-
bug!("node_id_to_type: no type for node `{}`",
531-
tls::with(|tcx| {
532-
let id = tcx.hir().hir_to_node_id(id);
533-
tcx.hir().node_to_string(id)
534-
}))
528+
pub fn node_type(&self, id: hir::HirId) -> Ty<'tcx> {
529+
self.node_type_opt(id).unwrap_or_else(||
530+
bug!("node_type: no type for node `{}`",
531+
tls::with(|tcx| tcx.hir().hir_to_string(id)))
535532
)
536533
}
537534

538-
pub fn node_id_to_type_opt(&self, id: hir::HirId) -> Option<Ty<'tcx>> {
535+
pub fn node_type_opt(&self, id: hir::HirId) -> Option<Ty<'tcx>> {
539536
validate_hir_id_for_typeck_tables(self.local_id_root, id, false);
540537
self.node_types.get(&id.local_id).cloned()
541538
}
@@ -560,11 +557,11 @@ impl<'tcx> TypeckTables<'tcx> {
560557
// Returns the type of a pattern as a monotype. Like @expr_ty, this function
561558
// doesn't provide type parameter substitutions.
562559
pub fn pat_ty(&self, pat: &hir::Pat) -> Ty<'tcx> {
563-
self.node_id_to_type(pat.hir_id)
560+
self.node_type(pat.hir_id)
564561
}
565562

566563
pub fn pat_ty_opt(&self, pat: &hir::Pat) -> Option<Ty<'tcx>> {
567-
self.node_id_to_type_opt(pat.hir_id)
564+
self.node_type_opt(pat.hir_id)
568565
}
569566

570567
// Returns the type of an expression as a monotype.
@@ -578,11 +575,11 @@ impl<'tcx> TypeckTables<'tcx> {
578575
// ask for the type of "id" in "id(3)", it will return "fn(&isize) -> isize"
579576
// instead of "fn(ty) -> T with T = isize".
580577
pub fn expr_ty(&self, expr: &hir::Expr) -> Ty<'tcx> {
581-
self.node_id_to_type(expr.hir_id)
578+
self.node_type(expr.hir_id)
582579
}
583580

584581
pub fn expr_ty_opt(&self, expr: &hir::Expr) -> Option<Ty<'tcx>> {
585-
self.node_id_to_type_opt(expr.hir_id)
582+
self.node_type_opt(expr.hir_id)
586583
}
587584

588585
pub fn adjustments(&self) -> LocalTableInContext<'_, Vec<ty::adjustment::Adjustment<'tcx>>> {

src/librustc/ty/item_path.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::hir;
21
use crate::hir::map::DefPathData;
32
use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
43
use crate::ty::{self, DefIdTree, Ty, TyCtxt};
@@ -77,11 +76,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
7776
self.item_path_str(self.hir().local_def_id(id))
7877
}
7978

80-
// FIXME(@ljedrz): replace the NodeId variant
81-
pub fn hir_path_str(self, id: hir::HirId) -> String {
82-
self.item_path_str(self.hir().local_def_id_from_hir_id(id))
83-
}
84-
8579
/// Returns a string identifying this def-id. This string is
8680
/// suitable for user output. It always begins with a crate identifier.
8781
pub fn absolute_item_path_str(self, def_id: DefId) -> String {

src/librustc_borrowck/borrowck/gather_loans/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
149149
fn decl_without_init(&mut self, id: ast::NodeId, _span: Span) {
150150
let ty = self.bccx
151151
.tables
152-
.node_id_to_type(self.bccx.tcx.hir().node_to_hir_id(id));
152+
.node_type(self.bccx.tcx.hir().node_to_hir_id(id));
153153
gather_moves::gather_decl(self.bccx, &self.move_data, id, ty);
154154
}
155155
}

src/librustc_lint/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers {
158158
}
159159

160160
fn check_expr(&mut self, cx: &LateContext<'_, '_>, e: &hir::Expr) {
161-
let ty = cx.tables.node_id_to_type(e.hir_id);
161+
let ty = cx.tables.node_type(e.hir_id);
162162
self.check_heap_type(cx, e.span, ty);
163163
}
164164
}
@@ -1002,7 +1002,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
10021002
if !def_id_is_transmute(cx, did) {
10031003
return None;
10041004
}
1005-
let sig = cx.tables.node_id_to_type(expr.hir_id).fn_sig(cx.tcx);
1005+
let sig = cx.tables.node_type(expr.hir_id).fn_sig(cx.tcx);
10061006
let from = sig.inputs().skip_binder()[0];
10071007
let to = *sig.output().skip_binder();
10081008
return Some((&from.sty, &to.sty));

src/librustc_lint/types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
8585
}
8686
}
8787
hir::ExprKind::Lit(ref lit) => {
88-
match cx.tables.node_id_to_type(e.hir_id).sty {
88+
match cx.tables.node_type(e.hir_id).sty {
8989
ty::Int(t) => {
9090
match lit.node {
9191
ast::LitKind::Int(v, ast::LitIntType::Signed(_)) |
@@ -257,7 +257,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
257257
// Normalize the binop so that the literal is always on the RHS in
258258
// the comparison
259259
let norm_binop = if swap { rev_binop(binop) } else { binop };
260-
match cx.tables.node_id_to_type(expr.hir_id).sty {
260+
match cx.tables.node_type(expr.hir_id).sty {
261261
ty::Int(int_ty) => {
262262
let (min, max) = int_ty_range(int_ty);
263263
let lit_val: i128 = match lit.node {
@@ -400,7 +400,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
400400
repr_str, val, t, actually, t
401401
));
402402
if let Some(sugg_ty) =
403-
get_type_suggestion(&cx.tables.node_id_to_type(expr.hir_id).sty, val, negative)
403+
get_type_suggestion(&cx.tables.node_type(expr.hir_id).sty, val, negative)
404404
{
405405
if let Some(pos) = repr_str.chars().position(|c| c == 'i' || c == 'u') {
406406
let (sans_suffix, _) = repr_str.split_at(pos);

src/librustc_metadata/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
13381338
let tables = self.tcx.typeck_tables_of(def_id);
13391339
let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap();
13401340
let hir_id = self.tcx.hir().node_to_hir_id(node_id);
1341-
let kind = match tables.node_id_to_type(hir_id).sty {
1341+
let kind = match tables.node_type(hir_id).sty {
13421342
ty::Generator(def_id, ..) => {
13431343
let layout = self.tcx.generator_layout(def_id);
13441344
let data = GeneratorData {

src/librustc_mir/borrow_check/error_reporting.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
11781178
let escapes_from = if tcx.is_closure(self.mir_def_id) {
11791179
let tables = tcx.typeck_tables_of(self.mir_def_id);
11801180
let mir_hir_id = tcx.hir().def_index_to_hir_id(self.mir_def_id.index);
1181-
match tables.node_id_to_type(mir_hir_id).sty {
1181+
match tables.node_type(mir_hir_id).sty {
11821182
ty::Closure(..) => "closure",
11831183
ty::Generator(..) => "generator",
11841184
_ => bug!("Closure body doesn't have a closure or generator type"),

src/librustc_mir/borrow_check/nll/universal_regions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> {
482482
tcx.type_of(closure_base_def_id)
483483
} else {
484484
let tables = tcx.typeck_tables_of(self.mir_def_id);
485-
tables.node_id_to_type(self.mir_hir_id)
485+
tables.node_type(self.mir_hir_id)
486486
};
487487

488488
debug!("defining_ty (pre-replacement): {:?}", defining_ty);

src/librustc_mir/build/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
9292
Some(ArgInfo(liberated_closure_env_ty(tcx, id, body_id), None, None, None))
9393
}
9494
ty::Generator(..) => {
95-
let gen_ty = tcx.body_tables(body_id).node_id_to_type(fn_hir_id);
95+
let gen_ty = tcx.body_tables(body_id).node_type(fn_hir_id);
9696
Some(ArgInfo(gen_ty, None, None, None))
9797
}
9898
_ => None,
@@ -263,7 +263,7 @@ fn liberated_closure_env_ty<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
263263
body_id: hir::BodyId)
264264
-> Ty<'tcx> {
265265
let closure_expr_hir_id = tcx.hir().node_to_hir_id(closure_expr_id);
266-
let closure_ty = tcx.body_tables(body_id).node_id_to_type(closure_expr_hir_id);
266+
let closure_ty = tcx.body_tables(body_id).node_type(closure_expr_hir_id);
267267

268268
let (closure_def_id, closure_substs) = match closure_ty.sty {
269269
ty::Closure(closure_def_id, closure_substs) => (closure_def_id, closure_substs),

src/librustc_mir/hair/cx/block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
115115
pub fn to_expr_ref<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
116116
block: &'tcx hir::Block)
117117
-> ExprRef<'tcx> {
118-
let block_ty = cx.tables().node_id_to_type(block.hir_id);
118+
let block_ty = cx.tables().node_type(block.hir_id);
119119
let temp_lifetime = cx.region_scope_tree.temporary_scope(block.hir_id.local_id);
120120
let expr = Expr {
121121
ty: block_ty,

src/librustc_mir/hair/cx/expr.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
304304
}
305305
} else {
306306
ExprKind::Call {
307-
ty: cx.tables().node_id_to_type(fun.hir_id),
307+
ty: cx.tables().node_type(fun.hir_id),
308308
fun: fun.to_ref(),
309309
args: args.to_ref(),
310310
from_hir_call: true,
@@ -677,7 +677,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
677677
let def = cx.tables().qpath_def(qpath, source.hir_id);
678678
cx
679679
.tables()
680-
.node_id_to_type(source.hir_id)
680+
.node_type(source.hir_id)
681681
.ty_adt_def()
682682
.and_then(|adt_def| {
683683
match def {
@@ -919,7 +919,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
919919
debug!("convert_path_expr: user_ty={:?}", user_ty);
920920
ExprKind::Literal {
921921
literal: cx.tcx.mk_lazy_const(ty::LazyConst::Evaluated(ty::Const::zero_sized(
922-
cx.tables().node_id_to_type(expr.hir_id),
922+
cx.tables().node_type(expr.hir_id),
923923
))),
924924
user_ty,
925925
}
@@ -940,7 +940,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
940940
let user_provided_types = cx.tables.user_provided_types();
941941
let user_provided_type = user_provided_types.get(expr.hir_id).map(|u_ty| *u_ty);
942942
debug!("convert_path_expr: user_provided_type={:?}", user_provided_type);
943-
match cx.tables().node_id_to_type(expr.hir_id).sty {
943+
match cx.tables().node_type(expr.hir_id).sty {
944944
// A unit struct/variant which is used as a value.
945945
// We return a completely different ExprKind here to account for this special case.
946946
ty::Adt(adt_def, substs) => {
@@ -980,11 +980,11 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
980980
index,
981981
closure_expr_id);
982982
let var_hir_id = cx.tcx.hir().node_to_hir_id(var_id);
983-
let var_ty = cx.tables().node_id_to_type(var_hir_id);
983+
let var_ty = cx.tables().node_type(var_hir_id);
984984

985985
// FIXME free regions in closures are not right
986986
let closure_ty = cx.tables()
987-
.node_id_to_type(cx.tcx.hir().node_to_hir_id(closure_expr_id));
987+
.node_type(cx.tcx.hir().node_to_hir_id(closure_expr_id));
988988

989989
// FIXME we're just hard-coding the idea that the
990990
// 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>,
11881188
};
11891189
let upvar_capture = cx.tables().upvar_capture(upvar_id);
11901190
let temp_lifetime = cx.region_scope_tree.temporary_scope(closure_expr.hir_id.local_id);
1191-
let var_ty = cx.tables().node_id_to_type(var_hir_id);
1191+
let var_ty = cx.tables().node_type(var_hir_id);
11921192
let captured_var = Expr {
11931193
temp_lifetime,
11941194
ty: var_ty,

src/librustc_mir/hair/pattern/check_match.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
202202

203203
// Then, if the match has no arms, check whether the scrutinee
204204
// is uninhabited.
205-
let pat_ty = self.tables.node_id_to_type(scrut.hir_id);
205+
let pat_ty = self.tables.node_type(scrut.hir_id);
206206
let module = self.tcx.hir().get_module_parent(scrut.id);
207207
if inlined_arms.is_empty() {
208208
let scrutinee_is_uninhabited = if self.tcx.features().exhaustive_patterns {
@@ -235,7 +235,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
235235
.flat_map(|arm| &arm.0)
236236
.map(|pat| smallvec![pat.0])
237237
.collect();
238-
let scrut_ty = self.tables.node_id_to_type(scrut.hir_id);
238+
let scrut_ty = self.tables.node_type(scrut.hir_id);
239239
check_exhaustive(cx, scrut_ty, scrut.span, &matrix);
240240
})
241241
}
@@ -507,7 +507,7 @@ fn check_legality_of_move_bindings(cx: &MatchVisitor<'_, '_>,
507507
if let Some(&bm) = cx.tables.pat_binding_modes().get(p.hir_id) {
508508
match bm {
509509
ty::BindByValue(..) => {
510-
let pat_ty = cx.tables.node_id_to_type(p.hir_id);
510+
let pat_ty = cx.tables.node_type(p.hir_id);
511511
if !pat_ty.is_copy_modulo_regions(cx.tcx, cx.param_env, pat.span) {
512512
check_move(p, sub.as_ref().map(|p| &**p), span_vec);
513513
}

src/librustc_mir/hair/pattern/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
408408
}
409409

410410
fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat) -> Pattern<'tcx> {
411-
let mut ty = self.tables.node_id_to_type(pat.hir_id);
411+
let mut ty = self.tables.node_type(pat.hir_id);
412412

413413
let kind = match pat.node {
414414
PatKind::Wild => PatternKind::Wild,
@@ -541,7 +541,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
541541
}
542542

543543
PatKind::Binding(_, id, _, ident, ref sub) => {
544-
let var_ty = self.tables.node_id_to_type(pat.hir_id);
544+
let var_ty = self.tables.node_type(pat.hir_id);
545545
if let ty::Error = var_ty.sty {
546546
// Avoid ICE
547547
return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) };
@@ -775,7 +775,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
775775
id: hir::HirId,
776776
span: Span)
777777
-> Pattern<'tcx> {
778-
let ty = self.tables.node_id_to_type(id);
778+
let ty = self.tables.node_type(id);
779779
let def = self.tables.qpath_def(qpath, id);
780780
let is_associated_const = match def {
781781
Def::AssociatedConst(_) => true,

src/librustc_mir/hair/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> {
1616
let user_provided_types = self.tables().user_provided_types();
1717
let mut user_ty = *user_provided_types.get(hir_id)?;
1818
debug!("user_subts_applied_to_ty_of_hir_id: user_ty={:?}", user_ty);
19-
match &self.tables().node_id_to_type(hir_id).sty {
19+
match &self.tables().node_type(hir_id).sty {
2020
ty::Adt(adt_def, ..) => {
2121
if let UserType::TypeOf(ref mut did, _) = &mut user_ty.value {
2222
*did = adt_def.did;

src/librustc_passes/rvalue_promotion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
244244
}
245245

246246
fn check_expr(&mut self, ex: &'tcx hir::Expr) -> Promotability {
247-
let node_ty = self.tables.node_id_to_type(ex.hir_id);
247+
let node_ty = self.tables.node_type(ex.hir_id);
248248
let mut outer = check_expr_kind(self, ex, node_ty);
249249
outer &= check_adjustments(self, ex);
250250

@@ -306,7 +306,7 @@ fn check_expr_kind<'a, 'tcx>(
306306
if v.tables.is_method_call(e) {
307307
return NotPromotable;
308308
}
309-
match v.tables.node_id_to_type(lhs.hir_id).sty {
309+
match v.tables.node_type(lhs.hir_id).sty {
310310
ty::RawPtr(_) | ty::FnPtr(..) => {
311311
assert!(op.node == hir::BinOpKind::Eq || op.node == hir::BinOpKind::Ne ||
312312
op.node == hir::BinOpKind::Le || op.node == hir::BinOpKind::Lt ||

src/librustc_privacy/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ impl<'a, 'tcx> TypePrivacyVisitor<'a, 'tcx> {
933933
// Take node-id of an expression or pattern and check its type for privacy.
934934
fn check_expr_pat_type(&mut self, id: hir::HirId, span: Span) -> bool {
935935
self.span = span;
936-
if self.visit(self.tables.node_id_to_type(id)) || self.visit(self.tables.node_substs(id)) {
936+
if self.visit(self.tables.node_type(id)) || self.visit(self.tables.node_substs(id)) {
937937
return true;
938938
}
939939
if let Some(adjustments) = self.tables.adjustments().get(id) {
@@ -980,7 +980,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
980980
self.span = hir_ty.span;
981981
if self.in_body {
982982
// Types in bodies.
983-
if self.visit(self.tables.node_id_to_type(hir_ty.hir_id)) {
983+
if self.visit(self.tables.node_type(hir_ty.hir_id)) {
984984
return;
985985
}
986986
} else {

0 commit comments

Comments
 (0)