-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Derived PartialEq cannot be used in a const
function
#77695
Comments
I'm not sure this will ever work. It would require the macro to generate a |
What's the solution? A |
What I may have to do for the moment is make a I had previously implemented |
yea, this will require opt-in, so schemes like |
Now that #102049 has landed, it's possible to do const derive PartialEq in the latest nightly: #![feature(const_cmp)]
#![feature(const_trait_impl)]
#![feature(derive_const)]
#[derive_const(PartialEq)]
struct A(u8);
const fn is_eq(left: &A, right: &A) -> bool {
left == right
} |
The derived PartialEq implementation cannot be used in a
const
context.The code below gives error
E0015
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: