]>
Commit | Line | Data |
---|---|---|
ea8adc8c XL |
1 | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
b7449926 XL |
11 | // run-pass |
12 | ||
ea8adc8c XL |
13 | // aux-build:xcrate.rs |
14 | ||
15 | #![feature(generators, generator_trait)] | |
16 | ||
17 | extern crate xcrate; | |
18 | ||
19 | use std::ops::{GeneratorState, Generator}; | |
20 | ||
21 | fn main() { | |
22 | let mut foo = xcrate::foo(); | |
23 | ||
0531ce1d | 24 | match unsafe { foo.resume() } { |
ea8adc8c XL |
25 | GeneratorState::Complete(()) => {} |
26 | s => panic!("bad state: {:?}", s), | |
27 | } | |
28 | ||
29 | let mut foo = xcrate::bar(3); | |
30 | ||
0531ce1d | 31 | match unsafe { foo.resume() } { |
ea8adc8c XL |
32 | GeneratorState::Yielded(3) => {} |
33 | s => panic!("bad state: {:?}", s), | |
34 | } | |
0531ce1d | 35 | match unsafe { foo.resume() } { |
ea8adc8c XL |
36 | GeneratorState::Complete(()) => {} |
37 | s => panic!("bad state: {:?}", s), | |
38 | } | |
39 | } |