Clarify std::mem-docs wrt host/target #81206
Labels
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
A-layout
Area: Memory layout of types
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Functions like
std::mem::align_of
(and also parts ofstd::alloc::Layout
) which are const can be used to initialize other constants and, soon, types like[u8; { std::mem::align_of::<String>() }]
. As far as I can see the docs currently do not explicitly make it clear that the compiler guarantees (including future versions) that the return values of those functions are valid for the target-platform and not for the host-platform, even in a const-context.This is probably everybody's expectation. If this behavior is guaranteed, the docs should mention that, though.
The text was updated successfully, but these errors were encountered: