]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/trait-const-args.rs
Auto merge of #87150 - rusticstuff:simplify_wrapping_neg, r=m-ou-se
[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
7 struct Const<const N: usize>;
8 trait Foo<const N: usize> {}
9
10 impl<const N: usize> Foo<N> for Const<N> {}
11
12 fn foo_impl(_: impl Foo<3>) {}
13
14 fn foo_explicit<T: Foo<3>>(_: T) {}
15
16 fn foo_where<T>(_: T)
17 where
18     T: Foo<3>,
19 {
20 }
21
22 fn main() {
23     foo_impl(Const);
24     foo_impl(Const::<3>);
25
26     foo_explicit(Const);
27     foo_explicit(Const::<3>);
28
29     foo_where(Const);
30     foo_where(Const::<3>);
31 }