about summary refs log tree commit diff
path: root/tests/codegen/option-as-slice.rs
AgeCommit message (Collapse)AuthorLines
2025-07-22Rename `tests/codegen` into `tests/codegen-llvm`Guillaume Gomez-71/+0
2025-02-11tests/codegen: use -Copt-level=3 instead of -OJubilee Young-1/+1
2024-10-07Add precondition checks to ptr::offset, ptr::add, ptr::subBen Kimock-2/+6
2024-07-15Use Option's discriminant as its size hintScott McMurray-1/+34
2024-04-22Stabilize generic `NonZero`.Markus Reiter-1/+0
2024-03-17Remove an obsolete `ignore-llvm-version`Josh Stone-2/+0
2024-02-25Use generic `NonZero` in tests.Markus Reiter-5/+4
2024-02-22[AUTO_GENERATED] Migrate compiletest to use `ui_test`-style `//@` directives许杰友 Jieyou Xu (Joe)-3/+3
2023-04-16ci: add a runner for vanilla LLVM 16Josh Stone-0/+2
Like #107044, this will let us track compatibility with LLVM 16 going forward, especially after we eventually upgrade our own to the next. This also drops `tidy` here and in `x86_64-gnu-llvm-15`, syncing with that change in #106085.
2023-03-11Move `Option::as_slice` to an always-sound implementationScott McMurray-5/+13
This approach depends on CSE to not have any branches or selects when the guessed offset is correct -- which it always will be right now -- but to also be *sound* (just less efficient) if the layout algorithms change such that the guess is incorrect.
2023-03-01Add `Option::as_slice`(`_mut`)Andre Bogus-0/+28
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>>`.