about summary refs log tree commit diff
path: root/src/librustc_arena
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-918/+0
2020-08-14Simplify arena_types macrosMatthew Jasper-5/+1
2020-06-20Rollup merge of #73378 - matthewjasper:arena-not-special, r=oli-obkManish Goregaokar-43/+52
Remove use of specialization from librustc_arena This reworks the macro so that specialization, `transmute` and `#[marker]` are not used. r? @oli-obk
2020-06-18Use alloc::Layout in DroplessArena APITomasz Miąsko-20/+19
2020-06-16Explain unused macro paramMatthew Jasper-0/+4
2020-06-16Rollup merge of #73237 - tmiasko:arena, r=nnethercoteDylan DPC-31/+41
Check for overflow in DroplessArena and align returned memory * Check for overflow when calculating the slice start & end position. * Align the pointer obtained from the allocator, ensuring that it satisfies user requested alignment (the allocator is only asked for layout compatible with u8 slice). * Remove an incorrect assertion from DroplessArena::align. * Avoid forming references to an uninitialized memory in DroplessArena. Helps with #73007, #72624.
2020-06-15Remove use of specialization from librustc_arenaMatthew Jasper-43/+48
2020-06-15Rollup merge of #72707 - matthewjasper:rustc_min_spec, r=oli-obkRalf Jung-10/+19
Use min_specialization in the remaining rustc crates This adds a lot of `transmute` calls to replace the unsound uses of specialization. It's ugly, but at least it's honest about what's going on. cc #71420, @RalfJung
2020-06-15Avoid forming references to an uninitialized memory in DroplessArenaTomasz Miąsko-14/+11
Return a pointer from `alloc_raw` instead of a slice. There is no practical use for slice as a return type and changing it to a pointer avoids forming references to an uninitialized memory.
2020-06-15Check for overflow in DroplessArena and return aligned pointerTomasz Miąsko-20/+33
* Check for overflow when calculating the slice start & end position. * Align the pointer obtained from the allocator, ensuring that it satisfies user requested alignment (the allocator is only asked for layout compatible with u8 slice). * Remove an incorrect assertion from DroplessArena::align.
2020-06-10Use min_specialization in the remaining rustc cratesMatthew Jasper-10/+19
2020-06-09Rename some identifiers in `RawVec` and `libarena`.Nicholas Nethercote-26/+26
- Use `len` more consistently for the number of elements in a vector, because that's the usual name. - Use `additional` more consistently for the number of elements we want to add, because that's what `Vec::reserve()` uses. - Use `cap` consistently rather than `capacity`. - Plus a few other tweaks. This increases consistency and conciseness.
2020-06-09Remove the `reserve_in_place` calls in `{Typed,Dropless}Arena::grow`.Nicholas Nethercote-30/+22
They are pointless. No reasonable allocator will be able to satisfy a `reserve_in_place` request that *doubles* the size of an allocation when dealing with allocations that are 4 KiB and larger. Just to be sure, I confirmed on Linux that the `reserve_in_place` calls never succeed. (Note however that the `reserve_in_place` call for `DroplessArena::grow` did occasionally succeed prior to the off-by-one fix in the previous commit, because we would sometimes do a `reserve_in_place` request for the chunk's current size, which would trivially succeed!)
2020-06-09Fix off-by-one error in `DroplessArena::alloc_raw`.Nicholas Nethercote-1/+1
This causes unnecessary calls to `grow` when the allocation would fit exactly in the remaining space.
2020-06-02Make things build againVadim Petrochenkov-2/+2
2020-06-02Rename directories for some compiler crates from `libx` to `librustc_x`Vadim Petrochenkov-0/+903
libarena -> librustc_arena libfmt_macros -> librustc_parse_format libgraphviz -> librustc_graphviz libserialize -> librustc_serialize