-
Notifications
You must be signed in to change notification settings - Fork 13.3k
pretty-pretty extremal constants! #62457
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
pretty-pretty extremal constants! #62457
Conversation
src/librustc/ty/print/pretty.rs
Outdated
let max = truncate(u128::max_value(), bit_size); | ||
|
||
match data { | ||
d if d == max => p!(write("::std::{}::MAX", ui)), |
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.
s/::std/std
N.B. rust-lang/rfcs#2700 -- this will need to be updated once those constants are added. |
Hey! This is a ping from triage, we would like to know if you @zackmdavis could give us a few more minutes to update here so we can move forward . Thanks. |
src/librustc/ty/print/pretty.rs
Outdated
let bit_size = Integer::from_attr(&self.tcx(), UnsignedInt(ui)).size(); | ||
let max = truncate(u128::max_value(), bit_size); | ||
|
||
match data { |
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 would be clearer as an if
block.
@zackmdavis: this looks great, thanks! Just a couple of nits to address. |
Thanks for the ping/review. As I recall, CI is failing due to MIR-opt tests, which I haven't found time to debug yet: expect an update by this weekend. |
@rustbot modify labels to +S-waiting-on-author, -S-waiting-on-review |
@zackmdavis: you just need to replace the two occurrences of |
Ping from triage @zackmdavis any update on this? Some checks weren't successful. Thanks |
@gagan0723 I regret that my "expect an update by this weekend" prediction wasn't accurate for personal reasons. Please stand by. |
My apologies for not reading your comment above.😔 |
fd04c95
to
ed4d5b5
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 |
While many programmers may intuitively appreciate the significance of "magic numbers" like −2147483648, Rust is about empowering everyone to build reliable and efficient software! It's a bit more legible to print the constant names (even noisy fully-qualified-paths thereof). The bit-manipulation methods mirror those in `librustc_mir::hair::pattern::_match::all_constructors`; thanks to the immortal Varkor for guidance. Resolves rust-lang#56393.
ed4d5b5
to
d1cdb02
Compare
Thanks for your patience. @bors r=varkor |
📌 Commit d1cdb02 has been approved by |
…_cognition, r=varkor pretty-pretty extremal constants! (A resurrection of the defunct #57073.) While many programmers may intuitively appreciate the significance of "magic numbers" like −2147483648, Rust is about empowering everyone to build reliable and efficient software! It's a bit more legible to print the constant names (even noisy fully-qualified-paths thereof). The bit-manipulation methods mirror those in `librustc_mir::hair::pattern::_match::all_constructors`; thanks to the immortal Varkor for guidance. Resolves #56393. r? @varkor
☀️ Test successful - checks-azure |
(A resurrection of the defunct #57073.)
While many programmers may intuitively appreciate the significance of "magic numbers" like −2147483648, Rust is about empowering everyone to build reliable and efficient software! It's a bit more legible to print the constant names (even noisy fully-qualified-paths thereof).
The bit-manipulation methods mirror those in
librustc_mir::hair::pattern::_match::all_constructors
; thanks to the immortal Varkor for guidance.Resolves #56393.
r? @varkor