@@ -51,39 +51,17 @@ use crate::{convert, ops};
5151pub enum ControlFlow < B , C = ( ) > {
5252 /// Move on to the next phase of the operation as normal.
5353 #[ stable( feature = "control_flow_enum_type" , since = "1.55.0" ) ]
54- #[ cfg_attr ( not ( bootstrap ) , lang = "Continue" ) ]
54+ #[ lang = "Continue" ]
5555 Continue ( C ) ,
5656 /// Exit the operation without running subsequent phases.
5757 #[ stable( feature = "control_flow_enum_type" , since = "1.55.0" ) ]
58- #[ cfg_attr ( not ( bootstrap ) , lang = "Break" ) ]
58+ #[ lang = "Break" ]
5959 Break ( B ) ,
6060 // Yes, the order of the variants doesn't match the type parameters.
6161 // They're in this order so that `ControlFlow<A, B>` <-> `Result<B, A>`
6262 // is a no-op conversion in the `Try` implementation.
6363}
6464
65- #[ unstable( feature = "control_flow_enum" , reason = "new API" , issue = "75744" ) ]
66- #[ cfg( bootstrap) ]
67- impl < B , C > ops:: TryV1 for ControlFlow < B , C > {
68- type Output = C ;
69- type Error = B ;
70- #[ inline]
71- fn into_result ( self ) -> Result < Self :: Output , Self :: Error > {
72- match self {
73- ControlFlow :: Continue ( y) => Ok ( y) ,
74- ControlFlow :: Break ( x) => Err ( x) ,
75- }
76- }
77- #[ inline]
78- fn from_error ( v : Self :: Error ) -> Self {
79- ControlFlow :: Break ( v)
80- }
81- #[ inline]
82- fn from_ok ( v : Self :: Output ) -> Self {
83- ControlFlow :: Continue ( v)
84- }
85- }
86-
8765#[ unstable( feature = "try_trait_v2" , issue = "84277" ) ]
8866impl < B , C > ops:: TryV2 for ControlFlow < B , C > {
8967 type Output = C ;
@@ -184,31 +162,9 @@ impl<B, C> ControlFlow<B, C> {
184162 }
185163}
186164
187- #[ cfg( bootstrap) ]
188- impl < R : ops:: TryV1 > ControlFlow < R , R :: Output > {
189- /// Create a `ControlFlow` from any type implementing `Try`.
190- #[ inline]
191- pub ( crate ) fn from_try ( r : R ) -> Self {
192- match R :: into_result ( r) {
193- Ok ( v) => ControlFlow :: Continue ( v) ,
194- Err ( v) => ControlFlow :: Break ( R :: from_error ( v) ) ,
195- }
196- }
197-
198- /// Convert a `ControlFlow` into any type implementing `Try`;
199- #[ inline]
200- pub ( crate ) fn into_try ( self ) -> R {
201- match self {
202- ControlFlow :: Continue ( v) => R :: from_ok ( v) ,
203- ControlFlow :: Break ( v) => v,
204- }
205- }
206- }
207-
208165/// These are used only as part of implementing the iterator adapters.
209166/// They have mediocre names and non-obvious semantics, so aren't
210167/// currently on a path to potential stabilization.
211- #[ cfg( not( bootstrap) ) ]
212168impl < R : ops:: TryV2 > ControlFlow < R , R :: Output > {
213169 /// Create a `ControlFlow` from any type implementing `Try`.
214170 #[ inline]
0 commit comments