Skip to content

Commit c54301f

Browse files
author
cardigan1008
committed
fix: Add if to check whether the previous node is Block
1 parent 5ce96b1 commit c54301f

File tree

1 file changed

+3
-0
lines changed
  • compiler/rustc_middle/src/hir/map

1 file changed

+3
-0
lines changed

compiler/rustc_middle/src/hir/map/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,9 @@ impl<'hir> Map<'hir> {
563563
// We verify that indirectly by checking that the previous node is the
564564
// current node's body
565565
if node.body_id().map(|b| b.hir_id) == prev_hir_id => {
566+
if let Node::Expr(Expr { kind: ExprKind::Block(_, _), ..}) = self.tcx.hir_node(prev_hir_id.unwrap()) {
567+
return None;
568+
}
566569
return Some(hir_id)
567570
}
568571
// Ignore `return`s on the first iteration

0 commit comments

Comments
 (0)