Skip to content

Commit a4534a7

Browse files
committed
---
yaml --- r: 14210 b: refs/heads/try c: 0e5922a h: refs/heads/master v: v3
1 parent 581c212 commit a4534a7

33 files changed

+58
-69
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 13d743093b55dae44772ebdf21194058a33d3bb6
5+
refs/heads/try: 0e5922a0b10b96ce70f115d522b1934808c2244c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/comp/syntax/parse/parser.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -854,9 +854,15 @@ fn parse_bottom_expr(p: parser) -> pexpr {
854854
ret pexpr(mk_mac_expr(p, lo, p.span.hi, ast::mac_ellipsis));
855855
} else if eat_word(p, "bind") {
856856
let e = parse_expr_res(p, RESTRICT_NO_CALL_EXPRS);
857+
fn parse_expr_opt(p: parser) -> option<@ast::expr> {
858+
alt p.token {
859+
token::UNDERSCORE { p.bump(); ret none; }
860+
_ { ret some(parse_expr(p)); }
861+
}
862+
}
857863
let es =
858864
parse_seq(token::LPAREN, token::RPAREN, seq_sep(token::COMMA),
859-
parse_expr_or_hole, p);
865+
parse_expr_opt, p);
860866
hi = es.span.hi;
861867
ex = ast::expr_bind(e, es.node);
862868
} else if p.token == token::POUND {
@@ -1030,18 +1036,10 @@ fn parse_dot_or_call_expr_with(p: parser, e0: pexpr) -> pexpr {
10301036
alt p.token {
10311037
// expr(...)
10321038
token::LPAREN if permits_call(p) {
1033-
let es_opt =
1034-
parse_seq(token::LPAREN, token::RPAREN,
1035-
seq_sep(token::COMMA), parse_expr_or_hole, p);
1036-
hi = es_opt.span.hi;
1037-
1038-
let nd =
1039-
if vec::any(es_opt.node, {|e| option::is_none(e) }) {
1040-
ast::expr_bind(to_expr(e), es_opt.node)
1041-
} else {
1042-
let es = vec::map(es_opt.node) {|e| option::get(e) };
1043-
ast::expr_call(to_expr(e), es, false)
1044-
};
1039+
let es = parse_seq(token::LPAREN, token::RPAREN,
1040+
seq_sep(token::COMMA), parse_expr, p);
1041+
hi = es.span.hi;
1042+
let nd = ast::expr_call(to_expr(e), es.node, false);
10451043
e = mk_pexpr(p, lo, hi, nd);
10461044
}
10471045

@@ -1390,13 +1388,6 @@ fn parse_expr(p: parser) -> @ast::expr {
13901388
ret parse_expr_res(p, UNRESTRICTED);
13911389
}
13921390

1393-
fn parse_expr_or_hole(p: parser) -> option<@ast::expr> {
1394-
alt p.token {
1395-
token::UNDERSCORE { p.bump(); ret none; }
1396-
_ { ret some(parse_expr(p)); }
1397-
}
1398-
}
1399-
14001391
fn parse_expr_res(p: parser, r: restriction) -> @ast::expr {
14011392
let old = p.restriction;
14021393
p.restriction = r;

branches/try/src/comp/syntax/print/pprust.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -846,12 +846,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
846846
_ { word(s.s, "_"); }
847847
}
848848
}
849-
850-
// "bind" keyword is only needed if there are no "_" arguments.
851-
if !vec::any(args) {|arg| option::is_none(arg) } {
852-
word_nbsp(s, "bind");
853-
}
854-
849+
word_nbsp(s, "bind");
855850
print_expr(s, func);
856851
popen(s);
857852
commasep(s, inconsistent, args, print_opt);

branches/try/src/libcore/either.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pure fn is_left<T, U>(eith: t<T, U>) -> bool {
113113
}
114114

115115
/*
116-
Function: is_left
116+
Function: is_right
117117
118118
Checks whether the given value is a right
119119
*/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fn main() {
22
fn echo<T>(c: int, x: fn@(T)) { #error("wee"); }
33

4-
let y = echo(42, _);
4+
let y = bind echo(42, _);
55

66
y(fn@(&&i: str) { });
77
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fn main() {
22
fn echo<T>(c: int, x: [T]) { }
33

4-
let y: fn@([int]) = echo(42, _);
4+
let y: fn@([int]) = bind echo(42, _);
55

66
y([1]);
77
}

branches/try/src/test/run-pass/bind-trivial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
fn f(n: int) -> int { ret n; }
66

77
fn main() {
8-
let g: fn@(int) -> int = f(_);
8+
let g: fn@(int) -> int = bind f(_);
99
let i: int = g(42);
1010
assert (i == 42);
1111
}

branches/try/src/test/run-pass/drop-bind-thunk-args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
fn f(x: @int) { }
44

5-
fn main() { let x = @10; let ff = f(_); ff(x); ff(x); }
5+
fn main() { let x = @10; let ff = bind f(_); ff(x); ff(x); }

branches/try/src/test/run-pass/drop-parametric-closure-with-bound-box.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
fn f<T>(i: @uint, t: T) { }
44

5-
fn main() { let x = f::<char>(@0xdeafbeefu, _); }
5+
fn main() { let x = bind f::<char>(@0xdeafbeefu, _); }

branches/try/src/test/run-pass/expr-alt-generic-box1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn test_generic<T>(expected: @T, eq: compare<T>) {
1111

1212
fn test_box() {
1313
fn compare_box(b1: @bool, b2: @bool) -> bool { ret *b1 == *b2; }
14-
let eq = compare_box(_, _);
14+
let eq = bind compare_box(_, _);
1515
test_generic::<bool>(@true, eq);
1616
}
1717

branches/try/src/test/run-pass/expr-alt-generic-box2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn test_generic<T: copy>(expected: T, eq: compare<T>) {
1111

1212
fn test_vec() {
1313
fn compare_box(&&v1: @int, &&v2: @int) -> bool { ret v1 == v2; }
14-
let eq = compare_box(_, _);
14+
let eq = bind compare_box(_, _);
1515
test_generic::<@int>(@1, eq);
1616
}
1717

branches/try/src/test/run-pass/expr-alt-generic-unique1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn test_generic<T: copy>(expected: ~T, eq: compare<T>) {
1010

1111
fn test_box() {
1212
fn compare_box(b1: ~bool, b2: ~bool) -> bool { ret *b1 == *b2; }
13-
let eq = compare_box(_, _);
13+
let eq = bind compare_box(_, _);
1414
test_generic::<bool>(~true, eq);
1515
}
1616

branches/try/src/test/run-pass/expr-alt-generic-unique2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn test_generic<T: copy>(expected: T, eq: compare<T>) {
1111

1212
fn test_vec() {
1313
fn compare_box(&&v1: ~int, &&v2: ~int) -> bool { ret v1 == v2; }
14-
let eq = compare_box(_, _);
14+
let eq = bind compare_box(_, _);
1515
test_generic::<~int>(~1, eq);
1616
}
1717

branches/try/src/test/run-pass/expr-alt-generic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ fn test_generic<T: copy>(expected: T, eq: compare<T>) {
1111

1212
fn test_bool() {
1313
fn compare_bool(&&b1: bool, &&b2: bool) -> bool { ret b1 == b2; }
14-
let eq = compare_bool(_, _);
14+
let eq = bind compare_bool(_, _);
1515
test_generic::<bool>(true, eq);
1616
}
1717

1818
fn test_rec() {
1919
type t = {a: int, b: int};
2020

2121
fn compare_rec(t1: t, t2: t) -> bool { ret t1 == t2; }
22-
let eq = compare_rec(_, _);
22+
let eq = bind compare_rec(_, _);
2323
test_generic::<t>({a: 1, b: 2}, eq);
2424
}
2525

branches/try/src/test/run-pass/expr-block-generic-box1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn test_box() {
1515
log(debug, *b2);
1616
ret *b1 == *b2;
1717
}
18-
let eq = compare_box(_, _);
18+
let eq = bind compare_box(_, _);
1919
test_generic::<bool>(@true, eq);
2020
}
2121

branches/try/src/test/run-pass/expr-block-generic-box2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn test_generic<T: copy>(expected: T, eq: compare<T>) {
1111

1212
fn test_vec() {
1313
fn compare_vec(&&v1: @int, &&v2: @int) -> bool { ret v1 == v2; }
14-
let eq = compare_vec(_, _);
14+
let eq = bind compare_vec(_, _);
1515
test_generic::<@int>(@1, eq);
1616
}
1717

branches/try/src/test/run-pass/expr-block-generic-unique1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn test_box() {
1414
log(debug, *b2);
1515
ret *b1 == *b2;
1616
}
17-
let eq = compare_box(_, _);
17+
let eq = bind compare_box(_, _);
1818
test_generic::<bool>(~true, eq);
1919
}
2020

branches/try/src/test/run-pass/expr-block-generic-unique2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn test_generic<T: copy>(expected: T, eq: compare<T>) {
1111

1212
fn test_vec() {
1313
fn compare_vec(&&v1: ~int, &&v2: ~int) -> bool { ret v1 == v2; }
14-
let eq = compare_vec(_, _);
14+
let eq = bind compare_vec(_, _);
1515
test_generic::<~int>(~1, eq);
1616
}
1717

branches/try/src/test/run-pass/expr-block-generic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ fn test_generic<T: copy>(expected: T, eq: compare<T>) {
1313

1414
fn test_bool() {
1515
fn compare_bool(&&b1: bool, &&b2: bool) -> bool { ret b1 == b2; }
16-
let eq = compare_bool(_, _);
16+
let eq = bind compare_bool(_, _);
1717
test_generic::<bool>(true, eq);
1818
}
1919

2020
fn test_rec() {
2121
type t = {a: int, b: int};
2222

2323
fn compare_rec(t1: t, t2: t) -> bool { ret t1 == t2; }
24-
let eq = compare_rec(_, _);
24+
let eq = bind compare_rec(_, _);
2525
test_generic::<t>({a: 1, b: 2}, eq);
2626
}
2727

branches/try/src/test/run-pass/expr-if-generic-box1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn test_generic<T>(expected: @T, not_expected: @T, eq: compare<T>) {
1111

1212
fn test_box() {
1313
fn compare_box(b1: @bool, b2: @bool) -> bool { ret *b1 == *b2; }
14-
let eq = compare_box(_, _);
14+
let eq = bind compare_box(_, _);
1515
test_generic::<bool>(@true, @false, eq);
1616
}
1717

branches/try/src/test/run-pass/expr-if-generic-box2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn test_generic<T: copy>(expected: T, not_expected: T, eq: compare<T>) {
1111

1212
fn test_vec() {
1313
fn compare_box(&&v1: @int, &&v2: @int) -> bool { ret v1 == v2; }
14-
let eq = compare_box(_, _);
14+
let eq = bind compare_box(_, _);
1515
test_generic::<@int>(@1, @2, eq);
1616
}
1717

branches/try/src/test/run-pass/expr-if-generic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ fn test_generic<T: copy>(expected: T, not_expected: T, eq: compare<T>) {
1313

1414
fn test_bool() {
1515
fn compare_bool(&&b1: bool, &&b2: bool) -> bool { ret b1 == b2; }
16-
let eq = compare_bool(_, _);
16+
let eq = bind compare_bool(_, _);
1717
test_generic::<bool>(true, false, eq);
1818
}
1919

2020
fn test_rec() {
2121
type t = {a: int, b: int};
2222

2323
fn compare_rec(t1: t, t2: t) -> bool { ret t1 == t2; }
24-
let eq = compare_rec(_, _);
24+
let eq = bind compare_rec(_, _);
2525
test_generic::<t>({a: 1, b: 2}, {a: 2, b: 3}, eq);
2626
}
2727

branches/try/src/test/run-pass/fixed-point-bind-box.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
fn fix_help<A, B>(f: native fn(fn@(A) -> B, A) -> B, x: A) -> B {
2-
ret f(fix_help(f, _), x);
2+
ret f(bind fix_help(f, _), x);
33
}
44

55
fn fix<A, B>(f: native fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
6-
ret fix_help(f, _);
6+
ret bind fix_help(f, _);
77
}
88

99
fn fact_(f: fn@(&&int) -> int, &&n: int) -> int {

branches/try/src/test/run-pass/fixed-point-bind-unique.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
fn fix_help<A, B: send>(f: native fn(fn@(A) -> B, A) -> B, x: A) -> B {
2-
ret f(fix_help(f, _), x);
2+
ret f(bind fix_help(f, _), x);
33
}
44

55
fn fix<A, B: send>(f: native fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
6-
ret fix_help(f, _);
6+
ret bind fix_help(f, _);
77
}
88

99
fn fact_(f: fn@(&&int) -> int, &&n: int) -> int {

branches/try/src/test/run-pass/fun-call-variants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn main() {
77
let a: int = direct(3); // direct
88
let b: int = ho(direct); // indirect unbound
99

10-
let c: int = ho(direct(_)); // indirect bound
10+
let c: int = ho(bind direct(_)); // indirect bound
1111
assert (a == b);
1212
assert (b == c);
1313
}

branches/try/src/test/run-pass/generic-bind.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ fn main() {
66
let t = {_0: 1, _1: 2, _2: 3, _3: 4, _4: 5, _5: 6, _6: 7};
77
assert (t._5 == 6);
88
let f1 =
9-
id::<{_0: int,
10-
_1: int,
11-
_2: int,
12-
_3: int,
13-
_4: int,
14-
_5: int,
15-
_6: int}>(_);
9+
bind id::<{_0: int,
10+
_1: int,
11+
_2: int,
12+
_3: int,
13+
_4: int,
14+
_5: int,
15+
_6: int}>(_);
1616
assert (f1(t)._5 == 6);
1717
}

branches/try/src/test/run-pass/hashmap-memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ mod map_reduce {
5858
}
5959
}
6060

61-
map(input, emit(intermediates, ctrl, _, _));
61+
map(input, bind emit(intermediates, ctrl, _, _));
6262
send(ctrl, mapper_done);
6363
}
6464

branches/try/src/test/run-pass/issue-333.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn quux<T: copy>(x: T) -> T { let f = id::<T>(_); ret f(x); }
1+
fn quux<T: copy>(x: T) -> T { let f = bind id::<T>(_); ret f(x); }
22

33
fn id<T: copy>(x: T) -> T { ret x; }
44

branches/try/src/test/run-pass/issue-898.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ fn log_if<T>(c: native fn(T)->bool, e: T) {
77
}
88

99
fn main() {
10-
(log_if(even, _))(2);
10+
(bind log_if(even, _))(2);
1111
}

branches/try/src/test/run-pass/native2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ native mod zed { }
1616
#[abi = "cdecl"]
1717
#[nolink]
1818
native mod libc {
19-
fn write(fd: int, buf: *u8, count: ctypes::size_t) -> ctypes::ssize_t;
19+
fn write(fd: int, buf: *u8, count: uint) -> int;
2020
}
2121

2222
#[abi = "cdecl"]

branches/try/src/test/run-pass/rebind-fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn add(i: int, j: int) -> int { ret i + j; }
2-
fn binder(n: int) -> fn@() -> int { let f = add(n, _); ret bind f(2); }
2+
fn binder(n: int) -> fn@() -> int { let f = bind add(n, _); ret bind f(2); }
33
fn main() {
44
binder(5);
55
let f = binder(1);
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
// xfail-test
12
// Issue #922
23

3-
// This test is specifically about spawning temporary closures.
4+
// This test is specifically about spawning temporary closures, which
5+
// isn't possible under the bare-fn regime. I'm keeping it around
6+
// until such time as we have unique closures.
47

58
use std;
69
import task;
@@ -9,5 +12,5 @@ fn f() {
912
}
1013

1114
fn main() {
12-
task::spawn {|| f() };
15+
task::spawn(bind f());
1316
}

branches/try/src/test/run-pass/unchecked-predicates.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn pure_foldl<T: copy, U: copy>(ls: list<T>, u: U, f: fn(T, U) -> U) -> U {
1818
// fn from a pure fn
1919
pure fn pure_length<T: copy>(ls: list<T>) -> uint {
2020
fn count<T>(_t: T, &&u: uint) -> uint { u + 1u }
21-
unchecked{ pure_foldl(ls, 0u, count(_, _)) }
21+
unchecked{ pure_foldl(ls, 0u, bind count(_, _)) }
2222
}
2323

2424
pure fn nonempty_list<T: copy>(ls: list<T>) -> bool { pure_length(ls) > 0u }

0 commit comments

Comments
 (0)