Skip to content

Commit fc6b395

Browse files
committed
Make all fields of ProjectedOwnerInfo private
1 parent 6f0dc94 commit fc6b395

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

compiler/rustc_middle/src/hir/mod.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,23 @@ pub struct Hashes {
460460
/// For comments about each field see `OwnerInfo` struct.
461461
#[derive(Clone, Copy, Debug, StableHash)]
462462
pub struct ProjectedOwnerInfo<'tcx> {
463-
pub nodes: &'tcx OwnerNodes<'tcx>,
464-
pub parenting: &'tcx LocalDefIdMap<ItemLocalId>,
465-
pub trait_map: &'tcx ItemLocalMap<&'tcx [TraitCandidate<'tcx>]>,
463+
nodes: &'tcx OwnerNodes<'tcx>,
464+
parenting: &'tcx LocalDefIdMap<ItemLocalId>,
465+
trait_map: &'tcx ItemLocalMap<&'tcx [TraitCandidate<'tcx>]>,
466466

467467
#[stable_hash(ignore)]
468-
pub delayed_lints: &'tcx Steal<DelayedLints>,
468+
delayed_lints: &'tcx Steal<DelayedLints>,
469+
}
470+
471+
impl<'tcx> ProjectedOwnerInfo<'tcx> {
472+
pub fn new(
473+
nodes: &'tcx OwnerNodes<'tcx>,
474+
parenting: &'tcx LocalDefIdMap<ItemLocalId>,
475+
trait_map: &'tcx ItemLocalMap<&'tcx [TraitCandidate<'tcx>]>,
476+
delayed_lints: &'tcx Steal<DelayedLints>,
477+
) -> ProjectedOwnerInfo<'tcx> {
478+
ProjectedOwnerInfo { nodes, parenting, trait_map, delayed_lints }
479+
}
469480
}
470481

471482
#[derive(Clone, Copy, Debug, StableHash)]

compiler/rustc_middle/src/ty/context.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,12 +627,12 @@ impl<'tcx> TyCtxtFeed<'tcx, LocalDefId> {
627627

628628
// Fills in all the important parts needed by HIR queries
629629
pub fn feed_hir(&self) {
630-
self.hir_owner(ProjectedMaybeOwner::Owner(ProjectedOwnerInfo {
631-
nodes: self.tcx.arena.alloc(hir::OwnerNodes::synthetic()),
632-
parenting: self.tcx.arena.alloc(Default::default()),
633-
delayed_lints: self.tcx.arena.alloc(Steal::new(Default::default())),
634-
trait_map: self.tcx.arena.alloc(Default::default()),
635-
}));
630+
self.hir_owner(ProjectedMaybeOwner::Owner(ProjectedOwnerInfo::new(
631+
self.tcx.arena.alloc(hir::OwnerNodes::synthetic()),
632+
self.tcx.arena.alloc(Default::default()),
633+
self.tcx.arena.alloc(Default::default()),
634+
self.tcx.arena.alloc(Steal::new(Default::default())),
635+
)));
636636

637637
self.feed_owner_id().hir_attr_map(hir::AttributeMap::EMPTY);
638638
}

0 commit comments

Comments
 (0)