diff options
| author | Andre Bogus <bogusandre@gmail.com> | 2022-12-18 15:40:46 +0100 |
|---|---|---|
| committer | Andre Bogus <bogusandre@gmail.com> | 2023-03-01 00:05:31 +0100 |
| commit | 41da875faef58e618cafc7dfdc5f3985a58f1e98 (patch) | |
| tree | 1200a1f2eb32151c90896d1d440aaaadda550b6c /compiler/rustc_parse/src | |
| parent | bd4a96a12d0bf6dc12edf20a45df3a33052c9d7d (diff) | |
| download | rust-41da875faef58e618cafc7dfdc5f3985a58f1e98.tar.gz rust-41da875faef58e618cafc7dfdc5f3985a58f1e98.zip | |
Add `Option::as_slice`(`_mut`)
This adds the following functions: * `Option<T>::as_slice(&self) -> &[T]` * `Option<T>::as_slice_mut(&mut self) -> &[T]` The `as_slice` and `as_slice_mut` functions benefit from an optimization that makes them completely branch-free. Note that the optimization's soundness hinges on the fact that either the niche optimization makes the offset of the `Some(_)` contents zero or the mempory layout of `Option<T>` is equal to that of `Option<MaybeUninit<T>>`.
Diffstat (limited to 'compiler/rustc_parse/src')
0 files changed, 0 insertions, 0 deletions
