Don't create drop scopes after item statements
These scopes would not exist in MIR and can cause ICEs with invalid uses of let expressions.
This commit is contained in:
parent
7d1e416d32
commit
7b61f7f002
3 changed files with 47 additions and 1 deletions
|
@ -149,7 +149,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
|
|||
// From now on, we continue normally.
|
||||
visitor.cx = prev_cx;
|
||||
}
|
||||
hir::StmtKind::Local(..) | hir::StmtKind::Item(..) => {
|
||||
hir::StmtKind::Local(..)=> {
|
||||
// Each declaration introduces a subscope for bindings
|
||||
// introduced by the declaration; this subscope covers a
|
||||
// suffix of the block. Each subscope in a block has the
|
||||
|
@ -163,6 +163,10 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
|
|||
visitor.cx.var_parent = visitor.cx.parent;
|
||||
visitor.visit_stmt(statement)
|
||||
}
|
||||
hir::StmtKind::Item(..) => {
|
||||
// Don't create scopes for items, since they won't be
|
||||
// lowered to THIR and MIR.
|
||||
}
|
||||
hir::StmtKind::Expr(..) | hir::StmtKind::Semi(..) => visitor.visit_stmt(statement),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue