Add !StructuralEq test for ConstParamTy

This commit is contained in:
Maybe Waffle 2023-02-23 12:00:34 +00:00
parent 1c544108b1
commit 7234d63ea4
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,17 @@
#![allow(incomplete_features)]
#![feature(adt_const_params)]
#[derive(PartialEq, Eq)]
struct ImplementsConstParamTy;
impl std::marker::ConstParamTy for ImplementsConstParamTy {}
struct CantParam(ImplementsConstParamTy);
impl std::marker::ConstParamTy for CantParam {}
//~^ error: the type `CantParam` does not `#[derive(Eq)]`
fn check<T: std::marker::ConstParamTy>() {}
fn main() {
check::<ImplementsConstParamTy>();
}

View File

@ -0,0 +1,12 @@
error[E0277]: the type `CantParam` does not `#[derive(Eq)]`
--> $DIR/const_param_ty_impl_no_structural_eq.rs:10:36
|
LL | impl std::marker::ConstParamTy for CantParam {}
| ^^^^^^^^^ the trait `StructuralEq` is not implemented for `CantParam`
|
note: required by a bound in `ConstParamTy`
--> $SRC_DIR/core/src/marker.rs:LL:COL
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.