From 5f1a7aa46d11129605b55b028a001bb40696f460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Sat, 30 Jan 2021 21:53:59 +0300 Subject: [PATCH] Add a test for #71202 Closes #71202 --- src/test/ui/const-generics/issue-71202.rs | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/test/ui/const-generics/issue-71202.rs diff --git a/src/test/ui/const-generics/issue-71202.rs b/src/test/ui/const-generics/issue-71202.rs new file mode 100644 index 00000000000..78dee1717f1 --- /dev/null +++ b/src/test/ui/const-generics/issue-71202.rs @@ -0,0 +1,33 @@ +// check-pass + +#![feature(const_generics)] +#![allow(incomplete_features, const_evaluatable_unchecked)] + +use std::marker::PhantomData; + +struct DataHolder { + item: T, +} + +impl DataHolder { + const ITEM_IS_COPY: [(); 1 - { + 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; + } + + >::VALUE + } as usize] = []; +} + +fn main() {}