Skip to content

Commit 587de8e

Browse files
authored
Rollup merge of rust-lang#85645 - scottmcm:demote-from-into-try, r=yaahc
Demote `ControlFlow::{from|into}_try` to `pub(crate)` They have mediocre names and non-obvious semantics, so personally I don't think they're worth trying to stabilize, and thus might as well just be internal (they're used for convenience in iterator adapters), not something shown in the rustdocs. I don't think anyone actually wanted to use them outside `core` -- they just got made public-but-unstable along with the whole type in rust-lang#76204 that promoted `LoopState` from an internal type to the exposed `ControlFlow` type. cc rust-lang#75744, the tracking issue they mention. cc rust-lang#85608, the PR where I'm proposing stabilizing the type.
2 parents 0bc3066 + b63f7f9 commit 587de8e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

library/core/src/ops/control_flow.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -187,42 +187,41 @@ impl<B, C> ControlFlow<B, C> {
187187
#[cfg(bootstrap)]
188188
impl<R: ops::TryV1> ControlFlow<R, R::Output> {
189189
/// Create a `ControlFlow` from any type implementing `Try`.
190-
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
191190
#[inline]
192-
pub fn from_try(r: R) -> Self {
191+
pub(crate) fn from_try(r: R) -> Self {
193192
match R::into_result(r) {
194193
Ok(v) => ControlFlow::Continue(v),
195194
Err(v) => ControlFlow::Break(R::from_error(v)),
196195
}
197196
}
198197

199198
/// Convert a `ControlFlow` into any type implementing `Try`;
200-
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
201199
#[inline]
202-
pub fn into_try(self) -> R {
200+
pub(crate) fn into_try(self) -> R {
203201
match self {
204202
ControlFlow::Continue(v) => R::from_ok(v),
205203
ControlFlow::Break(v) => v,
206204
}
207205
}
208206
}
209207

208+
/// These are used only as part of implementing the iterator adapters.
209+
/// They have mediocre names and non-obvious semantics, so aren't
210+
/// currently on a path to potential stabilization.
210211
#[cfg(not(bootstrap))]
211212
impl<R: ops::TryV2> ControlFlow<R, R::Output> {
212213
/// Create a `ControlFlow` from any type implementing `Try`.
213-
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
214214
#[inline]
215-
pub fn from_try(r: R) -> Self {
215+
pub(crate) fn from_try(r: R) -> Self {
216216
match R::branch(r) {
217217
ControlFlow::Continue(v) => ControlFlow::Continue(v),
218218
ControlFlow::Break(v) => ControlFlow::Break(R::from_residual(v)),
219219
}
220220
}
221221

222222
/// Convert a `ControlFlow` into any type implementing `Try`;
223-
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
224223
#[inline]
225-
pub fn into_try(self) -> R {
224+
pub(crate) fn into_try(self) -> R {
226225
match self {
227226
ControlFlow::Continue(v) => R::from_output(v),
228227
ControlFlow::Break(v) => v,

0 commit comments

Comments
 (0)