Rollup merge of #101492 - TaKO8Ki:suggest-adding-array-length-to-ref-to-array, r=oli-obk
Suggest adding array lengths to references to arrays if possible ref: https://github.com/rust-lang/rust/pull/100590#pullrequestreview-1096851146
This commit is contained in:
commit
bef48f9314
5 changed files with 120 additions and 29 deletions
|
@ -2401,6 +2401,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`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue