From 58a85d55e84637fd8abf35cf1686bb46ac3e1825 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Wed, 19 May 2021 12:59:02 -0700 Subject: [PATCH] #[cfg(bootstrap)] out the v1 try_trait stuff --- library/core/src/ops/control_flow.rs | 1 + library/core/src/ops/mod.rs | 2 ++ library/core/src/option.rs | 2 ++ library/core/src/result.rs | 1 + library/core/src/task/poll.rs | 2 ++ library/core/tests/lib.rs | 1 - 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs index dbb51540bd475..f99eb9777d8ac 100644 --- a/library/core/src/ops/control_flow.rs +++ b/library/core/src/ops/control_flow.rs @@ -63,6 +63,7 @@ pub enum ControlFlow { } #[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")] +#[cfg(bootstrap)] impl ops::TryV1 for ControlFlow { type Output = C; type Error = B; diff --git a/library/core/src/ops/mod.rs b/library/core/src/ops/mod.rs index beef74de61728..139a8c0eec9cb 100644 --- a/library/core/src/ops/mod.rs +++ b/library/core/src/ops/mod.rs @@ -147,6 +147,7 @@ mod function; mod generator; mod index; mod range; +#[cfg(bootstrap)] mod r#try; mod try_trait; mod unsize; @@ -187,6 +188,7 @@ pub use self::range::{Bound, RangeBounds, RangeInclusive, RangeToInclusive}; pub use self::r#try::Try; #[unstable(feature = "try_trait_transition", reason = "for bootstrap", issue = "none")] +#[cfg(bootstrap)] pub(crate) use self::r#try::Try as TryV1; #[unstable(feature = "try_trait_v2", issue = "84277")] diff --git a/library/core/src/option.rs b/library/core/src/option.rs index cfc1768dee972..cfb73ed0395e7 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1641,9 +1641,11 @@ impl> FromIterator> for Option { #[rustc_diagnostic_item = "none_error"] #[unstable(feature = "try_trait", issue = "42327")] #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] +#[cfg(bootstrap)] pub struct NoneError; #[unstable(feature = "try_trait", issue = "42327")] +#[cfg(bootstrap)] impl ops::TryV1 for Option { type Output = T; type Error = NoneError; diff --git a/library/core/src/result.rs b/library/core/src/result.rs index 21e406194bc9e..babd0a0b5528e 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1627,6 +1627,7 @@ impl> FromIterator> for Result { } #[unstable(feature = "try_trait", issue = "42327")] +#[cfg(bootstrap)] impl ops::TryV1 for Result { type Output = T; type Error = E; diff --git a/library/core/src/task/poll.rs b/library/core/src/task/poll.rs index 188639e7962e4..9cf89623d888e 100644 --- a/library/core/src/task/poll.rs +++ b/library/core/src/task/poll.rs @@ -129,6 +129,7 @@ impl From for Poll { } #[stable(feature = "futures_api", since = "1.36.0")] +#[cfg(bootstrap)] impl ops::TryV1 for Poll> { type Output = Poll; type Error = E; @@ -184,6 +185,7 @@ impl> ops::FromResidual> for Pol } #[stable(feature = "futures_api", since = "1.36.0")] +#[cfg(bootstrap)] impl ops::TryV1 for Poll>> { type Output = Poll>; type Error = E; diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index db12d79c00c30..16bce6e35fe83 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -44,7 +44,6 @@ #![feature(str_internals)] #![feature(test)] #![feature(trusted_len)] -#![feature(try_trait)] #![feature(try_trait_v2)] #![feature(slice_internals)] #![feature(slice_partition_dedup)]