From 0e5628d7de217454052d5246e994590fa7b75a93 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 1 Sep 2024 11:21:37 +0200 Subject: [PATCH] tweak wording regarding Box validity --- library/alloc/src/boxed.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index b3a3cf1bbeaaa..a924feaf15f2a 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -64,8 +64,9 @@ //! //! For zero-sized values, the `Box` pointer has to be non-null and sufficiently aligned. The //! recommended way to build a Box to a ZST if `Box::new` cannot be used is to use -//! [`ptr::NonNull::dangling`]. Even for zero-sized types, the pointee type must be inhabited -//! to ensure that the Box points to a valid value of the given type. +//! [`ptr::NonNull::dangling`]. +//! +//! On top of these basic layout requirements, a `Box` must point to a valid value of `T`. //! //! So long as `T: Sized`, a `Box` is guaranteed to be represented //! as a single pointer and is also ABI-compatible with C pointers