Remove unnecessary body_expr_count
This commit is contained in:
parent
71696e516d
commit
bacfa976ca
@ -824,10 +824,6 @@ fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) {
|
|||||||
resolve_local(self, None, Some(body.value));
|
resolve_local(self, None, Some(body.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
if body.coroutine_kind.is_some() {
|
|
||||||
self.scope_tree.body_expr_count.insert(body_id, self.expr_and_pat_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore context we had at the start.
|
// Restore context we had at the start.
|
||||||
self.expr_and_pat_count = outer_ec;
|
self.expr_and_pat_count = outer_ec;
|
||||||
self.cx = outer_cx;
|
self.cx = outer_cx;
|
||||||
|
@ -307,11 +307,6 @@ pub struct ScopeTree {
|
|||||||
/// the values are still owned by their containing expressions. So
|
/// the values are still owned by their containing expressions. So
|
||||||
/// we'll see that `&x`.
|
/// we'll see that `&x`.
|
||||||
pub yield_in_scope: FxHashMap<Scope, Vec<YieldData>>,
|
pub yield_in_scope: FxHashMap<Scope, Vec<YieldData>>,
|
||||||
|
|
||||||
/// The number of visit_expr and visit_pat calls done in the body.
|
|
||||||
/// Used to sanity check visit_expr/visit_pat call count when
|
|
||||||
/// calculating coroutine interiors.
|
|
||||||
pub body_expr_count: FxHashMap<hir::BodyId, usize>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Identifies the reason that a given expression is an rvalue candidate
|
/// Identifies the reason that a given expression is an rvalue candidate
|
||||||
@ -408,20 +403,12 @@ pub fn is_subscope_of(&self, subscope: Scope, superscope: Scope) -> bool {
|
|||||||
pub fn yield_in_scope(&self, scope: Scope) -> Option<&[YieldData]> {
|
pub fn yield_in_scope(&self, scope: Scope) -> Option<&[YieldData]> {
|
||||||
self.yield_in_scope.get(&scope).map(Deref::deref)
|
self.yield_in_scope.get(&scope).map(Deref::deref)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gives the number of expressions visited in a body.
|
|
||||||
/// Used to sanity check visit_expr call count when
|
|
||||||
/// calculating coroutine interiors.
|
|
||||||
pub fn body_expr_count(&self, body_id: hir::BodyId) -> Option<usize> {
|
|
||||||
self.body_expr_count.get(&body_id).copied()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HashStable<StableHashingContext<'a>> for ScopeTree {
|
impl<'a> HashStable<StableHashingContext<'a>> for ScopeTree {
|
||||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||||
let ScopeTree {
|
let ScopeTree {
|
||||||
root_body,
|
root_body,
|
||||||
ref body_expr_count,
|
|
||||||
ref parent_map,
|
ref parent_map,
|
||||||
ref var_map,
|
ref var_map,
|
||||||
ref destruction_scopes,
|
ref destruction_scopes,
|
||||||
@ -430,7 +417,6 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
|
|||||||
} = *self;
|
} = *self;
|
||||||
|
|
||||||
root_body.hash_stable(hcx, hasher);
|
root_body.hash_stable(hcx, hasher);
|
||||||
body_expr_count.hash_stable(hcx, hasher);
|
|
||||||
parent_map.hash_stable(hcx, hasher);
|
parent_map.hash_stable(hcx, hasher);
|
||||||
var_map.hash_stable(hcx, hasher);
|
var_map.hash_stable(hcx, hasher);
|
||||||
destruction_scopes.hash_stable(hcx, hasher);
|
destruction_scopes.hash_stable(hcx, hasher);
|
||||||
|
Loading…
Reference in New Issue
Block a user