From 59be3e856f218f55be0f73bcfed6265772437ec7 Mon Sep 17 00:00:00 2001 From: Chase Wilson Date: Fri, 17 Jun 2022 11:39:59 -0500 Subject: [PATCH 1/2] Stabilized Option::unzip() --- library/core/src/option.rs | 11 +++++++---- library/core/tests/lib.rs | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 28ea45ed235..1d6784af2a5 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1711,8 +1711,6 @@ impl Option<(T, U)> { /// # Examples /// /// ``` - /// #![feature(unzip_option)] - /// /// let x = Some((1, "hi")); /// let y = None::<(u8, u32)>; /// @@ -1720,8 +1718,13 @@ impl Option<(T, U)> { /// assert_eq!(y.unzip(), (None, None)); /// ``` #[inline] - #[unstable(feature = "unzip_option", issue = "87800", reason = "recently added")] - pub const fn unzip(self) -> (Option, Option) { + #[stable(feature = "unzip_option", since = "1.63.0")] + #[rustc_const_unstable(feature = "const_option", issue = "67441")] + pub const fn unzip(self) -> (Option, Option) + where + T: ~const Destruct, + U: ~const Destruct, + { match self { Some((a, b)) => (Some(a), Some(b)), None => (None, None), diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 63c9602abe7..30b9cb4dadc 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -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)] From df8a62d4f380d656444a6fc4e704bcd3693f4b9a Mon Sep 17 00:00:00 2001 From: Chase Wilson Date: Wed, 7 Sep 2022 10:27:42 -0500 Subject: [PATCH 2/2] Use `CURRENT_RUSTC_VERSION` --- library/core/src/option.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 1d6784af2a5..df5a20869a3 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1718,7 +1718,7 @@ impl Option<(T, U)> { /// assert_eq!(y.unzip(), (None, None)); /// ``` #[inline] - #[stable(feature = "unzip_option", since = "1.63.0")] + #[stable(feature = "unzip_option", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_option", issue = "67441")] pub const fn unzip(self) -> (Option, Option) where