1
Fork 0

Revert "Reduce the amount of untracked state in TyCtxt"

This commit is contained in:
Camille Gillot 2021-06-01 09:05:22 +02:00 committed by GitHub
parent c9c1f8be3f
commit 0f0f3138cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 255 additions and 234 deletions

View file

@ -43,7 +43,7 @@ use rustc_ast::walk_list;
use rustc_ast::{self as ast, *};
use rustc_ast_pretty::pprust;
use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync::Lrc;
use rustc_errors::{struct_span_err, Applicability};
use rustc_hir as hir;
@ -198,7 +198,7 @@ pub trait ResolverAstLowering {
fn next_node_id(&mut self) -> NodeId;
fn take_trait_map(&mut self) -> NodeMap<Vec<hir::TraitCandidate>>;
fn trait_map(&self) -> &NodeMap<Vec<hir::TraitCandidate>>;
fn opt_local_def_id(&self, node: NodeId) -> Option<LocalDefId>;
@ -501,13 +501,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let proc_macros =
c.proc_macros.iter().map(|id| self.node_id_to_hir_id[*id].unwrap()).collect();
let mut trait_map: FxHashMap<_, FxHashMap<_, _>> = FxHashMap::default();
for (k, v) in self.resolver.take_trait_map().into_iter() {
if let Some(Some(hir_id)) = self.node_id_to_hir_id.get(k) {
let map = trait_map.entry(hir_id.owner).or_default();
map.insert(hir_id.local_id, v.into_boxed_slice());
}
}
let trait_map = self
.resolver
.trait_map()
.iter()
.filter_map(|(&k, v)| {
self.node_id_to_hir_id.get(k).and_then(|id| id.as_ref()).map(|id| (*id, v.clone()))
})
.collect();
let mut def_id_to_hir_id = IndexVec::default();