Skip to content

Commit

Permalink
Stabilized Option::unzip()
Browse files Browse the repository at this point in the history
  • Loading branch information
Kixiron committed Jun 17, 2022
1 parent 949a64a commit 59be3e8
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 @@ -1711,17 +1711,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 = "1.63.0")]
#[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 @@ -91,7 +91,6 @@
#![feature(strict_provenance)]
#![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 59be3e8

Please sign in to comment.