Skip to content

Commit a5c34f8

Browse files
committed
---
yaml --- r: 23444 b: refs/heads/master c: 34886ed h: refs/heads/master v: v3
1 parent edc259a commit a5c34f8

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 673d0d83cf39c3a21e4e9a9b3911c0fac5e1971d
2+
refs/heads/master: 34886ed488f6cc18c3fdc20cdeccab6178e00c0f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
}

0 commit comments

Comments
 (0)