Skip to content

Commit 7234d63

Browse files
committed
Add !StructuralEq test for ConstParamTy
1 parent 1c54410 commit 7234d63

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![allow(incomplete_features)]
2+
#![feature(adt_const_params)]
3+
4+
#[derive(PartialEq, Eq)]
5+
struct ImplementsConstParamTy;
6+
impl std::marker::ConstParamTy for ImplementsConstParamTy {}
7+
8+
struct CantParam(ImplementsConstParamTy);
9+
10+
impl std::marker::ConstParamTy for CantParam {}
11+
//~^ error: the type `CantParam` does not `#[derive(Eq)]`
12+
13+
fn check<T: std::marker::ConstParamTy>() {}
14+
15+
fn main() {
16+
check::<ImplementsConstParamTy>();
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0277]: the type `CantParam` does not `#[derive(Eq)]`
2+
--> $DIR/const_param_ty_impl_no_structural_eq.rs:10:36
3+
|
4+
LL | impl std::marker::ConstParamTy for CantParam {}
5+
| ^^^^^^^^^ the trait `StructuralEq` is not implemented for `CantParam`
6+
|
7+
note: required by a bound in `ConstParamTy`
8+
--> $SRC_DIR/core/src/marker.rs:LL:COL
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)