Uh oh!
There was an error while loading. Please reload this page.
Support allocating iterators with arenas - #59533
Conversation
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
29cef27 to
3c51be5CompareIntroduce an arena type which may be used to allocate a list of types with destructors You can also specify that you want deserializers for `&'tcx [T]` and `&'tcx T` for a type in the list, which will allocate those using the arena. Based on #59517 and #59533. Look at the last commit for the interesting changes. An alternative to #56448. cc @michaelwoerister@eddyb r? @oli-obk
There was a problem hiding this comment.
Maybe add a debug_assert!(self.can_allocate(len)) here, just to be sure.
There was a problem hiding this comment.
Can you add a let len = min; binding here? I think that makes it more readable.
There was a problem hiding this comment.
@michaelwoerister that seems like an odd use of let bindings... perhaps a comment instead?
There was a problem hiding this comment.
I'd do both actually, as in:
// In this branch we know the exact lengthlet len = min;There was a problem hiding this comment.
From looking at the implementation of SmallVec, it looks like this does the right thing, but I think it would be clearer to directly call vec.set_len(0) here.
There was a problem hiding this comment.
Looks like this was an existing bug, right? Good find!
There was a problem hiding this comment.
There previously wasn't a way to end up with unused memory at the end of a chunk for types with destructors, so not an existing bug.
There was a problem hiding this comment.
No? It looks like a similar case can also happen already in alloc_slice:
Line 170 in f694222
There was a problem hiding this comment.
That requires Copy types, so it can't trigger it.
michaelwoerister
commented
Apr 2, 2019
bors
commented
Apr 2, 2019
📌 Commit 59ff059 has been approved by |
Support allocating iterators with arenas Split out from rust-lang#57173. r? @michaelwoerister
Rollup of 8 pull requests Successful merges: - #59262 (Remove duplicated code from Iterator::{ne, lt, le, gt, ge}) - #59286 (Refactor async fn return type lowering) - #59444 (Implement useful steps_between for all integers) - #59452 (Speed up rustdoc run a bit) - #59533 (Support allocating iterators with arenas) - #59585 (Fixes for shallow borrows) - #59607 (Renames `EvalErrorKind` to `InterpError`) - #59613 (SGX target: convert a bunch of panics to aborts) Failed merges: - #59630 (Shrink `mir::Statement`.) r? @ghost
Introduce an arena type which may be used to allocate a list of types with destructors You can also specify that you want deserializers for `&'tcx [T]` and `&'tcx T` for a type in the list, which will allocate those using the arena. Based on #59517 and #59533. Look at the last commit for the interesting changes. An alternative to #56448. cc @michaelwoerister@eddyb r? @oli-obk
Split out from #57173.
r? @michaelwoerister