Closed
Description
In #53783, we document more precisely the rules for the various methods that can be used to access memory through raw pointers. In particular, we clarify that the pointer must be non-NULL and aligned even when the access has size 0.
This issue is about helping people find bugs in libstd by adding a debug_assert!
to all these methods testing that condition, similar to what I did for from_raw_parts. I suggest to add a helper method to raw pointers to test this, and also use that for from_raw_parts
and from_raw_parts_mut
.
This may uncover issues in libstd, uncovering misuses of these methods. Those should then be fixed.
Metadata
Metadata
Assignees
Labels
Category: An issue proposing an enhancement or a PR with one.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the library API team, which will review and decide on the PR/issue.