Skip to content

Commit 6340883

Browse files
committed
---
yaml --- r: 40267 b: refs/heads/dist-snap c: 768247f h: refs/heads/master i: 40265: 785ddbb 40263: 4d0168a v: v3
1 parent 45942bd commit 6340883

File tree

5 files changed

+49
-1
lines changed

5 files changed

+49
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
99
refs/heads/incoming: e90142e536c150df0d9b4b2f11352152177509b5
10-
refs/heads/dist-snap: b269ac13cde5d663909894f5c656cb8be77249c2
10+
refs/heads/dist-snap: 768247f393a18ec56d7a92cded2545e6f7d92649
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
type t<T> = { f: fn() -> T };
2+
3+
fn f<T>(_x: t<T>) {}
4+
5+
fn main() {
6+
let x: t<()> = { f: { || () } };
7+
f(x); //~ ERROR copying a noncopyable value
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
type boxedFn = { theFn: fn () -> uint };
2+
3+
fn createClosure (closedUint: uint) -> boxedFn {
4+
{ theFn: fn@ () -> uint { closedUint } }
5+
}
6+
7+
fn main () {
8+
let aFn: boxedFn = createClosure(10);
9+
10+
let myInt: uint = aFn.theFn();
11+
12+
assert myInt == 10;
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
fn add(n: int) -> fn@(int) -> int {
2+
fn@(m: int) -> int { m + n }
3+
}
4+
5+
fn main()
6+
{
7+
assert add(3)(4) == 7;
8+
let add3 : fn(int)->int = add(3);
9+
assert add3(4) == 7;
10+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
fn add(n: int) -> fn@(int) -> int {
2+
fn@(m: int) -> int { m + n }
3+
}
4+
5+
fn main()
6+
{
7+
assert add(3)(4) == 7;
8+
9+
let add1 : fn@(int)->int = add(1);
10+
assert add1(6) == 7;
11+
12+
let add2 : &(fn@(int)->int) = &add(2);
13+
assert (*add2)(5) == 7;
14+
15+
let add3 : fn(int)->int = add(3);
16+
assert add3(4) == 7;
17+
}

0 commit comments

Comments
 (0)