rust/tests/ui/impl-trait/recursive-bound-eval.rs

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

19 lines
371 B
Rust
Raw Normal View History

2024-06-11 06:49:05 +00:00
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() {}