-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stabilize ops::ControlFlow
(just the type)
#85608
Stabilize ops::ControlFlow
(just the type)
#85608
Conversation
This comment has been minimized.
This comment has been minimized.
0b58335
to
65a0a8b
Compare
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.
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.
@rfcbot merge |
Team member @m-ou-se has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
To be clear, this will permit using this enum for actual control flow purposes? Or is this only stabilizing the enum itself and not its associated behavior? I think it's the former given the diff, but I'm not positive. |
I'm not sure what "for actual control flow purposes" means. This would stabilize use of |
That's exactly what I meant. Just wanted to be positive this wasn't just stabilizing an enum for no other purpose (which would be unlike you!) |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
@bors r+ |
📌 Commit 590d452 has been approved by |
Rollup of 10 pull requests Successful merges: - rust-lang#80269 (Explain non-dropped sender recv in docs) - rust-lang#82179 (Add functions `Duration::try_from_secs_{f32, f64}`) - rust-lang#85608 (Stabilize `ops::ControlFlow` (just the type)) - rust-lang#85792 (Refactor windows sockets impl methods) - rust-lang#86220 (Improve maybe_uninit_extra docs) - rust-lang#86277 (Remove must_use from ALLOWED_ATTRIBUTES) - rust-lang#86285 (:arrow_up: rust-analyzer) - rust-lang#86294 (Stabilize {std, core}::prelude::rust_*.) - rust-lang#86306 (Add mailmap entries for myself) - rust-lang#86314 (Remove trailing triple backticks in `mut_keyword` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Tracking issue: #75744 (which also tracks items not closed by this PR).
With the new
?
desugar implemented, it's no longer possible to mixResult
andControlFlow
. (At the time of making this PR, godbolt was still on the 2021-05-01 nightly, where you can see that the mixing example compiled.) That resolves the only blocker I know of, so I'd like to propose thatControlFlow
be considered for stabilization.Its basic existence was part of rust-lang/rfcs#3058, where it got a bunch of positive comments (examples 1 2 3 4). Its use in the compiler has been well received (#78182 (comment)), and there are ecosystem updates interested in using it (rust-itertools/itertools#469 (comment), jonhoo/rust-imap#194).
As this will need an FCP, picking a libs member manually:
r? @m-ou-se
Stabilized APIs
As well as using
?
on aControlFlow<B, _>
in a function returningControlFlow<B, _>
. (Note, in particular, that there's noFrom::from
-conversion on theBreak
value, the way there is forErr
s.)Existing APIs not stabilized here
All the associated methods and constants:
break_value
,is_continue
,map_break
,CONTINUE
, etc.Some of the existing methods in nightly seem reasonable, some seem like they should be removed, and some need more discussion to decide. But none of them are essential, so as in the RFC, they're all omitted from this PR.
They can be considered separately later, as further usage demonstrates which are important.