match cmt.cat {
mc::cat_rvalue(..) |
mc::cat_static_item |
- mc::cat_copied_upvar(_) => {
+ mc::cat_copied_upvar(mc::CopiedUpvar { onceness: ast::Many, .. }) => {
None
}
mc::cat_local(id) |
mc::cat_arg(id) |
+ mc::cat_copied_upvar(mc::CopiedUpvar { upvar_id: id, .. }) |
mc::cat_upvar(ty::UpvarId {var_id: id, ..}, _) => {
Some(@LpVar(id))
}
--- /dev/null
+// Copyright 2014 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.
+
+fn main() {
+ let x = ~1;
+ let f: proc() = proc() {
+ let _a = x;
+ drop(x);
+ //~^ ERROR: use of moved value: `x`
+ };
+ f();
+}
fn main() {
let r = {
let x = ~42;
- let f = proc() &x; //~ ERROR: borrowed value does not live long enough
+ let f = proc() &x; //~ ERROR: `x` does not live long enough
f()
};
--- /dev/null
+// Copyright 2014 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.
+
+fn main() {
+ let (tx, rx) = channel();
+ spawn(proc() {
+ loop {
+ let tx = tx;
+ //~^ ERROR: use of moved value: `tx`
+ tx.send(1);
+ }
+ });
+}
+
--- /dev/null
+// Copyright 2014 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.
+
+fn main() {
+ let f = proc() {};
+ (proc() {
+ f();
+ f();
+ //~^ ERROR: use of moved value: `f`
+ })()
+}