Skip to content

Fix references to ControlFlow in docs #88273

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 25, 2021

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Aug 23, 2021

The Iterator::for_each method previously stated that it was not possible to use break and continue in it — this has been updated to acknowledge the stabilization of ControlFlow. Additionally, ControlFlow was referred to as crate::ops::ControlFlow which is not the correct path for an end user.

r? @jyn514

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 23, 2021
@the8472
Copy link
Member

the8472 commented Aug 23, 2021

I don't see how that relates to for_each, barring panics it unconditionally runs to completion, ControlFlow doesn't change that.

@jhpratt
Copy link
Member Author

jhpratt commented Aug 23, 2021

Returning ControlFlow::Break(()) wouldn't terminate early? That seems unexpected.

(No I didn't try it. I made an assumption)

@the8472
Copy link
Member

the8472 commented Aug 23, 2021

It requires a () return type for the closure. You need try_for_each or try_fold if you want to return early.

@jhpratt
Copy link
Member Author

jhpratt commented Aug 24, 2021

Ah, right. Sometimes I miss the obvious. I'll revert that bit of the commit, leaving the fix to the path elsewhere.

@jhpratt jhpratt force-pushed the update-iterator-docs branch from da61710 to bc33861 Compare August 24, 2021 00:03
@jhpratt jhpratt changed the title Update Iterator docs to acknowledge ControlFlow Fix references to ControlFlow in docs Aug 24, 2021
@jyn514
Copy link
Member

jyn514 commented Aug 24, 2021

@jhpratt is there a reason you picked me particularly to review? I'm not on the libs team.

@jyn514
Copy link
Member

jyn514 commented Aug 24, 2021

That said, this looks good to me :)

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 24, 2021

📌 Commit bc33861 has been approved by jyn514

@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-review Status: Awaiting review from the assignee but also interested parties. labels Aug 24, 2021
@jhpratt
Copy link
Member Author

jhpratt commented Aug 24, 2021

I thought that you've done stuff with docs in the past. Not that the reviewer really matters here admittedly.

@jyn514
Copy link
Member

jyn514 commented Aug 24, 2021

I mostly work on rustdoc; different sort of docs :P

@jhpratt
Copy link
Member Author

jhpratt commented Aug 24, 2021

I had the right idea 😂 Good to know for the future.

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 25, 2021
…eulArtichaut

Rollup of 16 pull requests

Successful merges:

 - rust-lang#87944 (add Cell::as_array_of_cells, similar to Cell::as_slice_of_cells)
 - rust-lang#88156 (Adjust / fix documentation of `Arc::make_mut`)
 - rust-lang#88157 (bootstrap.py: recognize riscv64 when auto-detect)
 - rust-lang#88196 (Refactor `named_asm_labels` to a HIR lint)
 - rust-lang#88218 (Remove `Session.trait_methods_not_found`)
 - rust-lang#88223 (Remove the `TryV2` alias)
 - rust-lang#88226 (Fix typo “a Rc” → “an Rc” (and a few more))
 - rust-lang#88267 (2229: Update signature for truncate function)
 - rust-lang#88273 (Fix references to `ControlFlow` in docs)
 - rust-lang#88277 (Update books)
 - rust-lang#88291 (Add SAFETY comments to core::slice::sort::partition_in_blocks)
 - rust-lang#88293 (Fix grammar in alloc test)
 - rust-lang#88298 (Errorkind reorder)
 - rust-lang#88299 (Stabilise BufWriter::into_parts)
 - rust-lang#88314 (Add type of a let tait test)
 - rust-lang#88325 (Add mutable-noalias to the release notes for 1.54)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3375283 into rust-lang:master Aug 25, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 25, 2021
@jhpratt jhpratt deleted the update-iterator-docs branch August 26, 2021 09:12
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants