Skip to content

Commit fc5c4da

Browse files
committed
Temporarily only adding UserAssertTy on binding patterns.
1 parent e1648bd commit fc5c4da

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/librustc_mir/build/block.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,17 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
125125
})
126126
}));
127127
} else {
128-
this.visit_bindings(&pattern, &mut |this, _, _, node, span, _| {
129-
this.storage_live_binding(block, node, span);
128+
// FIXME: We currently only insert `UserAssertTy` statements for patterns
129+
// that are bindings, this is as we do not want to deconstruct the type
130+
// being assertion to match the pattern.
131+
if let PatternKind::Binding { var, .. } = *pattern.kind {
130132
if let Some(ty) = ty {
131-
this.user_assert_ty(block, ty, node, span);
133+
this.user_assert_ty(block, ty, var, span);
132134
}
135+
}
136+
137+
this.visit_bindings(&pattern, &mut |this, _, _, node, span, _| {
138+
this.storage_live_binding(block, node, span);
133139
this.schedule_drop_for_binding(node, span);
134140
})
135141
}

0 commit comments

Comments
 (0)