-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Tracking Issue for assert_eq
in constants
#74925
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
Comments
@oli-obk does this only apply to |
It covers all of these unless there's no formatting in |
discussed in a compiler meeting: https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bsteering.20meeting.5D.202022-09-16.20JIT.20backlog.20b'za/near/299173821 closing as the information provided here is also part of the const-eval skill tree where it's probably more discoverable: https://rust-lang.github.io/const-eval/ |
As the OP says, this is requires const traits (#67792). |
Uh oh!
There was an error while loading. Please reload this page.
In order to use
assert_eq!
in constants, we first need to havepanic!
with formatting (#51999) andconst fn
PartialEq::eq
implementations (#67792) implemented and stabilized. If you look at the desugaring ofassert_eq!
, this quickly becomes obvious:desugars to
where the
==
operation will desugar toPartialEq::eq(left_val, right_val)
for all non-primites. If we want to, we can supportassert_eq!
for primitives (integers, chars, bools) with only panicking with formatting.The text was updated successfully, but these errors were encountered: