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 {
get_connection(&self) -> impl Iterator<Item = ()>12     fn get_connection(&self) -> impl Iterator<Item = ()> {
13         Some(()).into_iter()
14     }
15 
check_connection(&self) -> impl Generator<Yield = (), Return = ()> + '_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 
main()26 fn main() {
27     Database.check_connection();
28 }
29