@@ -51,39 +51,17 @@ use crate::{convert, ops};
51
51
pub enum ControlFlow < B , C = ( ) > {
52
52
/// Move on to the next phase of the operation as normal.
53
53
#[ stable( feature = "control_flow_enum_type" , since = "1.55.0" ) ]
54
- #[ cfg_attr ( not ( bootstrap ) , lang = "Continue" ) ]
54
+ #[ lang = "Continue" ]
55
55
Continue ( C ) ,
56
56
/// Exit the operation without running subsequent phases.
57
57
#[ stable( feature = "control_flow_enum_type" , since = "1.55.0" ) ]
58
- #[ cfg_attr ( not ( bootstrap ) , lang = "Break" ) ]
58
+ #[ lang = "Break" ]
59
59
Break ( B ) ,
60
60
// Yes, the order of the variants doesn't match the type parameters.
61
61
// They're in this order so that `ControlFlow<A, B>` <-> `Result<B, A>`
62
62
// is a no-op conversion in the `Try` implementation.
63
63
}
64
64
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
-
87
65
#[ unstable( feature = "try_trait_v2" , issue = "84277" ) ]
88
66
impl < B , C > ops:: TryV2 for ControlFlow < B , C > {
89
67
type Output = C ;
@@ -184,31 +162,9 @@ impl<B, C> ControlFlow<B, C> {
184
162
}
185
163
}
186
164
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
-
208
165
/// These are used only as part of implementing the iterator adapters.
209
166
/// They have mediocre names and non-obvious semantics, so aren't
210
167
/// currently on a path to potential stabilization.
211
- #[ cfg( not( bootstrap) ) ]
212
168
impl < R : ops:: TryV2 > ControlFlow < R , R :: Output > {
213
169
/// Create a `ControlFlow` from any type implementing `Try`.
214
170
#[ inline]
0 commit comments