From e22fe4008ca9db3d2b183d8df95a800d830d1edb Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Sun, 5 Dec 2021 18:46:29 +0800 Subject: Revert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk" This reverts commit a8387aef8c378a771686878062e544af4d5e2245, reversing changes made to 6e1211081239be62a5d0bb3bbcb29a9f14621c81. --- library/core/src/convert/mod.rs | 5 +++-- library/core/src/lib.rs | 1 + library/core/src/option.rs | 4 +++- library/core/src/result.rs | 8 ++++++-- 4 files changed, 13 insertions(+), 5 deletions(-) (limited to 'library/core/src') diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 5aa53deee34..1c2e673d604 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -534,9 +534,10 @@ where // From implies Into #[stable(feature = "rust1", since = "1.0.0")] -impl Into for T +#[rustc_const_unstable(feature = "const_convert", issue = "88674")] +impl const Into for T where - U: From, + U: ~const From, { fn into(self) -> U { U::from(self) diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index d9a40a9b2ec..04996368064 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -112,6 +112,7 @@ #![feature(const_float_classify)] #![feature(const_fmt_arguments_new)] #![feature(const_heap)] +#![feature(const_convert)] #![feature(const_inherent_unchecked_arith)] #![feature(const_int_unchecked_arith)] #![feature(const_intrinsic_copy)] diff --git a/library/core/src/option.rs b/library/core/src/option.rs index a6e7257448c..381e2d6eed3 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -2077,7 +2077,8 @@ impl> FromIterator> for Option { } #[unstable(feature = "try_trait_v2", issue = "84277")] -impl ops::Try for Option { +#[rustc_const_unstable(feature = "const_convert", issue = "88674")] +impl const ops::Try for Option { type Output = T; type Residual = Option; @@ -2096,6 +2097,7 @@ impl ops::Try for Option { } #[unstable(feature = "try_trait_v2", issue = "84277")] +#[rustc_const_unstable(feature = "const_convert", issue = "88674")] impl const ops::FromResidual for Option { #[inline] fn from_residual(residual: Option) -> Self { diff --git a/library/core/src/result.rs b/library/core/src/result.rs index ab067d57d08..8ef5ffb962b 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1945,7 +1945,8 @@ impl> FromIterator> for Result { } #[unstable(feature = "try_trait_v2", issue = "84277")] -impl ops::Try for Result { +#[rustc_const_unstable(feature = "const_convert", issue = "88674")] +impl const ops::Try for Result { type Output = T; type Residual = Result; @@ -1964,7 +1965,10 @@ impl ops::Try for Result { } #[unstable(feature = "try_trait_v2", issue = "84277")] -impl> ops::FromResidual> for Result { +#[rustc_const_unstable(feature = "const_convert", issue = "88674")] +impl> const ops::FromResidual> + for Result +{ #[inline] fn from_residual(residual: Result) -> Self { match residual { -- cgit 1.4.1-3-g733a5