rust/tests/ui/coroutine/issue-58888.rs

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

28 lines
508 B
Rust
Raw Normal View History

// run-pass
// compile-flags: -g
2023-10-20 05:46:28 +08:00
#![feature(coroutines, coroutine_trait)]
2023-10-20 00:06:43 +08:00
use std::ops::Coroutine;
struct Database;
impl Database {
fn get_connection(&self) -> impl Iterator<Item = ()> {
Some(()).into_iter()
}
2023-10-20 00:06:43 +08:00
fn check_connection(&self) -> impl Coroutine<Yield = (), Return = ()> + '_ {
move || {
let iter = self.get_connection();
for i in iter {
yield i
}
}
}
}
fn main() {
Database.check_connection();
}