Commit Graph

8 Commits

Author SHA1 Message Date
Scott McMurray eb3cc5f824 Use Option's discriminant as its size hint 2024-07-15 00:34:03 -07:00
Markus Reiter 33e68aadc9
Stabilize generic `NonZero`. 2024-04-22 18:48:47 +02:00
Josh Stone d9132de4ab Remove an obsolete `ignore-llvm-version` 2024-03-17 10:52:00 -07:00
Markus Reiter b2fbb8a053
Use generic `NonZero` in tests. 2024-02-25 12:03:48 +01:00
许杰友 Jieyou Xu (Joe) 6e48b96692
[AUTO_GENERATED] Migrate compiletest to use `ui_test`-style `//@` directives 2024-02-22 16:04:04 +00:00
Josh Stone 33036159a4 ci: add a runner for vanilla LLVM 16
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-04-16 11:50:20 -07:00
Scott McMurray f6a57c1955 Move `Option::as_slice` to an always-sound implementation
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-11 20:29:26 -08:00
Andre Bogus 41da875fae 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>>`.
2023-03-01 00:05:31 +01:00