Closed
Description
Not sure whether this has been reported before.
I tried this code:
#![feature(const_generics)]
#![feature(structural_match)]
use std::marker::{StructuralPartialEq, StructuralEq};
struct Container<T: StructuralPartialEq + StructuralEq, const V: T>;
fn main() {
let container1: Container<i32, {42}> = Container;
let container2: Container<&'static str, "Hello world"> = Container;
}
I expected to see this happen: The compile passes.
Instead, this happened:
error[E0741]: the types of const generic parameters must derive `PartialEq` and `Eq`
--> src/main.rs:6:66
|
6 | struct Container<T: StructuralPartialEq + StructuralEq, const V: T>;
| ^ `T` doesn't derive both `PartialEq` and `Eq`
Meta
rustc --version --verbose
:
Nightly channel
Build using the Nightly version: 1.44.0-nightly
(2020-04-21 45d050cde277b22a7558)
Backtrace
<backtrace>
@rustbot modify labels to +A-const generics F-const generics T-compiler requires-nightly