rust/src/test/ui/generator/issue-58888.rs
Thomas Lively 9a55103b98 Upgrade Emscripten targets to use upstream LLVM backend
- Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the incorrect wasm32 C call ABI with the old asmjs
   version, which is correct for both wasm32 and JS.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Temporarily makes Emscripten targets use panic=abort by default
   because supporting unwinding will require an LLVM patch.
2019-10-04 00:47:21 -07:00

28 lines
565 B
Rust

// run-pass
// compile-flags: -g
// ignore-asmjs wasm2js does not support source maps yet
#![feature(generators, generator_trait)]
use std::ops::Generator;
struct Database;
impl Database {
fn get_connection(&self) -> impl Iterator<Item = ()> {
Some(()).into_iter()
}
fn check_connection(&self) -> impl Generator<Yield = (), Return = ()> + '_ {
move || {
let iter = self.get_connection();
for i in iter {
yield i
}
}
}
}
fn main() {
Database.check_connection();
}