-
Notifications
You must be signed in to change notification settings - Fork 1.6k
manual_slice_fill
wrongly suggest non-const initializers
#14192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Ping @lapla-cogito Note that #14191 fixes another bug, when the slice is initialized from an iterator. |
Thank you for letting me know, I submitted #14193. |
That was fast! |
fix #14192 changelog: [`manual_slice_fill`]: resolve FP caused by missing index checks for the slice
Don't know how it's possible, but it seems this issue somehow sneaked into
CI run: https://github.com/davidlattimore/wild/actions/runs/14258683395/job/39965815664?pr=642 |
1.86 branched from master on Feb 14, and the fix only made it into the rust repository on Mar 2, so it missed the 1.86 release. It should be fixed on beta and will be in the next release 1.87. |
I can confirm it's OK with the current nightly. I think the issue is pretty common, and I would consider backporting the fix to |
Summary
manual_slice_fill
does not check:Lint Name
manual_slice_fill
Reproducer
I tried this code:
I saw this happen, for both loops:
I expected to see this happen: no lint, since in the first loop the initializer depends on the loop variable, and in the second loop the loop variable is not used to index the slice.
Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: