-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add const examples #71845
Add const examples #71845
Conversation
r? @dtolnay (rust_highfive has picked a reviewer for you, use r? to override) |
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, I agree it wasn't clear before.
I might suggest "intended way" instead of "correct way" because the difference isn't in correctness, just in what we'd like for people to write.
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 |
I love it; I felt weird writing it out but couldn't come up with something better. I will make that change and add the other examples either tonight or tomorrow. |
And also point people to use the associated constants of f32 instead.
64efcf9
to
8bef0a3
Compare
This should be ready for review; I'm building a copy of the docs locally to make sure that those int macros expand the way I think they should, and I believe I've fixed tidy. |
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.
Thank you Steve.
@bors r+ |
📌 Commit 55e37f9 has been approved by |
…dtolnay Add const examples I only added them to `std::f32` to get feedback on this approach before adding the other constants. When looking at rust-lang#68952, I found the docs a little confusing. Unless you're intimately aware of what's going on here, I don't think it's super clear what is deprecated and what you're supposed to do instead. I think short examples really clarify what's meant here, so that's what I did.
Rollup of 10 pull requests Successful merges: - rust-lang#71587 (Report cannot move errors in promoted MIR) - rust-lang#71711 (Updates to some ignored tests) - rust-lang#71845 (Add const examples) - rust-lang#71878 (Add remove_current_as_list to LinkedList's CursorMut) - rust-lang#71881 (Correctly handle UEFI targets as Windows-like when emitting sections for LLVM bitcode) - rust-lang#71883 (add a missing "at" in a comment) - rust-lang#71891 (¬∃x. ¬y => ∀x. y) - rust-lang#71892 (Update btree_map::VacantEntry::insert docs to actually call insert) - rust-lang#71902 (Suggest to add missing feature when using gated const features) - rust-lang#71904 (fix typo in function name) Failed merges: r? @ghost
I only added them to
std::f32
to get feedback on this approach before adding the other constants.When looking at #68952, I found the docs a little confusing. Unless you're intimately aware of what's going on here, I don't think it's super clear what is deprecated and what you're supposed to do instead. I think short examples really clarify what's meant here, so that's what I did.