Skip to content

Commit 55ce8f1

Browse files
committed
---
yaml --- r: 4197 b: refs/heads/master c: 4de0b3d h: refs/heads/master i: 4195: 3399237 v: v3
1 parent b7ca4e0 commit 55ce8f1

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 63fa765e0eaa8d07a8b4e60b5f618cfdb1341e7f
2+
refs/heads/master: 4de0b3d9474eb4b1284a8abf4bd03a5135a19a83

trunk/src/comp/middle/trans.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4538,10 +4538,6 @@ fn trans_bind(cx: &@block_ctxt, f: &@ast::expr,
45384538
fn trans_bind_1(cx: &@block_ctxt, f: &@ast::expr, f_res: &lval_result,
45394539
args: &(option::t[@ast::expr])[], id: ast::node_id) ->
45404540
result {
4541-
if f_res.is_mem {
4542-
bcx_ccx(cx).sess.unimpl("re-binding existing function");
4543-
}
4544-
45454541
let bound: (@ast::expr)[] = ~[];
45464542
for argopt: option::t[@ast::expr] in args {
45474543
alt argopt { none. { } some(e) { bound += ~[e]; } }

trunk/src/test/run-pass/rebind-fn.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// xfail-stage0
2+
fn add(i: int, j: int) -> int { ret i + j; }
3+
fn binder(n: int) -> fn() -> int {
4+
let f = bind add(n, _);
5+
ret bind f(2);
6+
}
7+
fn main() {
8+
binder(5);
9+
let f = binder(1);
10+
assert(f() == 3);
11+
assert(binder(8)() == 10);
12+
}

0 commit comments

Comments
 (0)