]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/issue-71202.rs
Rollup merge of #79399 - pickfire:patch-3, r=JohnTitor
[rust.git] / src / test / ui / const-generics / issue-71202.rs
1 // check-pass
2
3 #![feature(const_generics)]
4 #![allow(incomplete_features, const_evaluatable_unchecked)]
5
6 use std::marker::PhantomData;
7
8 struct DataHolder<T> {
9     item: T,
10 }
11
12 impl<T: Copy> DataHolder<T> {
13     const ITEM_IS_COPY: [(); 1 - {
14         trait NotCopy {
15             const VALUE: bool = false;
16         }
17
18         impl<__Type: ?Sized> NotCopy for __Type {}
19
20         struct IsCopy<__Type: ?Sized>(PhantomData<__Type>);
21
22         impl<__Type> IsCopy<__Type>
23         where
24             __Type: Sized + Copy,
25         {
26             const VALUE: bool = true;
27         }
28
29         <IsCopy<T>>::VALUE
30     } as usize] = [];
31 }
32
33 fn main() {}