diff --git a/crates/ide-diagnostics/src/handlers/mutability_errors.rs b/crates/ide-diagnostics/src/handlers/mutability_errors.rs index 8976a3de67b..d03a0009c48 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(); + }; +} "#, ); }