From 7234d63ea4880c62fa2ed0078c465cc07bbbb289 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Thu, 23 Feb 2023 12:00:34 +0000 Subject: [PATCH] Add `!StructuralEq` test for `ConstParamTy` --- .../const_param_ty_impl_no_structural_eq.rs | 17 +++++++++++++++++ .../const_param_ty_impl_no_structural_eq.stderr | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr 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() {} + +fn main() { + check::(); +} 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`.