]> 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 #102954 - GuillaumeGomez:cfg-hide-attr-checks, r=Manishearth
[rust.git] / src / test / ui / generic-associated-types / const-generics-gat-in-trait-return-type-1.rs
1 // run-pass
2
3 // This test unsures that with_opt_const_param returns the
4 // def_id of the N param in the Foo::Assoc GAT.
5
6 trait Foo {
7     type Assoc<const N: usize>;
8     fn foo(&self) -> Self::Assoc<3>;
9 }
10
11 impl Foo for () {
12     type Assoc<const N: usize> = [(); N];
13     fn foo(&self) -> Self::Assoc<3> {
14         [(); 3]
15     }
16 }
17
18 fn main() {
19     assert_eq!(().foo(), [(); 3]);
20 }