]> git.lizzy.rs Git - rust.git/blob - tests/ui/associated-types/issue-64848.rs
Rollup merge of #107194 - xfix:remove-slice-internals-dependency-in-rustc-ast, r...
[rust.git] / tests / ui / associated-types / issue-64848.rs
1 // build-pass
2
3 trait AssociatedConstant {
4     const DATA: ();
5 }
6
7 impl<F, T> AssociatedConstant for F
8 where
9     F: FnOnce() -> T,
10     T: AssociatedConstant,
11 {
12     const DATA: () = T::DATA;
13 }
14
15 impl AssociatedConstant for () {
16     const DATA: () = ();
17 }
18
19 fn foo() -> impl AssociatedConstant {
20     ()
21 }
22
23 fn get_data<T: AssociatedConstant>(_: T) -> &'static () {
24     &T::DATA
25 }
26
27 fn main() {
28     get_data(foo);
29 }