From a77789e7aa50a652cbd15cfd400acdfc4602167c Mon Sep 17 00:00:00 2001 From: jDomantas Date: Sun, 17 Sep 2023 11:54:42 +0300 Subject: [PATCH] regression test --- .../src/handlers/mutability_errors.rs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/crates/ide-diagnostics/src/handlers/mutability_errors.rs b/crates/ide-diagnostics/src/handlers/mutability_errors.rs index 8976a3de67bc..d03a0009c48a 100644 --- a/crates/ide-diagnostics/src/handlers/mutability_errors.rs +++ b/crates/ide-diagnostics/src/handlers/mutability_errors.rs @@ -1170,6 +1170,27 @@ fn f() { loop {} for _ in 0..2 {} } +"#, + ); + } + + #[test] + fn regression_15623() { + check_diagnostics( + r#" +struct Foo; + +impl Foo { + fn needs_mut(&mut self) {} +} + +fn main() { + let mut foo = Foo; + || { + let 0 = 1 else { return }; + foo.needs_mut(); + }; +} "#, ); }