1# Dynamically Sized Types
2
3Most types have a fixed size that is known at compile time and implement the
4trait [`Sized`][sized]. A type with a size that is known only at run-time is
5called a _dynamically sized type_ (_DST_) or, informally, an unsized type.
6[Slices] and [trait objects] are two examples of <abbr title="dynamically sized
7types">DSTs</abbr>. Such types can only be used in certain cases:
8
9* [Pointer types] to <abbr title="dynamically sized types">DSTs</abbr> are
10  sized but have twice the size of pointers to sized types
11    * Pointers to slices also store the number of elements of the slice.
12    * Pointers to trait objects also store a pointer to a vtable.
13* <abbr title="dynamically sized types">DSTs</abbr> can be provided as
14  type arguments to generic type parameters having the special `?Sized` bound.
15  They can also be used for associated type definitions when the corresponding associated type declaration has a `?Sized` bound.
16  By default, any type parameter or associated type has a `Sized` bound, unless it is relaxed using `?Sized`.
17* Traits may be implemented for <abbr title="dynamically sized
18  types">DSTs</abbr>.
19  Unlike with generic type parameters, `Self: ?Sized` is the default in trait definitions.
20* Structs may contain a <abbr title="dynamically sized type">DST</abbr> as the
21  last field; this makes the struct itself a
22  <abbr title="dynamically sized type">DST</abbr>.
23
24> **Note**: [variables], function parameters, [const] items, and [static] items must be
25`Sized`.
26
27[sized]: special-types-and-traits.md#sized
28[Slices]: types/slice.md
29[trait objects]: types/trait-object.md
30[Pointer types]: types/pointer.md
31[variables]: variables.md
32[const]: items/constant-items.md
33[static]: items/static-items.md
34