Skip to content

Commit 52d554e

Browse files
committed
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.
1 parent e3cc399 commit 52d554e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/dynamically-sized-types.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ r[dynamic-sized.pointer-types]
1111
* [Pointer types] to <abbr title="dynamically sized types">DSTs</abbr> are sized but have twice the size of pointers to sized types, since they also store *metadata*:
1212
* Pointers to slices store the number of elements; pointers to `str` store the length in bytes.
1313
* Pointers to trait objects store a pointer to a vtable.
14+
* Pointers to a struct or tuple with an [unsized tail] store the same metadata as a pointer to that tail.
1415

1516
r[dynamic-sized.question-sized]
1617
* <abbr title="dynamically sized types">DSTs</abbr> 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
3031

3132
[metadata]: dynamic-sized.pointer-types
3233
[sized]: special-types-and-traits.md#sized
34+
[unsized tail]: dynamic-sized.tail
3335
[Slices]: types/slice.md
3436
[slice]: types/slice.md
3537
[str]: types/str.md

0 commit comments

Comments
 (0)