-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
implement LowerExp and UpperExp for integers #66721
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @kennytm (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 |
Ping from triage, any updates? @kennytm |
@Alexendoo This is a Draft PR, it is waiting for author to click "Ready for review". |
Sorry, this is my first PR. I was waiting on an answer to the questions higher in the thread, as I knew it would not pass review without some changes. I have now marked it ready for review, because review will probably involve answers to the question of where to put tests. |
@kennytm if you can answer the above question(s) we can proceed with this PR :) thanks |
@maxbla Unit tests for libcore should be placed in |
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 |
81305e2 adds precision support using It feels a tad weird to use a module called |
r? @dtolnay |
|
r? @KodrAus |
I think the original implementation came from an external library so it all ended up living together. I wouldn't be against refactoring out commonly useful pieces from it. |
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 @maxbla!
I've just left a few comments to start.
|
||
macro_rules! impl_Exp { | ||
($($t:ident),* as $u:ident via $conv_fn:ident named $name:ident) => { | ||
fn $name( |
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.
Before digging too deeply into the code itself can you offer any background on this implementation? Whether it's based on any common approaches used elsewhere?
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.
It is heavily based on impl_Display!
from the same file. It also makes use of some stuff from float's implementation (for precision).
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.
Alrighty, this is looking good to me! Thanks for working on this @maxbla!
Would you like to squash your commits down and I'll merge this one in?
@KodrAus Thanks for the review. I'm excited to get my first contribution merged! |
I think this PR is now ready to merge. |
Not yet xD We don't do merges here so it will be nice if you could revert the merge and rebase instead. |
Alright I think I did it right this time |
📌 Commit a8fe47d has been approved by |
implement LowerExp and UpperExp for integers Addresses rust-lang#39479 This implementation is heavily based on the preexisting `macro_rules! impl_Display` in the same file. I don't like the liberal use of unsafe in that macro and would like to modify it so `unsafe` is only present where necessary. What is Rust's policy on doing such modifications? Also, I couldn't figure out where to put tests, can I have some help with that?
Rollup of 6 pull requests Successful merges: - #64069 (Added From<Vec<NonZeroU8>> for CString) - #66721 (implement LowerExp and UpperExp for integers) - #69106 (Fix std::fs::copy on WASI target) - #69154 (Avoid calling `fn_sig` on closures) - #69166 (Check `has_typeck_tables` before calling `typeck_tables_of`) - #69180 (Suggest a comma if a struct initializer field fails to parse) Failed merges: r? @ghost
Addresses #39479
This implementation is heavily based on the preexisting
macro_rules! impl_Display
in the same file. I don't like the liberal use of unsafe in that macro and would like to modify it sounsafe
is only present where necessary. What is Rust's policy on doing such modifications?Also, I couldn't figure out where to put tests, can I have some help with that?