diff --git a/src/matches.rs b/src/matches.rs index fe9e7836ba7..a7677c3a35c 100644 --- a/src/matches.rs +++ b/src/matches.rs @@ -306,8 +306,9 @@ fn block_can_be_flattened<'a>( expr: &'a ast::Expr, ) -> Option<&'a ast::Block> { match expr.kind { - ast::ExprKind::Block(ref block, _) - if !is_unsafe_block(block) + ast::ExprKind::Block(ref block, label) + if label.is_none() + && !is_unsafe_block(block) && !context.inside_macro() && is_simple_block(context, block, Some(&expr.attrs)) && !stmt_is_expr_mac(&block.stmts[0]) => diff --git a/tests/target/issue_5676.rs b/tests/target/issue_5676.rs new file mode 100644 index 00000000000..25877110545 --- /dev/null +++ b/tests/target/issue_5676.rs @@ -0,0 +1,8 @@ +fn main() { + match true { + true => 'a: { + break 'a; + } + _ => (), + } +}