Skip to content
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 the map/value methods on ControlFlow #130518

Merged
merged 3 commits into from
Oct 5, 2024

Conversation

scottmcm
Copy link
Member

@scottmcm scottmcm commented Sep 18, 2024

And fix the stability attribute on the pub use in core::ops.

libs-api in #75744 (comment) seemed reasonably happy with naming for these, so let's try for an FCP.

Summary:

impl<B, C> ControlFlow<B, C> {
    pub fn break_value(self) -> Option<B>;
    pub fn map_break<T>(self, f: impl FnOnce(B) -> T) -> ControlFlow<T, C>;
    pub fn continue_value(self) -> Option<C>;
    pub fn map_continue<T>(self, f: impl FnOnce(C) -> T) -> ControlFlow<B, T>;
}

Resolves #75744

@rustbot label +needs-fcp +t-libs-api -t-libs


Aside, in case it keeps someone else from going down the same dead end: I looked at the {break,continue}_value methods and tried to make them const as part of this, but that's disallowed because of not having const Drop, so put it back to not even unstably-const.

@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2024

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Sep 18, 2024
@scottmcm scottmcm added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). I-libs-api-nominated Nominated for discussion during a libs-api team meeting. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 18, 2024
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member

r? libs-api

@rustbot rustbot assigned BurntSushi and unassigned ibraheemdev Sep 18, 2024
@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
#[stable(feature = "control_flow_enum_type", since = "1.55.0")]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to draw attention to this update specifically. The type has been stable for a while https://blog.rust-lang.org/2021/09/09/Rust-1.55.0.html#stabilized-apis, so I guess this attribute just wasn't doing anything. I set the since to the same old release as the type.

@dtolnay dtolnay assigned dtolnay and unassigned BurntSushi Sep 21, 2024
@dtolnay
Copy link
Member

dtolnay commented Sep 21, 2024

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Sep 21, 2024

Team member @dtolnay 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.

@rfcbot rfcbot added the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Sep 21, 2024
@dtolnay dtolnay removed the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Sep 21, 2024
@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Sep 24, 2024
@rfcbot
Copy link

rfcbot commented Sep 24, 2024

🔔 This is now entering its final comment period, as per the review above. 🔔

@Amanieu Amanieu added S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Sep 24, 2024
@bors
Copy link
Contributor

bors commented Sep 25, 2024

☔ The latest upstream changes (presumably #130803) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 25, 2024
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Oct 4, 2024
@rfcbot
Copy link

rfcbot commented Oct 4, 2024

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.

This will be merged soon.

@scottmcm
Copy link
Member Author

scottmcm commented Oct 4, 2024

@bors r=dtolnay

@bors
Copy link
Contributor

bors commented Oct 4, 2024

📌 Commit ddfd0c7 has been approved by dtolnay

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 4, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Oct 4, 2024
…ra, r=dtolnay

Stabilize the `map`/`value` methods on `ControlFlow`

And fix the stability attribute on the `pub use` in `core::ops`.

libs-api in rust-lang#75744 (comment) seemed reasonably happy with naming for these, so let's try for an FCP.

Summary:
```rust
impl<B, C> ControlFlow<B, C> {
    pub fn break_value(self) -> Option<B>;
    pub fn map_break<T>(self, f: impl FnOnce(B) -> T) -> ControlFlow<T, C>;
    pub fn continue_value(self) -> Option<C>;
    pub fn map_continue<T>(self, f: impl FnOnce(C) -> T) -> ControlFlow<B, T>;
}
```

Resolves rust-lang#75744

`@rustbot` label +needs-fcp +t-libs-api -t-libs

---

Aside, in case it keeps someone else from going down the same dead end: I looked at the `{break,continue}_value` methods and tried to make them `const` as part of this, but that's disallowed because of not having `const Drop`, so put it back to not even unstably-const.
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 4, 2024
…kingjubilee

Rollup of 10 pull requests

Successful merges:

 - rust-lang#130453 (Add x86_64-unknown-trusty as tier 3 target)
 - rust-lang#130518 (Stabilize the `map`/`value` methods on `ControlFlow`)
 - rust-lang#131116 (Increase Stack Size for AIX)
 - rust-lang#131171 (Fix `target_env` in `avr-unknown-gnu-atmega328`)
 - rust-lang#131174 (Fix `target_abi` in `sparc-unknown-none-elf`)
 - rust-lang#131177 ( Stabilize 5 `const_mut_refs`-dependent API)
 - rust-lang#131238 (Remove mw from triagebot.toml)
 - rust-lang#131240 (Fix typo in csky-unknown-linux-gnuabiv2.md)
 - rust-lang#131257 ([rustdoc] Fix list margins)
 - rust-lang#131264 (Fix some `pub(crate)` that were undetected bc of `#[instrument]`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5a8fcab into rust-lang:master Oct 5, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Oct 5, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 5, 2024
Rollup merge of rust-lang#130518 - scottmcm:stabilize-controlflow-extra, r=dtolnay

Stabilize the `map`/`value` methods on `ControlFlow`

And fix the stability attribute on the `pub use` in `core::ops`.

libs-api in rust-lang#75744 (comment) seemed reasonably happy with naming for these, so let's try for an FCP.

Summary:
```rust
impl<B, C> ControlFlow<B, C> {
    pub fn break_value(self) -> Option<B>;
    pub fn map_break<T>(self, f: impl FnOnce(B) -> T) -> ControlFlow<T, C>;
    pub fn continue_value(self) -> Option<C>;
    pub fn map_continue<T>(self, f: impl FnOnce(C) -> T) -> ControlFlow<B, T>;
}
```

Resolves rust-lang#75744

``@rustbot`` label +needs-fcp +t-libs-api -t-libs

---

Aside, in case it keeps someone else from going down the same dead end: I looked at the `{break,continue}_value` methods and tried to make them `const` as part of this, but that's disallowed because of not having `const Drop`, so put it back to not even unstably-const.
@scottmcm scottmcm deleted the stabilize-controlflow-extra branch October 5, 2024 01:10
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 18, 2024
…ra, r=dtolnay

Stabilize the `map`/`value` methods on `ControlFlow`

And fix the stability attribute on the `pub use` in `core::ops`.

libs-api in rust-lang#75744 (comment) seemed reasonably happy with naming for these, so let's try for an FCP.

Summary:
```rust
impl<B, C> ControlFlow<B, C> {
    pub fn break_value(self) -> Option<B>;
    pub fn map_break<T>(self, f: impl FnOnce(B) -> T) -> ControlFlow<T, C>;
    pub fn continue_value(self) -> Option<C>;
    pub fn map_continue<T>(self, f: impl FnOnce(C) -> T) -> ControlFlow<B, T>;
}
```

Resolves rust-lang#75744

``@rustbot`` label +needs-fcp +t-libs-api -t-libs

---

Aside, in case it keeps someone else from going down the same dead end: I looked at the `{break,continue}_value` methods and tried to make them `const` as part of this, but that's disallowed because of not having `const Drop`, so put it back to not even unstably-const.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking issue for ControlFlow enum, for use with try_fold and in Try
10 participants