mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
parent
7ce1b3b244
commit
5f1a7aa46d
33
src/test/ui/const-generics/issue-71202.rs
Normal file
33
src/test/ui/const-generics/issue-71202.rs
Normal file
@ -0,0 +1,33 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
#![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 - {
|
||||
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() {}
|
Loading…
Reference in New Issue
Block a user