Skip to content

Commit 319f91a

Browse files
committed
Move legacy_const_generic_args into per-owner tables
1 parent 1769fb1 commit 319f91a

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl PerOwnerResolver<'_> {
236236
return None;
237237
}
238238

239-
if let Some(v) = self.general.legacy_const_generic_args.get(&def_id) {
239+
if let Some(v) = self.item.legacy_const_generic_args.get(&def_id) {
240240
return v.clone();
241241
}
242242
}

compiler/rustc_middle/src/ty/mod.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -189,23 +189,26 @@ pub struct ResolverGlobalCtxt {
189189

190190
#[derive(Debug)]
191191
pub struct PerOwnerResolverData {
192+
pub legacy_const_generic_args: FxHashMap<DefId, Option<Vec<usize>>>,
192193
pub node_id_to_def_id: NodeMap<LocalDefId>,
193194
/// The id of the owner
194195
pub id: ast::NodeId,
195196
}
196197

197198
impl PerOwnerResolverData {
198199
pub fn new(id: ast::NodeId) -> Self {
199-
Self { node_id_to_def_id: Default::default(), id }
200+
Self {
201+
node_id_to_def_id: Default::default(),
202+
legacy_const_generic_args: Default::default(),
203+
id,
204+
}
200205
}
201206
}
202207

203208
/// Resolutions that should only be used for lowering.
204209
/// This struct is meant to be consumed by lowering.
205210
#[derive(Debug)]
206211
pub struct ResolverAstLowering {
207-
pub legacy_const_generic_args: FxHashMap<DefId, Option<Vec<usize>>>,
208-
209212
/// Resolutions for nodes that have a single resolution.
210213
pub partial_res_map: NodeMap<hir::def::PartialRes>,
211214
/// Resolutions for import nodes, which have multiple resolutions in different namespaces.

compiler/rustc_resolve/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,6 @@ pub struct Resolver<'ra, 'tcx> {
12001200
/// and how the `impl Trait` fragments were introduced.
12011201
invocation_parents: FxHashMap<LocalExpnId, InvocationParent>,
12021202

1203-
legacy_const_generic_args: FxHashMap<DefId, Option<Vec<usize>>>,
12041203
/// Amount of lifetime parameters for each item in the crate.
12051204
item_generics_num_lifetimes: FxHashMap<LocalDefId, usize>,
12061205
delegation_fn_sigs: LocalDefIdMap<DelegationFnSig>,
@@ -1585,7 +1584,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15851584
def_id_to_node_id,
15861585
placeholder_field_indices: Default::default(),
15871586
invocation_parents,
1588-
legacy_const_generic_args: Default::default(),
15891587
item_generics_num_lifetimes: Default::default(),
15901588
main_def: Default::default(),
15911589
trait_impls: Default::default(),
@@ -1705,7 +1703,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17051703
};
17061704
let ast_lowering = ty::ResolverAstLowering {
17071705
owners: self.owners,
1708-
legacy_const_generic_args: self.legacy_const_generic_args,
17091706
partial_res_map: self.partial_res_map,
17101707
import_res_map: self.import_res_map,
17111708
label_res_map: self.label_res_map,

compiler/rustc_resolve/src/macros.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,10 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
518518
let old_id = old.id;
519519
if old.id == DUMMY_NODE_ID {
520520
if cfg!(debug_assertions) {
521-
let PerOwnerResolverData { node_id_to_def_id, id: _ } = old;
521+
let PerOwnerResolverData { node_id_to_def_id, id: _, legacy_const_generic_args } =
522+
old;
522523
assert!(node_id_to_def_id.is_empty());
524+
assert!(legacy_const_generic_args.is_empty());
523525
}
524526
} else {
525527
assert!(self.owners.insert(old.id, old).is_none());

0 commit comments

Comments
 (0)