about summary refs log tree commit diff
path: root/tests/ui/const-generics/issues/issue-71202.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/const-generics/issues/issue-71202.rs')
-rw-r--r--tests/ui/const-generics/issues/issue-71202.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/const-generics/issues/issue-71202.rs b/tests/ui/const-generics/issues/issue-71202.rs
new file mode 100644
index 00000000000..57fd72b1284
--- /dev/null
+++ b/tests/ui/const-generics/issues/issue-71202.rs
@@ -0,0 +1,31 @@
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features, const_evaluatable_unchecked)]
+
+use std::marker::PhantomData;
+
+struct DataHolder<T> {
+    item: T,
+}
+
+impl<T: Copy> DataHolder<T> {
+    const ITEM_IS_COPY: [(); 1 - { //~ ERROR unconstrained generic constant
+        trait NotCopy {
+            const VALUE: bool = false;
+        }
+
+        impl<__Type: ?Sized> NotCopy for __Type {}
+
+        struct IsCopy<__Type: ?Sized>(PhantomData<__Type>);
+
+        impl<__Type> IsCopy<__Type>
+        where
+            __Type: Sized + Copy,
+        {
+            const VALUE: bool = true;
+        }
+
+        <IsCopy<T>>::VALUE
+    } as usize] = [];
+}
+
+fn main() {}