Add test for issue-64848

This commit is contained in:
Yuki Okushi 2020-01-15 08:34:20 +09:00
parent 8a87b945b2
commit 406049df49

View File

@ -0,0 +1,29 @@
// build-pass
trait AssociatedConstant {
const DATA: ();
}
impl<F, T> AssociatedConstant for F
where
F: FnOnce() -> T,
T: AssociatedConstant,
{
const DATA: () = T::DATA;
}
impl AssociatedConstant for () {
const DATA: () = ();
}
fn foo() -> impl AssociatedConstant {
()
}
fn get_data<T: AssociatedConstant>(_: T) -> &'static () {
&T::DATA
}
fn main() {
get_data(foo);
}