1
Fork 0

We don't need to track binders if we aren't normalizing

This commit is contained in:
Oli Scherer 2023-06-26 17:50:11 +00:00
parent 907f97e411
commit 2f89c963d3

View file

@ -21,21 +21,12 @@ struct OpaqueTypeCollector<'tcx> {
/// Avoid infinite recursion due to recursive declarations. /// Avoid infinite recursion due to recursive declarations.
seen: FxHashSet<LocalDefId>, seen: FxHashSet<LocalDefId>,
universes: Vec<Option<ty::UniverseIndex>>,
span: Option<Span>, span: Option<Span>,
} }
impl<'tcx> OpaqueTypeCollector<'tcx> { impl<'tcx> OpaqueTypeCollector<'tcx> {
fn new(tcx: TyCtxt<'tcx>, item: LocalDefId) -> Self { fn new(tcx: TyCtxt<'tcx>, item: LocalDefId) -> Self {
Self { Self { tcx, opaques: Vec::new(), item, seen: Default::default(), span: None }
tcx,
opaques: Vec::new(),
item,
seen: Default::default(),
universes: vec![],
span: None,
}
} }
fn span(&self) -> Span { fn span(&self) -> Span {
@ -109,16 +100,6 @@ impl<'tcx> OpaqueTypeCollector<'tcx> {
} }
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx> { impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx> {
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(
&mut self,
t: &ty::Binder<'tcx, T>,
) -> ControlFlow<!> {
self.universes.push(None);
let t = t.super_visit_with(self);
self.universes.pop();
t
}
#[instrument(skip(self), ret, level = "trace")] #[instrument(skip(self), ret, level = "trace")]
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<!> { fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<!> {
t.super_visit_with(self)?; t.super_visit_with(self)?;