Skip to content

Commit 406049d

Browse files
committed
Add test for issue-64848
1 parent 8a87b94 commit 406049d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
}

0 commit comments

Comments
 (0)