-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Document breaking out of a named code block #140197
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
Conversation
rustbot has assigned @workingjubilee. Use |
library/std/src/keyword_docs.rs
Outdated
@@ -109,6 +109,33 @@ mod as_keyword {} | |||
/// println!("{result}"); | |||
/// ``` | |||
/// | |||
/// It is also possible to exit from any *labelled* block returning the value early. | |||
/// If no value specified `break;` returns `()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odd stutter here. I think it should be "If no value is specified for" or "is given to", then "it returns ()
".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a verbatim restatement of a sentence from the previous paragraph:
This is only valid with
loop
and not with any other type of loop.
If no value is specified,break;
returns()
.
It is also possible to exit from any labelled block returning the value early.
If no value specifiedbreak;
returns()
.
Does a comma suffice or should the text above be rephrased too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comma is the minimum for it to be valid, as far as I can tell. I do not think it is sufficient for it to be very comprehensible. So if you wish to revise both cases to be consistent, that is fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems mostly fine, one detail.
Thanks! @bors r+ rollup |
Document breaking out of a named code block Closes rust-lang#110758.
Rollup of 12 pull requests Successful merges: - rust-lang#134034 (handle paren in macro expand for let-init-else expr) - rust-lang#137474 (pretty-print: Print shebang at the top of the output) - rust-lang#138872 (rustc_target: RISC-V `Zfinx` is incompatible with `{ILP32,LP64}[FD]` ABIs) - rust-lang#139046 (Improve `Lifetime::suggestion`) - rust-lang#139206 (std: use the address of `errno` to identify threads in `unique_thread_exit`) - rust-lang#139608 (Clarify `async` block behaviour) - rust-lang#139847 (Delegate to inner `vec::IntoIter` from `env::ArgsOs`) - rust-lang#140159 (Avoid redundant WTF-8 checks in `PathBuf`) - rust-lang#140197 (Document breaking out of a named code block) - rust-lang#140389 (Remove `avx512dq` and `avx512vl` implication for `avx512fp16`) - rust-lang#140430 (Improve test coverage of HIR pretty printing.) - rust-lang#140507 (rustc_target: RISC-V: feature addition batch 3) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#140197 - ktnlvr:master, r=workingjubilee Document breaking out of a named code block Closes rust-lang#110758.
Closes #110758.