-
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? 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
Conversation
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 |
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 |
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.