rm ItemKind::OpaqueTy

This introduce an additional collection of opaques on HIR, as they can no
longer be listed using the free item list.
This commit is contained in:
Noah Lev 2024-08-09 20:43:30 -07:00 committed by Camille GILLOT
parent 4ec7839afa
commit d6f247f3d5
45 changed files with 306 additions and 368 deletions

View file

@ -56,7 +56,7 @@ use rustc_type_ir::lang_items::TraitSolverLangItem;
pub use rustc_type_ir::lift::Lift;
use rustc_type_ir::solve::SolverMode;
use rustc_type_ir::{CollectAndApply, Interner, TypeFlags, WithCachedTypeInfo, search_graph};
use tracing::{debug, instrument};
use tracing::{debug, trace};
use crate::arena::Arena;
use crate::dep_graph::{DepGraph, DepKindStruct};
@ -2073,9 +2073,11 @@ impl<'tcx> TyCtxt<'tcx> {
}
/// Returns the origin of the opaque type `def_id`.
#[instrument(skip(self), level = "trace", ret)]
#[track_caller]
pub fn opaque_type_origin(self, def_id: LocalDefId) -> hir::OpaqueTyOrigin {
self.hir().expect_item(def_id).expect_opaque_ty().origin
let origin = self.hir().expect_opaque_ty(def_id).origin;
trace!("opaque_type_origin({def_id:?}) => {origin:?}");
origin
}
}
@ -3031,8 +3033,7 @@ impl<'tcx> TyCtxt<'tcx> {
loop {
let parent = self.local_parent(opaque_lifetime_param_def_id);
let hir::OpaqueTy { lifetime_mapping, .. } =
self.hir_node_by_def_id(parent).expect_item().expect_opaque_ty();
let hir::OpaqueTy { lifetime_mapping, .. } = self.hir().expect_opaque_ty(parent);
let Some((lifetime, _)) = lifetime_mapping
.iter()