Skip to content

Commit 3583880

Browse files
committed
Move trait_map into per-owner tables
1 parent 674535d commit 3583880

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
708708
self.children.push((def_id, hir::MaybeOwner::NonOwner(hir_id)));
709709
}
710710

711-
if let Some(traits) = self.resolver.general.trait_map.remove(&ast_node_id) {
711+
if let Some(traits) = self.resolver.item.trait_map.remove(&ast_node_id) {
712712
self.trait_map.insert(hir_id.local_id, traits.into_boxed_slice());
713713
}
714714

compiler/rustc_middle/src/ty/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ pub struct PerOwnerResolverData {
195195
pub label_res_map: NodeMap<ast::NodeId>,
196196
/// List functions and methods for which lifetime elision was successful.
197197
pub lifetime_elision_allowed: FxHashSet<ast::NodeId>,
198+
199+
pub trait_map: NodeMap<Vec<hir::TraitCandidate>>,
198200
/// The id of the owner
199201
pub id: ast::NodeId,
200202
}
@@ -207,6 +209,7 @@ impl PerOwnerResolverData {
207209
legacy_const_generic_args: Default::default(),
208210
id,
209211
lifetime_elision_allowed: Default::default(),
212+
trait_map: Default::default(),
210213
}
211214
}
212215
}
@@ -228,8 +231,6 @@ pub struct ResolverAstLowering {
228231

229232
pub next_node_id: ast::NodeId,
230233

231-
pub trait_map: NodeMap<Vec<hir::TraitCandidate>>,
232-
233234
/// Lints that were emitted by the resolver and early lints.
234235
pub lint_buffer: Steal<LintBuffer>,
235236

compiler/rustc_resolve/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,6 @@ pub struct Resolver<'ra, 'tcx> {
10811081
/// `CrateNum` resolutions of `extern crate` items.
10821082
extern_crate_map: UnordMap<LocalDefId, CrateNum>,
10831083
module_children: LocalDefIdMap<Vec<ModChild>>,
1084-
trait_map: NodeMap<Vec<TraitCandidate>>,
10851084

10861085
/// A map from nodes to anonymous modules.
10871086
/// Anonymous modules are pseudo-modules that are implicitly created around items
@@ -1499,7 +1498,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14991498
extra_lifetime_params_map: Default::default(),
15001499
extern_crate_map: Default::default(),
15011500
module_children: Default::default(),
1502-
trait_map: NodeMap::default(),
15031501
underscore_disambiguator: 0,
15041502
empty_module,
15051503
module_map,
@@ -1702,7 +1700,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17021700
lifetimes_res_map: self.lifetimes_res_map,
17031701
extra_lifetime_params_map: self.extra_lifetime_params_map,
17041702
next_node_id: self.next_node_id,
1705-
trait_map: self.trait_map,
17061703
lint_buffer: Steal::new(self.lint_buffer),
17071704
delegation_fn_sigs: self.delegation_fn_sigs,
17081705
};

compiler/rustc_resolve/src/macros.rs

+2
Original file line numberDiff line numberDiff line change
@@ -524,11 +524,13 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
524524
legacy_const_generic_args,
525525
label_res_map,
526526
lifetime_elision_allowed,
527+
trait_map,
527528
} = old;
528529
assert!(node_id_to_def_id.is_empty());
529530
assert!(legacy_const_generic_args.is_empty());
530531
assert!(label_res_map.is_empty());
531532
assert!(lifetime_elision_allowed.is_empty());
533+
assert!(trait_map.is_empty());
532534
}
533535
} else {
534536
assert!(self.owners.insert(old.id, old).is_none());

0 commit comments

Comments
 (0)