Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs')
-rw-r--r--crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs b/crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs
index 89aa437d75..7baa7b6426 100644
--- a/crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs
+++ b/crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs
@@ -135,4 +135,22 @@ fn test() {
"#,
);
}
+
+ #[test]
+ fn try_block_desugaring_inside_closure() {
+ // regression test for #14701
+ check_diagnostics(
+ r#"
+//- minicore: option, try
+fn test() {
+ try {
+ || {
+ let x = Some(2);
+ Some(x?)
+ };
+ };
+}
+"#,
+ );
+ }
}