mirror of https://github.com/rust-lang/rust
27 lines
453 B
Rust
27 lines
453 B
Rust
//@ build-pass
|
|
//@ compile-flags:-Zpolymorphize=on
|
|
|
|
pub trait ParallelIterator: Sized {
|
|
fn drive<C: Consumer<()>>(_: C) {
|
|
C::into_folder();
|
|
}
|
|
}
|
|
|
|
pub trait Consumer<T>: Sized {
|
|
type Result;
|
|
fn into_folder() -> Self::Result;
|
|
}
|
|
|
|
impl ParallelIterator for () {}
|
|
|
|
impl<F: Fn(), T> Consumer<T> for F {
|
|
type Result = ();
|
|
fn into_folder() -> Self::Result {
|
|
unimplemented!()
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
<()>::drive(|| ());
|
|
}
|