Rollup merge of #123623 - surechen:fix_123261, r=estebank

Fix OutsideLoop's error suggestion: adding label `'block` for `if` block.

For OutsideLoop we should not suggest add `'block` label in `if` block, or we wiil get another err: block label not supported here.

fixes #123261
This commit is contained in:
Matthias Krüger
2024-05-23 07:41:16 +02:00
committed by GitHub
6 changed files with 290 additions and 45 deletions

View File

@@ -1100,7 +1100,7 @@ pub struct BreakInsideCoroutine<'a> {
pub struct OutsideLoop<'a> {
#[primary_span]
#[label]
pub span: Span,
pub spans: Vec<Span>,
pub name: &'a str,
pub is_break: bool,
#[subdiagnostic]
@@ -1112,7 +1112,7 @@ pub struct OutsideLoopSuggestion {
#[suggestion_part(code = "'block: ")]
pub block_span: Span,
#[suggestion_part(code = " 'block")]
pub break_span: Span,
pub break_spans: Vec<Span>,
}
#[derive(Diagnostic)]