std: Add a note about the print! macro and output buffering#23826
std: Add a note about the print! macro and output buffering#23826bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
src/libstd/macros.rs
Outdated
There was a problem hiding this comment.
Shouldn't this be buffered instead?
There was a problem hiding this comment.
Err, yeah. Thanks for the catch!
|
It would be helpful if this had a reference to the |
src/libstd/macros.rs
Outdated
There was a problem hiding this comment.
I think this may want to be rephrased to not mention unix and also mention "line buffering" somewhere, perhaps:
Note that stdout is frequently line-buffered by default so it may be necessary to use
io::stdout().flush()to ensure the output is emitted immediately.
There was a problem hiding this comment.
Totally reasonable, is there markup to make it actually linkify io::stdout ? (Will it do this by default? That would be amazing)
There was a problem hiding this comment.
Unfortunately, no, there is no default auto-linking, but you can always do it manually via [foo](../bar/baz.html)
|
I updated the doc comment. Including the link inline made it no longer possible to just copy the invocation out of the comment, which I felt outweighed the benefit. |
src/libstd/macros.rs
Outdated
There was a problem hiding this comment.
Can you match the surrounding style and wrap this to 80-characters as well? Also, can you put io::stdout().flush() in backticks as well?
There was a problem hiding this comment.
Done, apologies somehow tw got screwed up in my editor.
cc #23818