diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2021-12-05 18:46:29 +0800 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2021-12-12 12:34:59 +0800 |
| commit | e22fe4008ca9db3d2b183d8df95a800d830d1edb (patch) | |
| tree | fb6704f490a55bd0d53aee5fa98c7da94ae9dccc /library/core/src | |
| parent | 84b1d859c8caa6049bfe728b219f679286151bb2 (diff) | |
| download | rust-e22fe4008ca9db3d2b183d8df95a800d830d1edb.tar.gz rust-e22fe4008ca9db3d2b183d8df95a800d830d1edb.zip | |
Revert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk"
This reverts commit a8387aef8c378a771686878062e544af4d5e2245, reversing changes made to 6e1211081239be62a5d0bb3bbcb29a9f14621c81.
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/convert/mod.rs | 5 | ||||
| -rw-r--r-- | library/core/src/lib.rs | 1 | ||||
| -rw-r--r-- | library/core/src/option.rs | 4 | ||||
| -rw-r--r-- | library/core/src/result.rs | 8 |
4 files changed, 13 insertions, 5 deletions
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<T, U> Into<U> for T +#[rustc_const_unstable(feature = "const_convert", issue = "88674")] +impl<T, U> const Into<U> for T where - U: From<T>, + U: ~const From<T>, { 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<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> { } #[unstable(feature = "try_trait_v2", issue = "84277")] -impl<T> ops::Try for Option<T> { +#[rustc_const_unstable(feature = "const_convert", issue = "88674")] +impl<T> const ops::Try for Option<T> { type Output = T; type Residual = Option<convert::Infallible>; @@ -2096,6 +2097,7 @@ impl<T> ops::Try for Option<T> { } #[unstable(feature = "try_trait_v2", issue = "84277")] +#[rustc_const_unstable(feature = "const_convert", issue = "88674")] impl<T> const ops::FromResidual for Option<T> { #[inline] fn from_residual(residual: Option<convert::Infallible>) -> 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<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> { } #[unstable(feature = "try_trait_v2", issue = "84277")] -impl<T, E> ops::Try for Result<T, E> { +#[rustc_const_unstable(feature = "const_convert", issue = "88674")] +impl<T, E> const ops::Try for Result<T, E> { type Output = T; type Residual = Result<convert::Infallible, E>; @@ -1964,7 +1965,10 @@ impl<T, E> ops::Try for Result<T, E> { } #[unstable(feature = "try_trait_v2", issue = "84277")] -impl<T, E, F: From<E>> ops::FromResidual<Result<convert::Infallible, E>> for Result<T, F> { +#[rustc_const_unstable(feature = "const_convert", issue = "88674")] +impl<T, E, F: ~const From<E>> const ops::FromResidual<Result<convert::Infallible, E>> + for Result<T, F> +{ #[inline] fn from_residual(residual: Result<convert::Infallible, E>) -> Self { match residual { |
