diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2017-07-15 00:01:20 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2017-07-28 15:46:25 +0200 |
| commit | 77bf6e4461404dce1bb06a7804dcceaf4e819836 (patch) | |
| tree | ce7df4c35165a9f6b71b15529d766c976c463b45 /src/test | |
| parent | 7eae8489fc0e08938eb91c5c9ed0f3af919280c1 (diff) | |
| download | rust-77bf6e4461404dce1bb06a7804dcceaf4e819836.tar.gz rust-77bf6e4461404dce1bb06a7804dcceaf4e819836.zip | |
Add a test
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/generator/yield-in-args.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/compile-fail/generator/yield-in-args.rs b/src/test/compile-fail/generator/yield-in-args.rs new file mode 100644 index 00000000000..0d15fc0997f --- /dev/null +++ b/src/test/compile-fail/generator/yield-in-args.rs @@ -0,0 +1,20 @@ +// 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)] + +fn foo(_b: &bool, _a: ()) {} + +fn main() { + || { + let b = true; + foo(&b, yield); // ERROR `b` does not live long enough + }; +} |
