@@ -170,7 +170,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
170170///
171171/// The following table gives the size for primitives.
172172///
173- /// Type | size_of::\ <Type>()
173+ /// Type | ` size_of::<Type>()`
174174/// ---- | ---------------
175175/// () | 0
176176/// bool | 1
@@ -190,8 +190,8 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
190190///
191191/// Furthermore, `usize` and `isize` have the same size.
192192///
193- /// The types `*const T`, `&T`, `Box<T>`, `Option<&T>`, and `Option<Box<T>>` all have
194- /// the same size. If `T` is Sized, all of those types have the same size as `usize`.
193+ /// The types [ `*const T`] , `&T`, [ `Box<T>`], [ `Option<&T>`] , and `Option<Box<T>>` all have
194+ /// the same size. If `T` is ` Sized` , all of those types have the same size as `usize`.
195195///
196196/// The mutability of a pointer does not change its size. As such, `&T` and `&mut T`
197197/// have the same size. Likewise for `*const T` and `*mut T`.
@@ -203,7 +203,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
203203///
204204/// ## Size of Structs
205205///
206- /// For `structs` , the size is determined by the following algorithm.
206+ /// For `struct`s , the size is determined by the following algorithm.
207207///
208208/// For each field in the struct ordered by declaration order:
209209///
@@ -299,6 +299,10 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
299299/// ```
300300///
301301/// [alignment]: align_of
302+ /// [`*const T`]: primitive@pointer
303+ /// [`Box<T>`]: ../../std/boxed/struct.Box.html
304+ /// [`Option<&T>`]: crate::option::Option
305+ ///
302306#[ inline( always) ]
303307#[ must_use]
304308#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -311,7 +315,7 @@ pub const fn size_of<T>() -> usize {
311315
312316/// Returns the size of the pointed-to value in bytes.
313317///
314- /// This is usually the same as `size_of::<T>()`. However, when `T` *has* no
318+ /// This is usually the same as [ `size_of::<T>()`] . However, when `T` *has* no
315319/// statically-known size, e.g., a slice [`[T]`][slice] or a [trait object],
316320/// then `size_of_val` can be used to get the dynamically-known size.
317321///
@@ -328,6 +332,8 @@ pub const fn size_of<T>() -> usize {
328332/// let y: &[u8] = &x;
329333/// assert_eq!(13, mem::size_of_val(y));
330334/// ```
335+ ///
336+ /// [`size_of::<T>()`]: size_of
331337#[ inline]
332338#[ must_use]
333339#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -340,7 +346,7 @@ pub const fn size_of_val<T: ?Sized>(val: &T) -> usize {
340346
341347/// Returns the size of the pointed-to value in bytes.
342348///
343- /// This is usually the same as `size_of::<T>()`. However, when `T` *has* no
349+ /// This is usually the same as [ `size_of::<T>()`] . However, when `T` *has* no
344350/// statically-known size, e.g., a slice [`[T]`][slice] or a [trait object],
345351/// then `size_of_val_raw` can be used to get the dynamically-known size.
346352///
@@ -363,6 +369,7 @@ pub const fn size_of_val<T: ?Sized>(val: &T) -> usize {
363369/// [`size_of_val`] on a reference to a type with an extern type tail.
364370/// - otherwise, it is conservatively not allowed to call this function.
365371///
372+ /// [`size_of::<T>()`]: size_of
366373/// [trait object]: ../../book/ch17-02-trait-objects.html
367374/// [extern type]: ../../unstable-book/language-features/extern-types.html
368375///
0 commit comments