File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
ide-diagnostics/src/handlers Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1661,6 +1661,14 @@ impl DefWithBody {
16611661 let Some ( & local) = mir_body. binding_locals . get ( binding_id) else {
16621662 continue ;
16631663 } ;
1664+ if body[ binding_id]
1665+ . definitions
1666+ . iter ( )
1667+ . any ( |& pat| source_map. pat_syntax ( pat) . is_err ( ) )
1668+ {
1669+ // Skip synthetic bindings
1670+ continue ;
1671+ }
16641672 let need_mut = & mol[ local] ;
16651673 let local = Local { parent : self . into ( ) , binding_id } ;
16661674 match ( need_mut, local. is_mut ( db) ) {
Original file line number Diff line number Diff line change @@ -1091,6 +1091,19 @@ fn main() {
10911091 //^^^^^ 💡 weak: variable does not need to be mutable
10921092 f(x);
10931093}
1094+ "# ,
1095+ ) ;
1096+ }
1097+
1098+ #[ test]
1099+ fn regression_15099 ( ) {
1100+ check_diagnostics (
1101+ r#"
1102+ //- minicore: iterator, range
1103+ fn f() {
1104+ loop {}
1105+ for _ in 0..2 {}
1106+ }
10941107"# ,
10951108 ) ;
10961109 }
You can’t perform that action at this time.
0 commit comments