diff options
| author | Mu001999 <mu001999@outlook.com> | 2025-02-23 11:29:35 +0800 |
|---|---|---|
| committer | Mu001999 <mu001999@outlook.com> | 2025-02-23 11:29:35 +0800 |
| commit | 3fe0b3d4d04dd86cbe22770217f3b42a8856d382 (patch) | |
| tree | a2f2a7263e7a3d2385fb873128815abbcfc91575 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | a18bd8acfc32dbfbbe150cd52eecf24e67fb69b6 (diff) | |
| download | rust-3fe0b3d4d04dd86cbe22770217f3b42a8856d382.tar.gz rust-3fe0b3d4d04dd86cbe22770217f3b42a8856d382.zip | |
not lint break with label and unsafe block
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index e0e6c2177da..21e01ff535a 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1859,13 +1859,15 @@ impl<'a> Parser<'a> { let mut expr = self.parse_expr_opt()?; if let Some(expr) = &mut expr { if label.is_some() - && matches!( - expr.kind, + && match &expr.kind { ExprKind::While(_, _, None) - | ExprKind::ForLoop { label: None, .. } - | ExprKind::Loop(_, None, _) - | ExprKind::Block(_, None) - ) + | ExprKind::ForLoop { label: None, .. } + | ExprKind::Loop(_, None, _) => true, + ExprKind::Block(block, None) => { + matches!(block.rules, BlockCheckMode::Default) + } + _ => false, + } { self.psess.buffer_lint( BREAK_WITH_LABEL_AND_LOOP, |
