mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
Rollup merge of #91336 - cjgillot:root_parent, r=matthewjasper
Remove unused root_parent.
This commit is contained in:
commit
b8a4a4c232
@ -7,13 +7,12 @@
|
||||
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/borrow_check.html
|
||||
|
||||
use crate::ty::TyCtxt;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::Node;
|
||||
use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::Node;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use std::fmt;
|
||||
@ -210,11 +209,6 @@ pub struct ScopeTree {
|
||||
/// If not empty, this body is the root of this region hierarchy.
|
||||
pub root_body: Option<hir::HirId>,
|
||||
|
||||
/// The parent of the root body owner, if the latter is an
|
||||
/// an associated const or method, as impls/traits can also
|
||||
/// have lifetime parameters free in this body.
|
||||
pub root_parent: Option<hir::HirId>,
|
||||
|
||||
/// Maps from a scope ID to the enclosing scope id;
|
||||
/// this is usually corresponding to the lexical nesting, though
|
||||
/// in the case of closures the parent scope is the innermost
|
||||
@ -445,7 +439,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for ScopeTree {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let ScopeTree {
|
||||
root_body,
|
||||
root_parent,
|
||||
ref body_expr_count,
|
||||
ref parent_map,
|
||||
ref var_map,
|
||||
@ -455,8 +448,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ScopeTree {
|
||||
} = *self;
|
||||
|
||||
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
|
||||
root_body.hash_stable(hcx, hasher);
|
||||
root_parent.hash_stable(hcx, hasher);
|
||||
root_body.hash_stable(hcx, hasher)
|
||||
});
|
||||
|
||||
body_expr_count.hash_stable(hcx, hasher);
|
||||
|
@ -11,7 +11,7 @@ use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc_hir::{Arm, Block, Expr, Local, Node, Pat, PatKind, Stmt};
|
||||
use rustc_hir::{Arm, Block, Expr, Local, Pat, PatKind, Stmt};
|
||||
use rustc_index::vec::Idx;
|
||||
use rustc_middle::middle::region::*;
|
||||
use rustc_middle::ty::query::Providers;
|
||||
@ -837,19 +837,7 @@ fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree {
|
||||
|
||||
let body = tcx.hir().body(body_id);
|
||||
visitor.scope_tree.root_body = Some(body.value.hir_id);
|
||||
|
||||
// If the item is an associated const or a method,
|
||||
// record its impl/trait parent, as it can also have
|
||||
// lifetime parameters free in this body.
|
||||
match tcx.hir().get(id) {
|
||||
Node::ImplItem(_) | Node::TraitItem(_) => {
|
||||
visitor.scope_tree.root_parent = Some(tcx.hir().get_parent_item(id));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
visitor.visit_body(body);
|
||||
|
||||
visitor.scope_tree
|
||||
} else {
|
||||
ScopeTree::default()
|
||||
|
Loading…
Reference in New Issue
Block a user