multi_index_map icon indicating copy to clipboard operation
multi_index_map copied to clipboard

Fix non-unique iteration over slab holes

Open diegomrsantos opened this issue 5 months ago • 2 comments

  • Replace nth-based logic with key-matching over iter_mut for get_mut_by_
  • Use two-pass keyed access for update_by_/modify_by_ to satisfy borrow rules and keep indexes consistent
  • Add extensive comments explaining reasoning and prior errors (E0499, closure escape)
  • Add regression tests: modify/update/get_mut over non-unique indices after holes; absent-key behaviors"

diegomrsantos avatar Aug 08 '25 14:08 diegomrsantos

@lun3x First, I'd like to thank you for creating this project and making it open-source. We attempted to use it in https://github.com/sigp/anchor, but a critical bug was encountered, resulting in the system crashing with a panic. I would appreciate it if you could take a look at this PR and see if it makes sense. Thank you.

diegomrsantos avatar Aug 08 '25 14:08 diegomrsantos

Hi @diegomrsantos thanks for this! Appreciate the work. I'll take a look at this this week.

lun3x avatar Aug 11 '25 07:08 lun3x