Move some Map
methods onto TyCtxt
.
The end goal is to eliminate `Map` altogether. I added a `hir_` prefix to all of them, that seemed simplest. The exceptions are `module_items` which became `hir_module_free_items` because there was already a `hir_module_items`, and `items` which became `hir_free_items` for consistency with `hir_module_free_items`.
This commit is contained in:
parent
cd1d84cdf7
commit
f86f7ad5f2
197 changed files with 465 additions and 476 deletions
|
@ -10,13 +10,13 @@ pub(crate) fn collect(tcx: TyCtxt<'_>, LocalCrate: LocalCrate) -> FxIndexMap<Def
|
|||
let mut modules = FxIndexMap::default();
|
||||
|
||||
// We need to collect all the `ForeignMod`, even if they are empty.
|
||||
for id in tcx.hir().items() {
|
||||
for id in tcx.hir_free_items() {
|
||||
if !matches!(tcx.def_kind(id.owner_id), DefKind::ForeignMod) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let def_id = id.owner_id.to_def_id();
|
||||
let item = tcx.hir().item(id);
|
||||
let item = tcx.hir_item(id);
|
||||
|
||||
if let hir::ItemKind::ForeignMod { abi, items } = item.kind {
|
||||
let foreign_items = items.iter().map(|it| it.id.owner_id.to_def_id()).collect();
|
||||
|
|
|
@ -1940,7 +1940,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
bug!("Unknown proc-macro type for item {:?}", id);
|
||||
};
|
||||
|
||||
let mut def_key = self.tcx.hir().def_key(id);
|
||||
let mut def_key = self.tcx.hir_def_key(id);
|
||||
def_key.disambiguated_data.data = DefPathData::MacroNs(name);
|
||||
|
||||
let def_id = id.to_def_id();
|
||||
|
@ -2076,7 +2076,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
let mut trait_impls: FxIndexMap<DefId, Vec<(DefIndex, Option<SimplifiedType>)>> =
|
||||
FxIndexMap::default();
|
||||
|
||||
for id in tcx.hir().items() {
|
||||
for id in tcx.hir_free_items() {
|
||||
let DefKind::Impl { of_trait } = tcx.def_kind(id.owner_id) else {
|
||||
continue;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue