-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Update mod.rs #141935
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
Update mod.rs #141935
Conversation
Small clarification on the usage of `read_to_string` and `read_to_end` trait methods.
This comment has been minimized.
This comment has been minimized.
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.
Thanks for the PR, I think this is a worthwhile change but the wording could use some adjustment.
Could you please also update the commit summary and PR description? They currently both say "Update mod.rs" but instead need to say what the actual change is.
library/std/src/io/mod.rs
Outdated
/// # Notes | ||
/// | ||
/// Be careful using this trait method with streams that are expected to be continuous. For example, using | ||
/// `read_to_string` with streams like `stdin` will simply lock the application into waiting on the | ||
/// transmission of data to conclude. It is recommended you use this method if you know the stream will be closed | ||
/// at the other end. The problem is that EOF or End of File is never reached for streams that never close or are finite. | ||
/// | ||
/// (See also the [`std::fs::read_to_string`] convenience function for | ||
/// reading from a file.) |
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.
Nit, could you move the new section under the existing "see also"? Since the "see also" is referring to reading a file in the example above.
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.
Only issue now is that committing to my feature branch generated internal merges and I did not realize that was prohibited. Tried resetting and rebasing my branch without success.
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.
What are you running into? Usually fixing it looks something like this:
# If you haven't yet, add rust-lang/rust as a remote and update it
git remote add upstream [email protected]:rust-lang/rust.git
git fetch upstream master
# Do the rebase (from this branch)
git rebase -i upstream/master
Then for every line except the first replace pick
with f
(or fixup
), and git push --force-with-lease
to update this PR.
…to_end` trait methods.
…ed usage note section to std::io::read_to_string as well.
…' into 141714_stdin_read_to_string_docs # Conflicts: # library/std/src/io/mod.rs
This comment has been minimized.
This comment has been minimized.
…' into 141714_stdin_read_to_string_docs
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
library/std/src/io/mod.rs
Outdated
/// `read_to_end` attempts to read a source until EOF, but many sources are continuous streams | ||
/// that do not send EOF. In these cases, `read_to_end` will block indefinitely. Standard input | ||
/// is one such stream which may be finite if piped, but is typically continuous. For example, | ||
/// `cat <file> | <my_rust_program>` will correctly terminate with an `EOF` upon closure of cat. | ||
/// `yes "Data" | pv | <my_rust_program` or `tail -f <file> | <my_rust_program>` may not close | ||
/// the stream or insert an `EOF` termination character. |
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 looks much better to me. I think the cat
example would be good to keep, but maybe translate the other example into words in case someone doesn't know what the -f
flag does
/// `read_to_end` attempts to read a source until EOF, but many sources are continuous streams
/// that do not send EOF. In these cases, `read_to_end` will block indefinitely. Standard input
/// is one such stream which may be finite if piped from a finite source (e.g. `cat foo.txt |
/// my-program`), but is typically continuous (reading user input or sources that stay open).
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.
I am making adjustments, but did not have time to complete tonight.
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.
Not a problem, there is no deadline :)
This adds an `iter!` macro that can be used to create movable generators. This also adds a yield_expr feature so the `yield` keyword can be used within iter! macro bodies. This was needed because several unstable features each need `yield` expressions, so this allows us to stabilize them separately from any individual feature. Co-authored-by: Oli Scherer <[email protected]> Co-authored-by: Jieyou Xu <[email protected]> Co-authored-by: Travis Cross <[email protected]>
The panic machinery uses TLS, so panicking if no TLS keys are left can lead to infinite recursion (see rust-lang#140798 (comment)). Rather than having separate logic for the panic count and the thread name, just always abort the process if a TLS key allocation fails. This also has the benefit of aligning the key-based TLS implementation with the documentation, which does not mention that a panic could also occur because of resource exhaustion.
- Add AbiMapping for encoding the nuance of deprecated ABIs
makes entry_abi a lowering of the ABI string, so now it can be ```json "entry_abi": "C", "entry_abi": "win64", "entry_abi": "aapcs", ```
The submodule was causing issues in rust-lang/rust, so eliminiate it here. `build-musl` is also removed from `libm-test`'s default features so the crate doesn't need to be built by default.
This will be used by `josh` tooling.
Create a crate that handles pulling from and pushing to rust-lang/rust. This can be invoked with the following: $ cargo run -p josh-sync -- rustc-pull $ RUSTC_GIT=/path/to/rust/checkout cargo run -p josh-sync -- rustc-push <username>
To prepare for merging from rust-lang/rust, set the version file to: df8102f Auto merge of rust-lang#142002 - onur-ozkan:follow-ups2, r=jieyouxu
This was introduced before `#[panic_handler]` was stable, but should no longer be needed. Additionally, we only need it for `builtins-test-intrinsics`, not as a dependency of `compiler-builtins`.
…to_end` trait methods.
This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. Some changes occurred in compiler/rustc_codegen_gcc
cc @tgross35 Some changes occurred to constck cc @fee1-dead Some changes occurred in compiler/rustc_codegen_ssa Some changes occurred to the CTFE machinery rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 These commits modify compiler targets. Some changes occurred in src/tools/clippy cc @rust-lang/clippy This PR modifies If appropriate, please update The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes. cc @BoxyUwU, @jieyouxu, @Kobzol These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in compiler/rustc_attr_parsing Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr Some changes occurred in compiler/rustc_sanitizers cc @rcvalle Some changes occurred in src/doc/rustc/src/platform-support cc @Noratrieb |
|
This comment has been minimized.
This comment has been minimized.
61ca3f6
to
7298055
Compare
|
Well, the rebase made a mess. I decided to kill the messy branch and cherry pick my commit into a fresh version of the branch. I will open a new PR. |
The job Click to see the possible cause of the failure (guessed by this bot)
|
Next time please also pick a meaningful PR description. :) there are hundreds of mod.rs files so the current one says nothing. It also fails to say what is being updated in that file.
|
Small clarification on the usage of
read_to_string
andread_to_end
trait methods. The goal is to make it clear that these trait methods will become locked up if attempting to read to the end of stdin (which is a bit non-sensical unless the other end closes the pipe).Fixes: #141714