diff options
Diffstat (limited to 'tests/ui/generator/resume-arg-late-bound.rs')
-rw-r--r-- | tests/ui/generator/resume-arg-late-bound.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/generator/resume-arg-late-bound.rs b/tests/ui/generator/resume-arg-late-bound.rs new file mode 100644 index 000000000..1c35ba80d --- /dev/null +++ b/tests/ui/generator/resume-arg-late-bound.rs @@ -0,0 +1,17 @@ +//! Tests that we cannot produce a generator that accepts a resume argument +//! with any lifetime and then stores it across a `yield`. + +#![feature(generators, generator_trait)] + +use std::ops::Generator; + +fn test(a: impl for<'a> Generator<&'a mut bool>) {} + +fn main() { + let gen = |arg: &mut bool| { + yield (); + *arg = true; + }; + test(gen); + //~^ ERROR mismatched types +} |