Skip to content

Commit 701e900

Browse files
committed
in which some node_to_hir_id calls become hir_id field accesses
For rust-lang#50928.
1 parent 2a8ad09 commit 701e900

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> {
124124

125125
hir::TyRptr(ref lifetime, _) => {
126126
// the lifetime of the TyRptr
127-
let hir_id = self.tcx.hir.node_to_hir_id(lifetime.id);
128-
match (self.tcx.named_region(hir_id), self.bound_region) {
127+
match (self.tcx.named_region(lifetime.hir_id), self.bound_region) {
129128
// Find the index of the anonymous region that was part of the
130129
// error. We will then search the function parameters for a bound
131130
// region at the right depth with the same index
@@ -231,8 +230,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for TyPathVisitor<'a, 'gcx, 'tcx> {
231230
}
232231

233232
fn visit_lifetime(&mut self, lifetime: &hir::Lifetime) {
234-
let hir_id = self.tcx.hir.node_to_hir_id(lifetime.id);
235-
match (self.tcx.named_region(hir_id), self.bound_region) {
233+
match (self.tcx.named_region(lifetime.hir_id), self.bound_region) {
236234
// the lifetime of the TyPath!
237235
(Some(rl::Region::LateBoundAnon(debruijn_index, anon_index)), ty::BrAnon(br_index)) => {
238236
if debruijn_index == self.current_index && anon_index == br_index {

src/librustc/middle/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ fn resolve_pat<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, pat: &
909909
}
910910

911911
fn resolve_stmt<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, stmt: &'tcx hir::Stmt) {
912-
let stmt_id = visitor.tcx.hir.node_to_hir_id(stmt.node.id()).local_id;
912+
let stmt_id = stmt.node.hir_id().local_id;
913913
debug!("resolve_stmt(stmt.id={:?})", stmt_id);
914914

915915
// Every statement will clean up the temporaries created during

src/librustc_typeck/astconv.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
109109
tcx.hir.name(tcx.hir.as_local_node_id(def_id).unwrap()).as_interned_str()
110110
};
111111

112-
let hir_id = tcx.hir.node_to_hir_id(lifetime.id);
113-
let r = match tcx.named_region(hir_id) {
112+
let r = match tcx.named_region(lifetime.hir_id) {
114113
Some(rl::Region::Static) => {
115114
tcx.types.re_static
116115
}
@@ -738,8 +737,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
738737
self.ast_region_to_region(lifetime, None)
739738
} else {
740739
self.compute_object_lifetime_bound(span, existential_predicates).unwrap_or_else(|| {
741-
let hir_id = tcx.hir.node_to_hir_id(lifetime.id);
742-
if tcx.named_region(hir_id).is_some() {
740+
if tcx.named_region(lifetime.hir_id).is_some() {
743741
self.ast_region_to_region(lifetime, None)
744742
} else {
745743
self.re_infer(span, None).unwrap_or_else(|| {

src/librustc_typeck/collect.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,7 @@ fn has_late_bound_regions<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
722722
fn visit_lifetime(&mut self, lt: &'tcx hir::Lifetime) {
723723
if self.has_late_bound_regions.is_some() { return }
724724

725-
let hir_id = self.tcx.hir.node_to_hir_id(lt.id);
726-
match self.tcx.named_region(hir_id) {
725+
match self.tcx.named_region(lt.hir_id) {
727726
Some(rl::Region::Static) | Some(rl::Region::EarlyBound(..)) => {}
728727
Some(rl::Region::LateBound(debruijn, _, _)) |
729728
Some(rl::Region::LateBoundAnon(debruijn, _))
@@ -750,8 +749,7 @@ fn has_late_bound_regions<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
750749
for param in &generics.params {
751750
match param.kind {
752751
GenericParamKind::Lifetime { .. } => {
753-
let hir_id = tcx.hir.node_to_hir_id(param.id);
754-
if tcx.is_late_bound(hir_id) {
752+
if tcx.is_late_bound(param.hir_id) {
755753
return Some(param.span);
756754
}
757755
}
@@ -1303,8 +1301,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx>(
13031301
{
13041302
generics.params.iter().filter(move |param| match param.kind {
13051303
GenericParamKind::Lifetime { .. } => {
1306-
let hir_id = tcx.hir.node_to_hir_id(param.id);
1307-
!tcx.is_late_bound(hir_id)
1304+
!tcx.is_late_bound(param.hir_id)
13081305
}
13091306
_ => false,
13101307
})

src/librustdoc/clean/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1651,8 +1651,7 @@ impl Lifetime {
16511651
impl Clean<Lifetime> for hir::Lifetime {
16521652
fn clean(&self, cx: &DocContext) -> Lifetime {
16531653
if self.id != ast::DUMMY_NODE_ID {
1654-
let hir_id = cx.tcx.hir.node_to_hir_id(self.id);
1655-
let def = cx.tcx.named_region(hir_id);
1654+
let def = cx.tcx.named_region(self.hir_id);
16561655
match def {
16571656
Some(rl::Region::EarlyBound(_, node_id, _)) |
16581657
Some(rl::Region::LateBound(_, node_id, _)) |

0 commit comments

Comments
 (0)