diff options
| author | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-07-03 19:38:14 +0200 |
|---|---|---|
| committer | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-07-18 10:53:08 +0200 |
| commit | 53d2ebb0adbe677a811ae130523ebceb285a8029 (patch) | |
| tree | aa5bf290ab3240ee1028359cef335f22dc1a2cdb /src/test/ui/closure-immutable-outer-variable.rs | |
| parent | 1c84d8187395b641616649a0f16f15a78ea8bbce (diff) | |
Implement existential types
Diffstat (limited to 'src/test/ui/closure-immutable-outer-variable.rs')
| -rw-r--r-- | src/test/ui/closure-immutable-outer-variable.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/closure-immutable-outer-variable.rs b/src/test/ui/closure-immutable-outer-variable.rs new file mode 100644 index 00000000000..e162678460c --- /dev/null +++ b/src/test/ui/closure-immutable-outer-variable.rs @@ -0,0 +1,22 @@ +// 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. + +// run-rustfix + +// Point at the captured immutable outer variable + +fn foo(mut f: Box<FnMut()>) { + f(); +} + +fn main() { + let y = true; + foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable +} |
