Skip to content

fix: Miri error on invalidated mut borrow#443

Merged
Licenser merged 2 commits intosimd-lite:mainfrom
EmilyMatt:miri-error
Mar 10, 2026
Merged

fix: Miri error on invalidated mut borrow#443
Licenser merged 2 commits intosimd-lite:mainfrom
EmilyMatt:miri-error

Conversation

@EmilyMatt
Copy link
Contributor

Because the function continuously mutates the data in the input mut slice, miri's borrow checker invalidates the original mut borrow, so calling input.as_mut_ptr() is not allowed(miri no longer guarantees the validity of input)
This can be fixed by calling input.as_mut_ptr() once and using that var

Copy link
Member

@Licenser Licenser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, very nice improvement, thank you!

@Licenser Licenser merged commit 10a71fc into simd-lite:main Mar 10, 2026
15 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants