Skip to content

Commit 674535d

Browse files
committed
Move lifetime_elision_allowed to per owner tables
1 parent d18e606 commit 674535d

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
@@ -1662,7 +1662,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16621662
c_variadic,
16631663
lifetime_elision_allowed: self
16641664
.resolver
1665-
.general
1665+
.item
16661666
.lifetime_elision_allowed
16671667
.contains(&fn_node_id),
16681668
implicit_self: decl.inputs.get(0).map_or(hir::ImplicitSelfKind::None, |arg| {

compiler/rustc_middle/src/ty/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ pub struct PerOwnerResolverData {
193193
pub node_id_to_def_id: NodeMap<LocalDefId>,
194194
/// Resolutions for labels (node IDs of their corresponding blocks or loops).
195195
pub label_res_map: NodeMap<ast::NodeId>,
196+
/// List functions and methods for which lifetime elision was successful.
197+
pub lifetime_elision_allowed: FxHashSet<ast::NodeId>,
196198
/// The id of the owner
197199
pub id: ast::NodeId,
198200
}
@@ -204,6 +206,7 @@ impl PerOwnerResolverData {
204206
label_res_map: Default::default(),
205207
legacy_const_generic_args: Default::default(),
206208
id,
209+
lifetime_elision_allowed: Default::default(),
207210
}
208211
}
209212
}
@@ -226,8 +229,6 @@ pub struct ResolverAstLowering {
226229
pub next_node_id: ast::NodeId,
227230

228231
pub trait_map: NodeMap<Vec<hir::TraitCandidate>>,
229-
/// List functions and methods for which lifetime elision was successful.
230-
pub lifetime_elision_allowed: FxHashSet<ast::NodeId>,
231232

232233
/// Lints that were emitted by the resolver and early lints.
233234
pub lint_buffer: Steal<LintBuffer>,

compiler/rustc_resolve/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1208,8 +1208,6 @@ pub struct Resolver<'ra, 'tcx> {
12081208
/// they are declared in the static array generated by proc_macro_harness.
12091209
proc_macros: Vec<NodeId>,
12101210
confused_type_with_std_module: FxIndexMap<Span, Span>,
1211-
/// Whether lifetime elision was successful.
1212-
lifetime_elision_allowed: FxHashSet<NodeId>,
12131211

12141212
/// Names of items that were stripped out via cfg with their corresponding cfg meta item.
12151213
stripped_cfg_items: Vec<StrippedCfgItem<NodeId>>,
@@ -1586,7 +1584,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15861584
trait_impls: Default::default(),
15871585
proc_macros: Default::default(),
15881586
confused_type_with_std_module: Default::default(),
1589-
lifetime_elision_allowed: Default::default(),
15901587
stripped_cfg_items: Default::default(),
15911588
effective_visibilities: Default::default(),
15921589
doc_link_resolutions: Default::default(),
@@ -1706,7 +1703,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17061703
extra_lifetime_params_map: self.extra_lifetime_params_map,
17071704
next_node_id: self.next_node_id,
17081705
trait_map: self.trait_map,
1709-
lifetime_elision_allowed: self.lifetime_elision_allowed,
17101706
lint_buffer: Steal::new(self.lint_buffer),
17111707
delegation_fn_sigs: self.delegation_fn_sigs,
17121708
};

compiler/rustc_resolve/src/macros.rs

+2
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,12 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
523523
id: _,
524524
legacy_const_generic_args,
525525
label_res_map,
526+
lifetime_elision_allowed,
526527
} = old;
527528
assert!(node_id_to_def_id.is_empty());
528529
assert!(legacy_const_generic_args.is_empty());
529530
assert!(label_res_map.is_empty());
531+
assert!(lifetime_elision_allowed.is_empty());
530532
}
531533
} else {
532534
assert!(self.owners.insert(old.id, old).is_none());

0 commit comments

Comments
 (0)