Partly flatten the user-type loop in TypeVerifier::visit_local_decl
This commit is contained in:
parent
6d3c050de8
commit
849b0920b1
1 changed files with 33 additions and 30 deletions
|
@ -456,8 +456,12 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
|
|||
fn visit_local_decl(&mut self, local: Local, local_decl: &LocalDecl<'tcx>) {
|
||||
self.super_local_decl(local, local_decl);
|
||||
|
||||
if let Some(user_ty) = &local_decl.user_ty {
|
||||
for (user_ty, span) in user_ty.projections_and_spans() {
|
||||
for (user_ty, span) in local_decl
|
||||
.user_ty
|
||||
.as_deref()
|
||||
.into_iter()
|
||||
.flat_map(UserTypeProjections::projections_and_spans)
|
||||
{
|
||||
let ty = if !local_decl.is_nonref_binding() {
|
||||
// If we have a binding of the form `let ref x: T = ..`
|
||||
// then remove the outermost reference so we can check the
|
||||
|
@ -490,7 +494,6 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_body(&mut self, body: &Body<'tcx>) {
|
||||
// The types of local_decls are checked above which is called in super_body.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue