Rollup merge of #120428 - petrochenkov:somehir2, r=compiler-errors

hir: Two preparatory changes for #120206

cc https://github.com/rust-lang/rust/pull/120206
r? ```@compiler-errors```
This commit is contained in:
Dylan DPC 2024-01-29 12:56:54 +00:00 committed by GitHub
commit eaa100204e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 33 additions and 39 deletions

View file

@ -2529,7 +2529,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
}
hir::TyKind::Array(ty, length) => {
let length = match length {
&hir::ArrayLen::Infer(_, span) => self.ct_infer(tcx.types.usize, None, span),
hir::ArrayLen::Infer(inf) => self.ct_infer(tcx.types.usize, None, inf.span),
hir::ArrayLen::Body(constant) => {
ty::Const::from_anon_const(tcx, constant.def_id)
}

View file

@ -146,8 +146,8 @@ impl<'v> Visitor<'v> for HirPlaceholderCollector {
}
}
fn visit_array_length(&mut self, length: &'v hir::ArrayLen) {
if let &hir::ArrayLen::Infer(_, span) = length {
self.0.push(span);
if let hir::ArrayLen::Infer(inf) = length {
self.0.push(inf.span);
}
intravisit::walk_array_len(self, length)
}