Closed
Description
Code
#![feature(effects)]
#[derive(Eq, PartialEq)]
pub struct Y(u8);
pub const GREEN: Y = Y(4);
pub const fn is_green(x: Y) -> bool {
match x { GREEN => true, _ => false }
}
Current output
warning: to use a constant of type `Y` in a pattern, the type must implement `PartialEq`
--> src/main.rs:7:15
|
7 | match x { GREEN => true, _ => false }
| ^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122>
= note: `#[warn(const_patterns_without_partial_eq)]` on by default
Desired output
Rationale and extra context
the T is Derive(PartialEq); why does it warn?
Other cases
No response
Anything else?
as requested by @fmease
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(const_trait_impl)]``#![feature(effects)]`Relevant to the compiler team, which will review and decide on the PR/issue.