Skip to content

Commit 5aea2d9

Browse files
committed
Add failing test
./x.py test --stage 1 tests/ui/const-generics/generic_const_exprs rust-lang#107265
1 parent 187d1af commit 5aea2d9

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#![feature(generic_const_exprs)]
2+
#![allow(incomplete_features)]
3+
4+
trait Type {
5+
const SIZE: usize;
6+
}
7+
enum Copied<'a, T: Type>
8+
where
9+
[(); T::SIZE]:,
10+
{
11+
Borrowed(&'a [u8; T::SIZE]),
12+
Owned([u8; T::SIZE]),
13+
}
14+
struct Pointer<T> {
15+
_phantom: core::marker::PhantomData<T>,
16+
}
17+
struct NonNullPointer<T> {
18+
_phantom: core::marker::PhantomData<T>,
19+
}
20+
impl<T> Type for NonNullPointer<T> {
21+
const SIZE: usize = Pointer::<T>::SIZE;
22+
}
23+
impl<T> Type for Pointer<T> {
24+
const SIZE: usize = 8;
25+
}
26+
impl<'a, T: Type> Copied<'a, Pointer<T>>
27+
where
28+
[(); <NonNullPointer<T>>::SIZE]:,
29+
[(); <Pointer<T>>::SIZE]:,
30+
[(); T::SIZE]:,
31+
{
32+
}
33+
34+
fn main() {}

0 commit comments

Comments
 (0)