Closed
Description
Feature const_alloc_layout
makes these methods on Layout
const:
impl Layout {
fn for_value<T>(t: &T) -> Layout
fn align_to(&self, align: usize) -> Result<Layout, LayoutError>
fn pad_to_align(&self) -> Layout
fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutError>
fn array<T>(n: usize) -> Result<Layout, LayoutError>
}
Making more methods of alloc::Layout
const allows computing alignment/size information for arbitrary (sized) types at compile-time. While mem::size_of
and mem::align_of
are already const and Layout
is solely based on those, there is no guarantee that a const derived from these functions will be exactly the same as what is used in a call to alloc::alloc
. Constifying Layout
makes this possible.
Implemented in #67494
Blocked on #46571 (needed for for_value
)
Metadata
Metadata
Assignees
Labels
Area: Custom and system allocatorsArea: Constant evaluation, covers all const contexts (static, const fn, ...)Category: An issue tracking the progress of sth. like the implementation of an RFCLibs issues that are tracked on the team's project board.Relevant to the library API team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.