Skip to content

Commit 293af99

Browse files
authored
Merge pull request #1582 from chorman0773/spec-add-identifiers-dynamically-sized-types
Add spec identifiers to dynamically-sized-types.md
2 parents 0cb991f + fd471e8 commit 293af99

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/dynamically-sized-types.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,35 @@
11
# Dynamically Sized Types
22

3+
r[dynamic-sized]
4+
5+
r[dynamic-sized.intro]
36
Most types have a fixed size that is known at compile time and implement the
47
trait [`Sized`][sized]. A type with a size that is known only at run-time is
58
called a _dynamically sized type_ (_DST_) or, informally, an unsized type.
69
[Slices] and [trait objects] are two examples of <abbr title="dynamically sized
7-
types">DSTs</abbr>. Such types can only be used in certain cases:
10+
types">DSTs</abbr>.
11+
12+
r[dynamic-sized.restriction]
13+
Such types can only be used in certain cases:
814

15+
r[dynamic-sized.pointer-types]
916
* [Pointer types] to <abbr title="dynamically sized types">DSTs</abbr> are
1017
sized but have twice the size of pointers to sized types
1118
* Pointers to slices also store the number of elements of the slice.
1219
* Pointers to trait objects also store a pointer to a vtable.
20+
21+
r[dynamic-sized.question-sized]
1322
* <abbr title="dynamically sized types">DSTs</abbr> can be provided as
1423
type arguments to generic type parameters having the special `?Sized` bound.
1524
They can also be used for associated type definitions when the corresponding associated type declaration has a `?Sized` bound.
1625
By default, any type parameter or associated type has a `Sized` bound, unless it is relaxed using `?Sized`.
26+
27+
r[dynamic-sized.trait-impl]
1728
* Traits may be implemented for <abbr title="dynamically sized
1829
types">DSTs</abbr>.
1930
Unlike with generic type parameters, `Self: ?Sized` is the default in trait definitions.
31+
32+
r[dynamic-sized.struct-field]
2033
* Structs may contain a <abbr title="dynamically sized type">DST</abbr> as the
2134
last field; this makes the struct itself a
2235
<abbr title="dynamically sized type">DST</abbr>.

0 commit comments

Comments
 (0)