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:
parent
4ec7839afa
commit
d6f247f3d5
45 changed files with 306 additions and 368 deletions
|
@ -316,19 +316,16 @@ fn associated_types_for_impl_traits_in_associated_fn(
|
|||
|
||||
match tcx.def_kind(parent_def_id) {
|
||||
DefKind::Trait => {
|
||||
struct RPITVisitor<'tcx> {
|
||||
struct RPITVisitor {
|
||||
rpits: FxIndexSet<LocalDefId>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for RPITVisitor<'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for RPITVisitor {
|
||||
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'tcx>) {
|
||||
if let hir::TyKind::OpaqueDef(item_id, _) = ty.kind
|
||||
&& self.rpits.insert(item_id.owner_id.def_id)
|
||||
if let hir::TyKind::OpaqueDef(opaq, _) = ty.kind
|
||||
&& self.rpits.insert(opaq.def_id)
|
||||
{
|
||||
let opaque_item =
|
||||
self.tcx.hir().expect_item(item_id.owner_id.def_id).expect_opaque_ty();
|
||||
for bound in opaque_item.bounds {
|
||||
for bound in opaq.bounds {
|
||||
intravisit::walk_param_bound(self, bound);
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +333,7 @@ fn associated_types_for_impl_traits_in_associated_fn(
|
|||
}
|
||||
}
|
||||
|
||||
let mut visitor = RPITVisitor { tcx, rpits: FxIndexSet::default() };
|
||||
let mut visitor = RPITVisitor { rpits: FxIndexSet::default() };
|
||||
|
||||
if let Some(output) = tcx.hir().get_fn_output(fn_def_id) {
|
||||
visitor.visit_fn_ret_ty(output);
|
||||
|
|
|
@ -132,6 +132,7 @@ impl<'tcx> OpaqueTypeCollector<'tcx> {
|
|||
TaitInBodyFinder { collector: self }.visit_expr(body);
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
fn visit_opaque_ty(&mut self, alias_ty: ty::AliasTy<'tcx>) {
|
||||
if !self.seen.insert(alias_ty.def_id.expect_local()) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue