1
Fork 0

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

@ -814,7 +814,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
| Target::Mod
| Target::GlobalAsm
| Target::TyAlias
| Target::OpaqueTy
| Target::Enum
| Target::Variant
| Target::Struct
@ -1328,7 +1327,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
) {
let article = match target {
Target::ExternCrate
| Target::OpaqueTy
| Target::Enum
| Target::Impl
| Target::Expression

View file

@ -41,6 +41,7 @@ fn should_explore(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
| Node::TraitItem(..)
| Node::Variant(..)
| Node::AnonConst(..)
| Node::OpaqueTy(..)
)
}
@ -494,6 +495,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
Node::ForeignItem(foreign_item) => {
intravisit::walk_foreign_item(self, foreign_item);
}
Node::OpaqueTy(opaq) => intravisit::walk_opaque_ty(self, opaq),
_ => {}
}
self.repr_has_repr_simd = had_repr_simd;
@ -655,14 +657,6 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> {
intravisit::walk_path(self, path);
}
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'tcx>) {
if let TyKind::OpaqueDef(item_id, _) = ty.kind {
let item = self.tcx.hir().item(item_id);
intravisit::walk_item(self, item);
}
intravisit::walk_ty(self, ty);
}
fn visit_anon_const(&mut self, c: &'tcx hir::AnonConst) {
// When inline const blocks are used in pattern position, paths
// referenced by it should be considered as used.

View file

@ -230,7 +230,6 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
ForeignMod,
GlobalAsm,
TyAlias,
OpaqueTy,
Enum,
Struct,
Union,

View file

@ -236,7 +236,6 @@ impl<'tcx> ReachableContext<'tcx> {
// worklist, as determined by the privacy pass
hir::ItemKind::ExternCrate(_)
| hir::ItemKind::Use(..)
| hir::ItemKind::OpaqueTy(..)
| hir::ItemKind::TyAlias(..)
| hir::ItemKind::Macro(..)
| hir::ItemKind::Mod(..)
@ -287,7 +286,8 @@ impl<'tcx> ReachableContext<'tcx> {
| Node::Field(_)
| Node::Ty(_)
| Node::Crate(_)
| Node::Synthetic => {}
| Node::Synthetic
| Node::OpaqueTy(..) => {}
_ => {
bug!(
"found unexpected node kind in worklist: {} ({:?})",