From 53d2ebb0adbe677a811ae130523ebceb285a8029 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 3 Jul 2018 19:38:14 +0200 Subject: Implement existential types --- .../ui/closure-immutable-outer-variable.rs.fixed | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/ui/closure-immutable-outer-variable.rs.fixed (limited to 'src/test/ui/closure-immutable-outer-variable.rs.fixed') diff --git a/src/test/ui/closure-immutable-outer-variable.rs.fixed b/src/test/ui/closure-immutable-outer-variable.rs.fixed new file mode 100644 index 00000000000..80a5a45a305 --- /dev/null +++ b/src/test/ui/closure-immutable-outer-variable.rs.fixed @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Point at the captured immutable outer variable + +fn foo(mut f: Box) { + f(); +} + +fn main() { + let mut y = true; + foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable +} -- cgit 1.4.1-3-g733a5