File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
trunk/src/test/compile-fail Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 673d0d83cf39c3a21e4e9a9b3911c0fac5e1971d
2
+ refs/heads/master: 34886ed488f6cc18c3fdc20cdeccab6178e00c0f
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5
5
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
Original file line number Diff line number Diff line change
1
+ fn closure1 ( +x : ~str ) -> ( ~str , fn @( ) -> ~str ) {
2
+ let f = fn @( ) -> ~str {
3
+ copy x
4
+ //~^ WARNING implicitly copying a non-implicitly-copyable value
5
+ //~^^ NOTE to copy values into a @fn closure, use a capture clause
6
+ } ;
7
+ ( x, f)
8
+ }
9
+
10
+ fn closure2 ( +x : util:: NonCopyable ) -> ( util:: NonCopyable ,
11
+ fn @( ) -> util:: NonCopyable ) {
12
+ let f = fn @( ) -> util:: NonCopyable {
13
+ copy x
14
+ //~^ ERROR copying a noncopyable value
15
+ //~^^ NOTE non-copyable value cannot be copied into a @fn closure
16
+ //~^^^ ERROR copying a noncopyable value
17
+ } ;
18
+ ( x, f)
19
+ }
20
+ fn closure3 ( +x : util:: NonCopyable ) {
21
+ do task:: spawn {
22
+ let s = copy x;
23
+ //~^ ERROR copying a noncopyable value
24
+ //~^^ NOTE non-copyable value cannot be copied into a ~fn closure
25
+ //~^^^ ERROR copying a noncopyable value
26
+ error ! ( "%?" , s) ;
27
+ }
28
+ error ! ( "%?" , x) ;
29
+ }
30
+ fn main ( ) {
31
+ let x = ~"hello";
32
+ do task:: spawn {
33
+ let s = copy x;
34
+ //~^ WARNING implicitly copying a non-implicitly-copyable value
35
+ //~^^ NOTE to copy values into a ~fn closure, use a capture clause
36
+ error!( "%s from child" , s) ;
37
+ }
38
+ error ! ( "%s" , x) ;
39
+ }
You can’t perform that action at this time.
0 commit comments