Skip to content

Commit 5686bbf

Browse files
committed
Move lifetimes_res_map to per-owner tables
1 parent 855461b commit 5686bbf

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl PerOwnerResolver<'_> {
261261

262262
/// Obtains resolution for a lifetime with the given `NodeId`.
263263
fn get_lifetime_res(&self, id: NodeId) -> Option<LifetimeRes> {
264-
self.general.lifetimes_res_map.get(&id).copied()
264+
self.item.lifetimes_res_map.get(&id).copied()
265265
}
266266

267267
/// Obtain the list of lifetimes parameters to add to an item.

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+
/// Resolutions for lifetimes.
199+
pub lifetimes_res_map: NodeMap<LifetimeRes>,
198200

199201
pub trait_map: NodeMap<Vec<hir::TraitCandidate>>,
200202
/// The id of the owner
@@ -210,6 +212,7 @@ impl PerOwnerResolverData {
210212
id,
211213
lifetime_elision_allowed: Default::default(),
212214
trait_map: Default::default(),
215+
lifetimes_res_map: Default::default(),
213216
}
214217
}
215218
}
@@ -222,8 +225,6 @@ pub struct ResolverAstLowering {
222225
pub partial_res_map: NodeMap<hir::def::PartialRes>,
223226
/// Resolutions for import nodes, which have multiple resolutions in different namespaces.
224227
pub import_res_map: NodeMap<hir::def::PerNS<Option<Res<ast::NodeId>>>>,
225-
/// Resolutions for lifetimes.
226-
pub lifetimes_res_map: NodeMap<LifetimeRes>,
227228
/// Lifetime parameters that lowering will have to introduce.
228229
pub extra_lifetime_params_map: NodeMap<Vec<(Ident, ast::NodeId, LifetimeRes)>>,
229230

compiler/rustc_resolve/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1073,8 +1073,6 @@ pub struct Resolver<'ra, 'tcx> {
10731073
import_res_map: NodeMap<PerNS<Option<Res>>>,
10741074
/// An import will be inserted into this map if it has been used.
10751075
import_use_map: FxHashMap<Import<'ra>, Used>,
1076-
/// Resolutions for lifetimes.
1077-
lifetimes_res_map: NodeMap<LifetimeRes>,
10781076
/// Lifetime parameters that lowering will have to introduce.
10791077
extra_lifetime_params_map: NodeMap<Vec<(Ident, NodeId, LifetimeRes)>>,
10801078

@@ -1494,7 +1492,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14941492
partial_res_map: Default::default(),
14951493
import_res_map: Default::default(),
14961494
import_use_map: Default::default(),
1497-
lifetimes_res_map: Default::default(),
14981495
extra_lifetime_params_map: Default::default(),
14991496
extern_crate_map: Default::default(),
15001497
module_children: Default::default(),
@@ -1697,7 +1694,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16971694
owners: self.owners,
16981695
partial_res_map: self.partial_res_map,
16991696
import_res_map: self.import_res_map,
1700-
lifetimes_res_map: self.lifetimes_res_map,
17011697
extra_lifetime_params_map: self.extra_lifetime_params_map,
17021698
next_node_id: self.next_node_id,
17031699
lint_buffer: Steal::new(self.lint_buffer),

compiler/rustc_resolve/src/macros.rs

+2
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,14 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
525525
label_res_map,
526526
lifetime_elision_allowed,
527527
trait_map,
528+
lifetimes_res_map,
528529
} = old;
529530
assert!(node_id_to_def_id.is_empty());
530531
assert!(legacy_const_generic_args.is_empty());
531532
assert!(label_res_map.is_empty());
532533
assert!(lifetime_elision_allowed.is_empty());
533534
assert!(trait_map.is_empty());
535+
assert!(lifetimes_res_map.is_empty());
534536
}
535537
} else {
536538
assert!(self.owners.insert(old.id, old).is_none());

0 commit comments

Comments
 (0)