1
Fork 0

Rollup merge of #116187 - estebank:small-tweak, r=compiler-errors

Add context to `let: Ty = loop { break };`

We weren't accounting for the case where `break` was immediately within the `loop` block.
This commit is contained in:
Matthias Krüger 2023-09-27 10:42:35 +02:00 committed by GitHub
commit a6f066596b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 5 deletions

View file

@ -545,6 +545,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Climb the HIR tree to see if the current `Expr` is part of a `break;` statement.
let Some(
hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Semi(&ref p), .. })
| hir::Node::Block(hir::Block { expr: Some(&ref p), .. })
| hir::Node::Expr(&ref p),
) = self.tcx.hir().find(parent_id)
else {