]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/trait-const-args.rs
Add revisions to const generic type-dependent UI tests.
[rust.git] / src / test / ui / const-generics / trait-const-args.rs
1 // check-pass
2 // revisions: full min
3
4 #![cfg_attr(full, feature(const_generics))]
5 #![cfg_attr(full, allow(incomplete_features))]
6 #![cfg_attr(min, feature(min_const_generics))]
7
8 struct Const<const N: usize>;
9 trait Foo<const N: usize> {}
10
11 impl<const N: usize> Foo<N> for Const<N> {}
12
13 fn foo_impl(_: impl Foo<3>) {}
14
15 fn foo_explicit<T: Foo<3>>(_: T) {}
16
17 fn foo_where<T>(_: T)
18 where
19     T: Foo<3>,
20 {
21 }
22
23 fn main() {
24     foo_impl(Const);
25     foo_impl(Const::<3>);
26
27     foo_explicit(Const);
28     foo_explicit(Const::<3>);
29
30     foo_where(Const);
31     foo_where(Const::<3>);
32 }