Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/undeclared_label.rs')
| -rw-r--r-- | crates/ide-diagnostics/src/handlers/undeclared_label.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ide-diagnostics/src/handlers/undeclared_label.rs b/crates/ide-diagnostics/src/handlers/undeclared_label.rs index 7de9a9a323..495ea74877 100644 --- a/crates/ide-diagnostics/src/handlers/undeclared_label.rs +++ b/crates/ide-diagnostics/src/handlers/undeclared_label.rs @@ -35,6 +35,25 @@ fn foo() { } #[test] + fn while_let_loop_with_label_in_condition() { + check_diagnostics( + r#" +fn foo() { + let mut optional = Some(0); + + 'my_label: while let Some(a) = match optional { + None => break 'my_label, + Some(val) => Some(val), + } { + optional = None; + continue 'my_label; + } +} +"#, + ); + } + + #[test] fn for_loop() { check_diagnostics( r#" |