-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Updated core/macros.rs to note it works in a no_std environment. #53299
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
dde0db0
to
960880b
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
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 great! Just one small change. Sorry that it took me a while to get back to you; rustconf made everything tough for a bit.
src/libcore/macros.rs
Outdated
@@ -349,6 +349,27 @@ macro_rules! try { | |||
/// write!(&mut v, "s = {:?}", s).unwrap(); // uses io::Write::write_fmt | |||
/// assert_eq!(v, b"s = \"abc 123\""); | |||
/// ``` | |||
/// | |||
/// Note : This macro can be used in no_std setups as well |
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.
can you remove the space before the :
please?
and no_std
needs backticks, here and on the next line
Hey, no problem. Guessed as much, with regards to your absence. I was following Rustconf too. It was amazing. Will finish the requested changes by tomorrow. |
216637c
to
04e6143
Compare
@steveklabnik Does the PR look okay to you now? |
Ping from triage @steveklabnik / @rust-lang/docs: This PR requires your review. |
src/libcore/macros.rs
Outdated
/// } | ||
/// | ||
/// let mut m = Example{}; | ||
/// write!(&mut m, "Hello World").expect("Not written"); |
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.
Please remove the extra whitespace at the beginning of all your code examples (1 is enough).
src/libcore/macros.rs
Outdated
/// # extern crate core; | ||
/// use core::fmt::Write; | ||
/// | ||
/// struct Example{ |
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.
Why not just struct Example;
?
src/libcore/macros.rs
Outdated
/// struct Example{ | ||
/// } | ||
/// | ||
/// impl Write for Example{ |
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.
Please add a whitespace before {
.
Ping from triage @MagnumOpus21: Some changes have been requested to your PR. |
@TimNN Give me a day to push the changes |
04e6143
to
2eb73b1
Compare
2eb73b1
to
9d440d5
Compare
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!
@bors: r+ rollup |
📌 Commit 9d440d5 has been approved by |
…veklabnik Updated core/macros.rs to note it works in a no_std environment. Fixes rust-lang#45797 This PR updates the documentation of `write!` to note it works in a `no_std` environment, and adds an example to showcase this. In a `no_std` environment, the author of the code is responsible for the implementation of the `Write` trait. This example will work out of the box with `no_std`, but the implementation of `Write` is expected to be provided by the user. r? @steveklabnik
Rollup of 17 pull requests Successful merges: - #53299 (Updated core/macros.rs to note it works in a no_std environment.) - #53376 (Cross reference io::copy and fs::copy in docs.) - #53455 (Individual docs for {from,to}_*_bytes) - #53550 (librustc_lint: In recursion warning, change 'recurring' to 'recursing') - #53860 (Migrate (some) of run-pass/ to ui) - #53874 (Implement Unpin for Box, Rc, and Arc) - #53895 (tidy: Cleanups and clippy warning fixes) - #53946 (Clarify `ManuallyDrop` docs) - #53948 (Minimized clippy test from when NLL disabled two-phase borrows) - #53959 (Add .git extension to submodule paths missing it) - #53966 (A few cleanups and minor improvements to mir/dataflow) - #53967 (propagate build.python into cmake) - #53979 (Remove `#[repr(transparent)]` from atomics) - #53991 (Add unchecked_shl/shr check for intrinsics to fix miri's test suit) - #53992 (migrate run-pass/borrowck to ui/run-pass) - #53994 (migrate run-pass/*/ to ui/run-pass) - #54023 (update clippy submodule)
Fixes #45797
This PR updates the documentation of
write!
to note it works in ano_std
environment, and adds anexample to showcase this. In a
no_std
environment, the author of the code is responsible for theimplementation of the
Write
trait. This example will work out of the box withno_std
, but theimplementation of
Write
is expected to be provided by the user.r? @steveklabnik