about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs17
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr12
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs
new file mode 100644
index 00000000000..17ef396164e
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs
@@ -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>();
+}
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
new file mode 100644
index 00000000000..ca5abf5e254
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr
@@ -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`.