1
Fork 0

Account for self ty alias

This commit is contained in:
Michael Goulet 2024-07-17 16:36:21 -04:00
parent 3716a3fd31
commit a0a251a688
6 changed files with 34 additions and 15 deletions

View file

@ -1961,11 +1961,16 @@ impl<'tcx> Visitor<'tcx> for CollectUsageSpans<'_> {
}
fn visit_ty(&mut self, t: &'tcx hir::Ty<'tcx>) -> Self::Result {
if let hir::TyKind::Path(hir::QPath::Resolved(None, qpath)) = t.kind
&& let Res::Def(DefKind::TyParam, def_id) = qpath.res
&& def_id == self.param_def_id
{
self.spans.push(t.span);
if let hir::TyKind::Path(hir::QPath::Resolved(None, qpath)) = t.kind {
if let Res::Def(DefKind::TyParam, def_id) = qpath.res
&& def_id == self.param_def_id
{
self.spans.push(t.span);
return;
} else if let Res::SelfTyAlias { .. } = qpath.res {
self.spans.push(t.span);
return;
}
}
intravisit::walk_ty(self, t);
}