Skip to content

Commit b8a4a4c

Browse files
authored
Rollup merge of #91336 - cjgillot:root_parent, r=matthewjasper
Remove unused root_parent.
2 parents 7df49ef + 06b2e65 commit b8a4a4c

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

compiler/rustc_middle/src/middle/region.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/borrow_check.html
88
99
use crate::ty::TyCtxt;
10-
use rustc_hir as hir;
11-
use rustc_hir::Node;
12-
use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
13-
1410
use rustc_data_structures::fx::FxHashMap;
1511
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
12+
use rustc_hir as hir;
13+
use rustc_hir::Node;
1614
use rustc_macros::HashStable;
15+
use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
1716
use rustc_span::{Span, DUMMY_SP};
1817

1918
use std::fmt;
@@ -210,11 +209,6 @@ pub struct ScopeTree {
210209
/// If not empty, this body is the root of this region hierarchy.
211210
pub root_body: Option<hir::HirId>,
212211

213-
/// The parent of the root body owner, if the latter is an
214-
/// an associated const or method, as impls/traits can also
215-
/// have lifetime parameters free in this body.
216-
pub root_parent: Option<hir::HirId>,
217-
218212
/// Maps from a scope ID to the enclosing scope id;
219213
/// this is usually corresponding to the lexical nesting, though
220214
/// in the case of closures the parent scope is the innermost
@@ -445,7 +439,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for ScopeTree {
445439
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
446440
let ScopeTree {
447441
root_body,
448-
root_parent,
449442
ref body_expr_count,
450443
ref parent_map,
451444
ref var_map,
@@ -455,8 +448,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ScopeTree {
455448
} = *self;
456449

457450
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
458-
root_body.hash_stable(hcx, hasher);
459-
root_parent.hash_stable(hcx, hasher);
451+
root_body.hash_stable(hcx, hasher)
460452
});
461453

462454
body_expr_count.hash_stable(hcx, hasher);

compiler/rustc_passes/src/region.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_data_structures::fx::FxHashSet;
1111
use rustc_hir as hir;
1212
use rustc_hir::def_id::DefId;
1313
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
14-
use rustc_hir::{Arm, Block, Expr, Local, Node, Pat, PatKind, Stmt};
14+
use rustc_hir::{Arm, Block, Expr, Local, Pat, PatKind, Stmt};
1515
use rustc_index::vec::Idx;
1616
use rustc_middle::middle::region::*;
1717
use rustc_middle::ty::query::Providers;
@@ -837,19 +837,7 @@ fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree {
837837

838838
let body = tcx.hir().body(body_id);
839839
visitor.scope_tree.root_body = Some(body.value.hir_id);
840-
841-
// If the item is an associated const or a method,
842-
// record its impl/trait parent, as it can also have
843-
// lifetime parameters free in this body.
844-
match tcx.hir().get(id) {
845-
Node::ImplItem(_) | Node::TraitItem(_) => {
846-
visitor.scope_tree.root_parent = Some(tcx.hir().get_parent_item(id));
847-
}
848-
_ => {}
849-
}
850-
851840
visitor.visit_body(body);
852-
853841
visitor.scope_tree
854842
} else {
855843
ScopeTree::default()

0 commit comments

Comments
 (0)