File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ r[dynamic-sized.intro]
55Most types have a fixed size that is known at compile time and implement the
66trait [ ` Sized ` ] [ sized ] . A type with a size that is known only at run-time is
77called a _ dynamically sized type_ (_ DST_ ) or, informally, an unsized type.
8- [ Slices] and [ trait objects] are two examples of <abbr title="dynamically sized
8+ [ Slices] , [ trait objects] , and [ str ] are three examples of <abbr title="dynamically sized
99types">DSTs</abbr >.
1010
1111r[ dynamic-sized.restriction]
@@ -14,7 +14,7 @@ Such types can only be used in certain cases:
1414r[ dynamic-sized.pointer-types]
1515* [ Pointer types] to <abbr title =" dynamically sized types " >DSTs</abbr > are
1616 sized but have twice the size of pointers to sized types
17- * Pointers to slices also store the number of elements of the slice.
17+ * Pointers to slices and ` str ` also store the number of elements of the slice.
1818 * Pointers to trait objects also store a pointer to a vtable.
1919
2020r[ dynamic-sized.question-sized]
@@ -38,6 +38,7 @@ r[dynamic-sized.struct-field]
3838
3939[ sized ] : special-types-and-traits.md#sized
4040[ Slices ] : types/slice.md
41+ [ str ] : types/textual.md
4142[ trait objects ] : types/trait-object.md
4243[ Pointer types ] : types/pointer.md
4344[ Variables ] : variables.md
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ r[layout.str]
110110## ` str ` Layout
111111
112112String slices are a UTF-8 representation of characters that have the same layout as slices of type ` [u8] ` .
113+ A reference ` &str ` has the same layout as a reference ` &[u8] ` .
113114
114115r[ layout.tuple]
115116## Tuple Layout
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ is valid UTF-8. Calling a `str` method with a non-UTF-8 buffer can cause
2323
2424r[ type.text.str-unsized]
2525Since ` str ` is a [ dynamically sized type] , it can only be instantiated through a
26- pointer type, such as ` &str ` .
26+ pointer type, such as ` &str ` . The layout of ` &str ` is the same as the layout of
27+ ` &[u8] ` .
2728
2829r[ type.text.layout]
2930## Layout and bit validity
You can’t perform that action at this time.
0 commit comments