mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-29 19:47:38 +00:00
19 lines
371 B
Rust
19 lines
371 B
Rust
![]() |
pub trait Parser<E> {
|
||
|
fn parse(&self) -> E;
|
||
|
}
|
||
|
|
||
|
impl<E, T: Fn() -> E> Parser<E> for T {
|
||
|
fn parse(&self) -> E {
|
||
|
self()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub fn recursive_fn<E>() -> impl Parser<E> {
|
||
|
//~^ ERROR: cycle detected
|
||
|
move || recursive_fn().parse()
|
||
|
//~^ ERROR: type annotations needed
|
||
|
//~| ERROR: no method named `parse` found for opaque type
|
||
|
}
|
||
|
|
||
|
fn main() {}
|