]> git.lizzy.rs Git - rust.git/blob - tests/ui/generator/issue-58888.rs
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / generator / issue-58888.rs
1 // run-pass
2 // compile-flags: -g
3 // ignore-asmjs wasm2js does not support source maps yet
4
5 #![feature(generators, generator_trait)]
6
7 use std::ops::Generator;
8
9 struct Database;
10
11 impl Database {
12     fn get_connection(&self) -> impl Iterator<Item = ()> {
13         Some(()).into_iter()
14     }
15
16     fn check_connection(&self) -> impl Generator<Yield = (), Return = ()> + '_ {
17         move || {
18             let iter = self.get_connection();
19             for i in iter {
20                 yield i
21             }
22         }
23     }
24 }
25
26 fn main() {
27     Database.check_connection();
28 }