Initial pass review comments
This commit is contained in:
parent
c25ddf21f1
commit
352577f4bb
28 changed files with 253 additions and 207 deletions
25
src/test/run-pass/generator/auxiliary/xcrate.rs
Normal file
25
src/test/run-pass/generator/auxiliary/xcrate.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(generators, generator_trait, conservative_impl_trait)]
|
||||
|
||||
use std::ops::Generator;
|
||||
|
||||
fn bar() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn foo() -> impl Generator<Yield = (), Return = ()> {
|
||||
|| {
|
||||
if bar() {
|
||||
yield;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -24,10 +24,14 @@ impl Drop for B {
|
|||
}
|
||||
}
|
||||
|
||||
fn bool_true() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let b = B;
|
||||
let mut foo = || {
|
||||
if true {
|
||||
if bool_true() {
|
||||
panic!();
|
||||
}
|
||||
drop(b);
|
||||
|
|
@ -42,7 +46,7 @@ fn main() {
|
|||
assert_eq!(A.load(Ordering::SeqCst), 1);
|
||||
|
||||
let mut foo = || {
|
||||
if true {
|
||||
if bool_true() {
|
||||
panic!();
|
||||
}
|
||||
drop(B);
|
||||
|
|
|
|||
26
src/test/run-pass/generator/xcrate.rs
Normal file
26
src/test/run-pass/generator/xcrate.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// aux-build:xcrate.rs
|
||||
|
||||
#![feature(generators, generator_trait)]
|
||||
|
||||
extern crate xcrate;
|
||||
|
||||
use std::ops::{GeneratorState, Generator};
|
||||
|
||||
fn main() {
|
||||
let mut foo = xcrate::foo();
|
||||
|
||||
match foo.resume() {
|
||||
GeneratorState::Complete(()) => {}
|
||||
s => panic!("bad state: {:?}", s),
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue