Account for self ty alias
This commit is contained in:
parent
3716a3fd31
commit
a0a251a688
6 changed files with 34 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue