summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/issues/issue-71202.rs
blob: 57fd72b12846ef3c47b5ea5e272938c66ea212e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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() {}