diff options
| author | Ralf Jung <post@ralfj.de> | 2024-09-01 11:21:37 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-09-01 11:21:37 +0200 |
| commit | 0e5628d7de217454052d5246e994590fa7b75a93 (patch) | |
| tree | 085f080e670a6261202a4747ebcd8897a216dce5 /library/alloc | |
| parent | 05ffd446a9b2d2c67c450bea4180eb4790939e07 (diff) | |
| download | rust-0e5628d7de217454052d5246e994590fa7b75a93.tar.gz rust-0e5628d7de217454052d5246e994590fa7b75a93.zip | |
tweak wording regarding Box validity
Diffstat (limited to 'library/alloc')
| -rw-r--r-- | library/alloc/src/boxed.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index b3a3cf1bbea..a924feaf15f 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<T>` must point to a valid value of `T`. //! //! So long as `T: Sized`, a `Box<T>` is guaranteed to be represented //! as a single pointer and is also ABI-compatible with C pointers |
