diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-02-23 12:00:34 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-04-27 15:46:23 +0000 |
| commit | 7234d63ea4880c62fa2ed0078c465cc07bbbb289 (patch) | |
| tree | 2bbbee59fbc02774caa1fe03b2121b2c7c2cf5e9 | |
| parent | 1c544108b1e10124b3a9f45a68c1cb36c1c45e90 (diff) | |
| download | rust-7234d63ea4880c62fa2ed0078c465cc07bbbb289.tar.gz rust-7234d63ea4880c62fa2ed0078c465cc07bbbb289.zip | |
Add `!StructuralEq` test for `ConstParamTy`
| -rw-r--r-- | tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs | 17 | ||||
| -rw-r--r-- | tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr | 12 |
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`. |
