suggest adding array lengths to references to arrays

This commit is contained in:
Takayuki Maeda 2022-09-07 02:37:18 +09:00
parent b44197abb0
commit 1e384423a9
5 changed files with 120 additions and 29 deletions

View file

@ -2396,6 +2396,14 @@ impl<'hir> Ty<'hir> {
_ => None,
}
}
pub fn peel_refs(&self) -> &Self {
let mut final_ty = self;
while let TyKind::Rptr(_, MutTy { ty, .. }) = &final_ty.kind {
final_ty = &ty;
}
final_ty
}
}
/// Not represented directly in the AST; referred to by name through a `ty_path`.