diff options
| author | bors <bors@rust-lang.org> | 2021-12-12 22:15:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-12-12 22:15:32 +0000 |
| commit | 22f8bde876f2fa9c5c4e95be1bce29cc271f2b51 (patch) | |
| tree | 780b4d0cada258ab3536c7bacbaf99dbf7980359 /library/core/src | |
| parent | 6bda5b331cfe7e04e1fe348c58a928fc2b650f4f (diff) | |
| parent | ffc9082d97cf88ac4d8f72bca0382b2499a0184d (diff) | |
| download | rust-22f8bde876f2fa9c5c4e95be1bce29cc271f2b51.tar.gz rust-22f8bde876f2fa9c5c4e95be1bce29cc271f2b51.zip | |
Auto merge of #91549 - fee1-dead:const_env, r=spastorino
Eliminate ConstnessAnd again Closes #91489. Closes #89432. Reverts #91491. Reverts #89450. r? `@spastorino`
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 { |
