-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Two improvements of the latest i128 numbers change #2732
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This macro bases on the static_assert_size macro from the rust compiler. Its advantage is greater compatibility with older rust versions as well as better error messages on a mismatch, as both numbers are printed. The assert macro does not print the mismatching numbers as it only gets the bool from the == comparison.
r? @Amanieu (rust-highfive has picked a reviewer for you, use r? to override) |
cc @Gankra |
TIL! neat! |
@bors r+ |
📌 Commit e1d9927 has been approved by |
bors
added a commit
that referenced
this pull request
Mar 26, 2022
Two improvements of the latest i128 numbers change Two improvements of #2719: * First, a typo/grammar fix * Second, a fix to avoid usage of the anti pattern of `==` inside an `assert` macro. Since a few releases, `assert` is usable inside `const` expressions, but for the purpose of `==`, superior alternatives exist that also work at compile time but print the two values at a mismatch. `assert_eq` is not yet usable in const contexts due to formatting.
💔 Test failed - checks-cirrus-freebsd-13 |
looks like a CI error, retry seems appropriate |
@bors retry |
☀️ Test successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13 |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two improvements of #2719:
==
inside anassert
macro. Since a few releases,assert
is usable insideconst
expressions, but for the purpose of==
, superior alternatives exist that also work at compile time but print the two values at a mismatch.assert_eq
is not yet usable in const contexts due to formatting.