Skip to content

Commit

Permalink
Rollup merge of #98204 - Kixiron:stable-unzip, r=thomcc
Browse files Browse the repository at this point in the history
Stabilize `Option::unzip()`

Stabilizes `Option::unzip()`, closes #87800

```@rustbot``` modify labels: +T-libs-api
  • Loading branch information
Dylan-DPC authored Oct 25, 2022
2 parents 31d754a + df8a62d commit d2d44f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 7 additions & 4 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1713,17 +1713,20 @@ impl<T, U> Option<(T, U)> {
/// # Examples
///
/// ```
/// #![feature(unzip_option)]
///
/// let x = Some((1, "hi"));
/// let y = None::<(u8, u32)>;
///
/// assert_eq!(x.unzip(), (Some(1), Some("hi")));
/// assert_eq!(y.unzip(), (None, None));
/// ```
#[inline]
#[unstable(feature = "unzip_option", issue = "87800", reason = "recently added")]
pub const fn unzip(self) -> (Option<T>, Option<U>) {
#[stable(feature = "unzip_option", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
pub const fn unzip(self) -> (Option<T>, Option<U>)
where
T: ~const Destruct,
U: ~const Destruct,
{
match self {
Some((a, b)) => (Some(a), Some(b)),
None => (None, None),
Expand Down
1 change: 0 additions & 1 deletion library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
#![feature(strict_provenance_atomic_ptr)]
#![feature(trusted_random_access)]
#![feature(unsize)]
#![feature(unzip_option)]
#![feature(const_array_from_ref)]
#![feature(const_slice_from_ref)]
#![feature(waker_getters)]
Expand Down

0 comments on commit d2d44f6

Please sign in to comment.