rust/tests/ui/impl-trait/nested-hkl-lifetime.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
646 B
Rust
Raw Normal View History

2024-03-22 07:09:53 -05:00
//@ check-pass
use std::iter::FromIterator;
struct DynamicAlt<P>(P);
impl<P> FromIterator<P> for DynamicAlt<P> {
fn from_iter<T: IntoIterator<Item = P>>(_iter: T) -> Self {
loop {}
}
}
fn owned_context<I, F>(_: F) -> impl FnMut(I) -> I {
|i| i
}
trait Parser<I> {}
impl<T, I> Parser<I> for T where T: FnMut(I) -> I {}
fn alt<I, P: Parser<I>>(_: DynamicAlt<P>) -> impl FnMut(I) -> I {
|i| i
}
fn rule_to_parser<'c>() -> impl Parser<&'c str> {
move |input| {
let v: Vec<()> = vec![];
alt(v.iter().map(|()| owned_context(rule_to_parser())).collect::<DynamicAlt<_>>())(input)
}
}
fn main() {}