mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
Add test for issue-64848
This commit is contained in:
parent
8a87b945b2
commit
406049df49
29
src/test/ui/associated-types/issue-64848.rs
Normal file
29
src/test/ui/associated-types/issue-64848.rs
Normal 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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user