]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-2.rs
Auto merge of #99612 - yanchen4791:issue-95079-fix, r=compiler-errors
[rust.git] / src / test / ui / generic-associated-types / const-generics-gat-in-trait-return-type-2.rs
1 // run-pass
2 #![feature(generic_associated_types)]
3
4 // This test unsures that with_opt_const_param returns the
5 // def_id of the N param in the Foo::Assoc GAT.
6
7 trait Foo {
8     type Assoc<const N: usize>;
9     fn foo<const N: usize>(&self) -> Self::Assoc<N>;
10 }
11
12 impl Foo for () {
13     type Assoc<const N: usize> = [(); N];
14     fn foo<const N: usize>(&self) -> Self::Assoc<N> {
15         [(); N]
16     }
17 }
18
19 fn main() {
20     assert_eq!(().foo::<10>(), [(); 10]);
21 }