File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 70
70
//! }
71
71
//! ```
72
72
//!
73
- //! This usage of [`Option`] to create safe nullable pointers is so
74
- //! common that Rust does special optimizations to make the
75
- //! representation of [`Option`]`<`[`Box<T>`]`>` a single pointer. Optional pointers
76
- //! in Rust are stored as efficiently as any other pointer type.
73
+ //! # Representation
74
+ //!
75
+ //! Rust guarantees to optimise the following inner types such that an [`Option`] which contains
76
+ //! them has the same size as a pointer:
77
+ //!
78
+ //! * `&T`
79
+ //! * `&mut T`
80
+ //! * `extern "C" fn`
81
+ //! * [`num::NonZero*`]
82
+ //! * [`ptr::NonNull<T>`]
83
+ //! * `#[repr(transparent)]` struct around one of the types in this list.
84
+ //! * [`Box<T>`]
77
85
//!
78
86
//! # Examples
79
87
//!
You can’t perform that action at this time.
0 commit comments