summaryrefslogtreecommitdiff
path: root/tests/ui/const-generics/adt_const_params/const_param_ty_impl_union.rs
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-05-16 19:40:02 +0200
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-05-16 20:09:25 +0200
commit0336dd132b50af57389aa222793aff3c38b88daf (patch)
tree4f01af97cfcd8d8e402c7bdcce5c3bcf2a94b13c /tests/ui/const-generics/adt_const_params/const_param_ty_impl_union.rs
parentcba14074bb4cc12bfe918eabd0d52a3999b2a461 (diff)
downloadrust-0336dd132b50af57389aa222793aff3c38b88daf.tar.gz
Add derive for `core::marker::ConstParamTy`
This makes it easier to implement it for a type, just like `Copy`.
Diffstat (limited to 'tests/ui/const-generics/adt_const_params/const_param_ty_impl_union.rs')
-rw-r--r--tests/ui/const-generics/adt_const_params/const_param_ty_impl_union.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_union.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_union.rs
new file mode 100644
index 00000000000..d70377a20c1
--- /dev/null
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_union.rs
@@ -0,0 +1,33 @@
+#![allow(incomplete_features)]
+#![feature(adt_const_params, structural_match)]
+
+union Union {
+ a: u8,
+}
+
+impl PartialEq for Union {
+ fn eq(&self, other: &Union) -> bool {
+ true
+ }
+}
+impl Eq for Union {}
+impl std::marker::StructuralEq for Union {}
+
+impl std::marker::ConstParamTy for Union {}
+
+#[derive(std::marker::ConstParamTy)]
+//~^ ERROR this trait cannot be derived for unions
+union UnionDerive {
+ a: u8,
+}
+
+impl PartialEq for UnionDerive {
+ fn eq(&self, other: &UnionDerive) -> bool {
+ true
+ }
+}
+impl Eq for UnionDerive {}
+impl std::marker::StructuralEq for UnionDerive {}
+
+
+fn main() {}