]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/const-generics-gat-in-trait-return-type-3.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-3.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 Bar::Assoc GAT.
5
6 trait Bar {
7     type Assoc<const N: usize>;
8 }
9 trait Foo: Bar {
10     fn foo(&self) -> Self::Assoc<3>;
11 }
12
13 impl Bar for () {
14     type Assoc<const N: usize> = [(); N];
15 }
16
17 impl Foo for () {
18     fn foo(&self) -> Self::Assoc<3> {
19         [(); 3]
20     }
21 }
22
23 fn main() {
24     assert_eq!(().foo(), [(); 3]);
25 }