1
Fork 0

Rollup merge of #117136 - compiler-errors:defid-list, r=oli-obk

Intern `LocalDefId` list from `opaque_types_defined_by` query

r? oli-obk
This commit is contained in:
Matthias Krüger 2023-10-25 17:40:29 +02:00 committed by GitHub
commit acc68e90bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

View file

@ -264,7 +264,10 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx> {
}
}
fn opaque_types_defined_by<'tcx>(tcx: TyCtxt<'tcx>, item: LocalDefId) -> &'tcx [LocalDefId] {
fn opaque_types_defined_by<'tcx>(
tcx: TyCtxt<'tcx>,
item: LocalDefId,
) -> &'tcx ty::List<LocalDefId> {
let kind = tcx.def_kind(item);
trace!(?kind);
let mut collector = OpaqueTypeCollector::new(tcx, item);
@ -306,7 +309,7 @@ fn opaque_types_defined_by<'tcx>(tcx: TyCtxt<'tcx>, item: LocalDefId) -> &'tcx [
collector.opaques.extend(tcx.opaque_types_defined_by(tcx.local_parent(item)));
}
}
tcx.arena.alloc_from_iter(collector.opaques)
tcx.mk_local_def_ids(&collector.opaques)
}
pub(super) fn provide(providers: &mut Providers) {