1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Tests that references to move-by-default values trigger moves when
12 // they occur as part of various kinds of expressions.
14 #[feature(managed_boxes)];
16 struct Foo<A> { f: A }
17 fn guard(_s: ~str) -> bool {fail!()}
18 fn touch<A>(_a: &A) {}
23 touch(&x); //~ ERROR use of moved value: `x`
29 touch(&x); //~ ERROR use of moved value: `x`
33 let x = vec!(1, 2, 3);
46 touch(&x); //~ ERROR use of moved value: `x`
47 touch(&y); //~ ERROR use of moved value: `y`
57 touch(&x); //~ ERROR use of moved value: `x`
58 touch(&y); //~ ERROR use of moved value: `y`
69 touch(&x); //~ ERROR use of moved value: `x`
76 touch(&x); //~ ERROR use of moved value: `x`
82 touch(&x); //~ ERROR use of moved value: `x`
88 touch(&x); //~ ERROR use of partially moved value: `x`
94 touch(&x); //~ ERROR use of partially moved value: `x`
98 let mut x = vec!(~"hi", ~"ho");