Are the #![feature(layout_for_ptr)]
functions sound to call on invalid data pointers?
#86602
Labels
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
A-raw-pointers
Area: raw pointers, MaybeUninit, NonNull
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Reading the documentation for the
#![feature(layout_for_ptr)]
functions, it doesn't mention if it accepts invalid data pointer values (e.g. a pointer created withcore::ptr::null()
), but seems to suggest that it does:but there's a comment mentioning that the pointer must be valid inside the functions, e.g.:
rust/library/core/src/mem/mod.rs
Lines 375 to 378 in 456a032
I would think that the answer is yes since its operating on the metadata of the pointer and not the pointer value itself (and with my limited testing, this seems like the current behavior). However, in either case I think its worth explicitly mentioning the validity of the pointer in the documentation for the functions.
The text was updated successfully, but these errors were encountered: