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