Skip to content

Commit 4b5cd04

Browse files
committed
add test for where clauses mentioning const params
1 parent de1ebbb commit 4b5cd04

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// check-pass
2+
// revisions: full min
3+
#![cfg_attr(full, feature(const_generics))]
4+
#![cfg_attr(full, allow(incomplete_features))]
5+
#![cfg_attr(min, feature(min_const_generics))]
6+
7+
trait Bar<const N: usize> { fn bar() {} }
8+
trait Foo<const N: usize>: Bar<N> {}
9+
10+
fn test<T, const N: usize>() where T: Foo<N> {
11+
<T as Bar<N>>::bar();
12+
}
13+
14+
struct Faz<const N: usize>;
15+
16+
impl<const N: usize> Faz<N> {
17+
fn test<T>() where T: Foo<N> {
18+
<T as Bar<N>>::bar()
19+
}
20+
}
21+
22+
trait Fiz<const N: usize> {
23+
fn fiz<T>() where T: Foo<N> {
24+
<T as Bar<N>>::bar();
25+
}
26+
}
27+
28+
impl<const N: usize> Bar<N> for u8 {}
29+
impl<const N: usize> Foo<N> for u8 {}
30+
impl<const N: usize> Fiz<N> for u8 {}
31+
fn main() {
32+
test::<u8, 13>();
33+
Faz::<3>::test::<u8>();
34+
<u8 as Fiz<13>>::fiz::<u8>();
35+
}

0 commit comments

Comments
 (0)