Skip to content

Commit 4c2acb1

Browse files
committed
---
yaml --- r: 6905 b: refs/heads/master c: 66856a3 h: refs/heads/master i: 6903: 9d42f2d v: v3
1 parent b4c030c commit 4c2acb1

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 627217fa55ec36d94016eddd4f4fa0dacc81634d
2+
refs/heads/master: 66856a39b38b1ded0200e57c713c39ecf3dcc192
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// error-pattern: copying a noncopyable value
2+
3+
fn to_lambda1(f: lambda(uint) -> uint) -> lambda(uint) -> uint {
4+
ret f;
5+
}
6+
7+
fn to_lambda2(b: block(uint) -> uint) -> lambda(uint) -> uint {
8+
ret to_lambda1({|x| b(x)});
9+
}
10+
11+
fn main() {
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
fn to_lambda(f: lambda(uint) -> uint) -> lambda(uint) -> uint {
2+
ret f;
3+
}
4+
5+
fn main() {
6+
let x: lambda(uint) -> uint = to_lambda({ |x| x * 2u });
7+
let y = to_lambda(x);
8+
9+
let x_r = x(22u);
10+
let y_r = y(x_r);
11+
12+
assert x_r == 44u;
13+
assert y_r == 88u;
14+
}

0 commit comments

Comments
 (0)