Files
rust/tests
Jonathan Brouwer 11610db252 Rollup merge of #152216 - GTimothy:map-diagnostics-fix, r=JonathanBrouwer
Fix 'assign to data in an index of' collection suggestions

fixes https://github.com/rust-lang/rust/issues/150001
fixes https://github.com/rust-lang/rust-analyzer/issues/16076
fixes https://github.com/rust-lang/rust/issues/134917

The issues are threefold and linked:
 1. Assigning data to a ~~collection~~BTreeMap/HashMap suggests 3 solutions all marked as `MachineApplicable`
 2. The suggestions are slightly wrong with regards to their borrowing needs.
 3. The suggestions are not guaranteed to produce code that is valid, and suggestion number two is equivalent to an update, not an insertion.

This PR:
 - splits the large triple suggestion into three
 - sets them to `MaybeIncorrect`
 - automatically determines the required borrowing to use.

 I think this solution may not be very elegant, expecially the key typechecking / borrowing part, but it works. I am however very open to any improvement/change :)

 edit: edited to replace 'collection' with  BTreeMap/HashMap'
2026-05-03 16:33:21 +02:00
..
2026-04-19 18:27:10 +02:00