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