-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
vec macro into_boxed codegen regression #71861
Comments
Assigning |
Changing the priority to |
Would be nice to identify where this has regressed ... @rustbot ping cleanup |
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good cc @AminArria @chrissimpkins @contrun @DutchGhost @elshize @ethanboxx @h-michael @HallerPatrick @hdhoang @hellow554 @imtsuki @jakevossen5 @kanru @KarlK90 @LeSeulArtichaut @MAdrianMattocks @matheus-consoli @mental32 @nmccarty @Noah-Kennedy @pard68 @PeytonT @pierreN @Redblueflame @RobbieClarken @RobertoSnap @robjtede @SarthakSingh31 @senden9 @shekohex @sinato @spastorino @turboladen @woshilapin @yerke |
This was discussed during today's weekly meeting. Removing |
searched nightlies: from nightly-2020-02-02 to nightly-2020-05-22 bisected with cargo-bisect-rustc v0.5.1Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --start 2020-02-02 --prompt -- asm issue71861::bar2 |
Bisected with git bisect |
This might have affected |
#75677 removes the panic, "Tried to shrink to a larger capacity". However, I think this issue could be further improved if the compiler could also see that it will never need a realloc, since the |
Don't panic in Vec::shrink_to_fit We can help the compiler see that `Vec::shrink_to_fit` will never reach the panic case in `RawVec::shrink_to_fit`, just by guarding the call only for cases where the capacity is strictly greater. A capacity less than the length is only possible through an unsafe call to `set_len`, which would break the `Vec` invariants, so `shrink_to_fit` can just ignore that. This removes the panicking code from the examples in both rust-lang#71861 and rust-lang#75636.
I think this is fine now with current nightly:
|
This is a regression from stable 1.42.0 to the latest beta & nightly
found because of this: https://internals.rust-lang.org/t/more-efficient-boxed-slice-creation/12271
I think the regression happened because of a missed optimization to inline
alloc::raw_vec::RawVec<T,A>::allocate_in::{{closure}}
, so it generates unnecessary panic handlersstable
nightly
The text was updated successfully, but these errors were encountered: