File tree 5 files changed +61
-2
lines changed
5 files changed +61
-2
lines changed Original file line number Diff line number Diff line change @@ -274,12 +274,13 @@ pub fn opt_loan_path(cmt: mc::cmt) -> Option<@LoanPath> {
274
274
match cmt. cat {
275
275
mc:: cat_rvalue( ..) |
276
276
mc:: cat_static_item |
277
- mc:: cat_copied_upvar( _ ) => {
277
+ mc:: cat_copied_upvar( mc :: CopiedUpvar { onceness : ast :: Many , .. } ) => {
278
278
None
279
279
}
280
280
281
281
mc:: cat_local( id) |
282
282
mc:: cat_arg( id) |
283
+ mc:: cat_copied_upvar( mc:: CopiedUpvar { upvar_id : id, .. } ) |
283
284
mc:: cat_upvar( ty:: UpvarId { var_id : id, ..} , _) => {
284
285
Some ( @LpVar ( id) )
285
286
}
Original file line number Diff line number Diff line change
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.
4
+ //
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.
10
+
11
+ fn main ( ) {
12
+ let x = ~1 ;
13
+ let f: proc ( ) = proc ( ) {
14
+ let _a = x;
15
+ drop ( x) ;
16
+ //~^ ERROR: use of moved value: `x`
17
+ } ;
18
+ f ( ) ;
19
+ }
Original file line number Diff line number Diff line change 11
11
fn main ( ) {
12
12
let r = {
13
13
let x = ~42 ;
14
- let f = proc ( ) & x; //~ ERROR: borrowed value does not live long enough
14
+ let f = proc ( ) & x; //~ ERROR: `x` does not live long enough
15
15
f ( )
16
16
} ;
17
17
Original file line number Diff line number Diff line change
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.
4
+ //
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.
10
+
11
+ fn main ( ) {
12
+ let ( tx, rx) = channel ( ) ;
13
+ spawn ( proc ( ) {
14
+ loop {
15
+ let tx = tx;
16
+ //~^ ERROR: use of moved value: `tx`
17
+ tx. send ( 1 ) ;
18
+ }
19
+ } ) ;
20
+ }
21
+
Original file line number Diff line number Diff line change
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.
4
+ //
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.
10
+
11
+ fn main ( ) {
12
+ let f = proc ( ) { } ;
13
+ ( proc ( ) {
14
+ f ( ) ;
15
+ f ( ) ;
16
+ //~^ ERROR: use of moved value: `f`
17
+ } ) ( )
18
+ }
You can’t perform that action at this time.
0 commit comments