From ab30b8a703cca5513eed4e5d95a174b65485949d Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 11 Jun 2026 07:10:46 +0000 Subject: [PATCH] Document metadata of ptrs to indirectly unsized types We say that pointers to DSTs store metadata and what that metadata is for pointers to slices, `str`, and trait objects. But a struct or tuple with an unsized tail is itself a DST, and we hadn't said what the metadata is for pointers to these unsized types. Now that we've defined *metadata* and *unsized tail*, let's complete this enumeration. --- src/dynamically-sized-types.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dynamically-sized-types.md b/src/dynamically-sized-types.md index b14a807e83..52c7ac3f43 100644 --- a/src/dynamically-sized-types.md +++ b/src/dynamically-sized-types.md @@ -11,6 +11,7 @@ r[dynamic-sized.pointer-types] * [Pointer types] to DSTs are sized but have twice the size of pointers to sized types, since they also store *metadata*: * Pointers to slices store the number of elements; pointers to `str` store the length in bytes. * Pointers to trait objects store a pointer to a vtable. + * Pointers to a struct or tuple with an [unsized tail] store the same metadata as a pointer to that tail. r[dynamic-sized.question-sized] * DSTs can be provided as type arguments to generic type parameters having the special `?Sized` bound. They can also be used for associated type definitions when the corresponding associated type declaration has a `?Sized` bound. By default, any type parameter or associated type has a `Sized` bound, unless it is relaxed using `?Sized`. @@ -30,6 +31,7 @@ The *unsized tail* of a type is the dynamically sized component that the [metada [metadata]: dynamic-sized.pointer-types [sized]: special-types-and-traits.md#sized +[unsized tail]: dynamic-sized.tail [Slices]: types/slice.md [slice]: types/slice.md [str]: types/str.md