Skip to content

Commit af8c9e4

Browse files
committed
---
yaml --- r: 7220 b: refs/heads/master c: 3f3bfee h: refs/heads/master v: v3
1 parent 6785167 commit af8c9e4

File tree

13 files changed

+43
-36
lines changed

13 files changed

+43
-36
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: 455f8b0d4588b6d890ce8a908d488c0325e3f29e
2+
refs/heads/master: 3f3bfeec27c3457de30929d7dbf914a5b350808c

trunk/src/comp/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ fn create_index<T: copy>(index: [entry<T>], hash_fn: fn@(T) -> uint) ->
483483

484484
fn encode_index<T>(ebml_w: ebml::writer, buckets: [@[entry<T>]],
485485
write_fn: block(io::writer, T)) {
486-
let writer = io::new_writer(ebml_w.writer);
486+
let writer = ebml_w.writer;
487487
ebml::start_tag(ebml_w, tag_index);
488488
let bucket_locs: [uint] = [];
489489
ebml::start_tag(ebml_w, tag_index_buckets);

trunk/src/comp/syntax/print/pprust.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ fn print_type(s: ps, &&ty: @ast::ty) {
304304
pclose(s);
305305
}
306306
ast::ty_fn(proto, d) {
307-
print_ty_fn(s, proto, d, none, none);
307+
print_ty_fn(s, some(proto), d, none, none);
308308
}
309309
ast::ty_path(path, _) { print_path(s, path, false); }
310310
ast::ty_type. { word(s.s, "type"); }
@@ -485,7 +485,7 @@ fn print_ty_method(s: ps, m: ast::ty_method) {
485485
hardbreak_if_not_bol(s);
486486
cbox(s, indent_unit);
487487
maybe_print_comment(s, m.span.lo);
488-
print_ty_fn(s, ast::proto_bare, m.decl, some(m.ident), some(m.tps));
488+
print_ty_fn(s, none, m.decl, some(m.ident), some(m.tps));
489489
word(s.s, ";");
490490
end(s);
491491
}
@@ -1320,11 +1320,11 @@ fn print_mt(s: ps, mt: ast::mt) {
13201320
print_type(s, mt.ty);
13211321
}
13221322

1323-
fn print_ty_fn(s: ps, proto: ast::proto,
1323+
fn print_ty_fn(s: ps, opt_proto: option<ast::proto>,
13241324
decl: ast::fn_decl, id: option::t<ast::ident>,
13251325
tps: option::t<[ast::ty_param]>) {
13261326
ibox(s, indent_unit);
1327-
word(s.s, proto_to_str(proto));
1327+
word(s.s, opt_proto_to_str(opt_proto));
13281328
alt id { some(id) { word(s.s, " "); word(s.s, id); } _ { } }
13291329
alt tps { some(tps) { print_type_params(s, tps); } _ { } }
13301330
zerobreak(s.s);
@@ -1602,6 +1602,13 @@ fn ast_fn_constrs_str(decl: ast::fn_decl, constrs: [@ast::constr]) -> str {
16021602
ret s;
16031603
}
16041604

1605+
fn opt_proto_to_str(opt_p: option<ast::proto>) -> str {
1606+
alt opt_p {
1607+
none. { "fn" }
1608+
some(p) { proto_to_str(p) }
1609+
}
1610+
}
1611+
16051612
fn proto_to_str(p: ast::proto) -> str {
16061613
ret alt p {
16071614
ast::proto_bare. { "native fn" }

trunk/src/libcore/task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Returns:
116116
117117
A handle to the new task
118118
*/
119-
fn spawn(+f: sendfn()) -> task {
119+
fn spawn(+f: fn~()) -> task {
120120
spawn_inner(f, none)
121121
}
122122

trunk/src/libstd/test.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -313,24 +313,24 @@ type test_future<T> = {test: test_desc<T>, wait: fn@() -> test_result};
313313
fn run_test<T: copy>(test: test_desc<T>,
314314
to_task: test_to_task<T>) -> test_future<T> {
315315
if test.ignore {
316-
ret {test: test, wait: fn () -> test_result { tr_ignored }};
316+
ret {test: test, wait: fn@() -> test_result { tr_ignored }};
317317
}
318318

319319
let test_task = to_task(test.fn);
320320
ret {test: test,
321-
wait:
322-
bind fn (test_task: joinable, should_fail: bool) -> test_result {
323-
alt task::join(test_task) {
324-
task::tr_success. {
325-
if should_fail { tr_failed }
326-
else { tr_ok }
327-
}
328-
task::tr_failure. {
329-
if should_fail { tr_ok }
330-
else { tr_failed }
331-
}
332-
}
333-
}(test_task, test.should_fail)};
321+
wait: fn@() -> test_result {
322+
alt task::join(test_task) {
323+
task::tr_success. {
324+
if test.should_fail { tr_failed }
325+
else { tr_ok }
326+
}
327+
task::tr_failure. {
328+
if test.should_fail { tr_ok }
329+
else { tr_failed }
330+
}
331+
}
332+
}
333+
};
334334
}
335335

336336
// We need to run our tests in another task in order to trap test failures.

trunk/src/test/bench/task-perf-word-count.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ mod map_reduce {
4545

4646
type putter = fn@(str, int);
4747

48-
type mapper = fn(str, putter);
48+
type mapper = fn@(str, putter);
4949

5050
type getter = fn@() -> option<int>;
5151

52-
type reducer = fn(str, getter);
52+
type reducer = fn@(str, getter);
5353

5454
tag ctrl_proto {
5555
find_reducer(str, chan<chan<reduce_proto>>);
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// error-pattern:mismatched types: expected `fn()` but found `fn@()`
2-
31
fn f() {
42
}
53

64
fn main() {
75
// Can't produce a bare function by binding
8-
let g: fn() = bind f();
6+
let g: native fn() = bind f();
7+
//!^ ERROR mismatched types: expected `native fn()` but found `fn@()`
98
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
// error-pattern:expected `fn()` but found `fn(++int)`
2-
31
fn main() {
42
fn f() { }
53
fn g(i: int) { }
64
let x = f == g;
5+
//!^ ERROR expected `native fn()` but found `native fn(++int)`
76
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
// error-pattern:wrong type in main function: found `fn() -> char`
2-
fn main() -> char { }
1+
fn main() -> char {
2+
//!^ ERROR wrong type in main function: found `native fn() -> char`
3+
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
// error-pattern:wrong type in main function: found `fn(&&{x: int,y: int})`
2-
fn main(foo: {x: int, y: int}) { }
1+
fn main(foo: {x: int, y: int}) {
2+
//!^ ERROR wrong type in main function: found `native fn(&&{x: int,y: int})`
3+
}

trunk/src/test/run-fail/unwind-lambda.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn main() {
44
let cheese = "roquefort";
55
let carrots = @"crunchy";
66

7-
fn (tasties: @str, macerate: block(str)) {
7+
fn@(tasties: @str, macerate: block(str)) {
88
macerate(*tasties);
99
} (carrots, { |food|
1010
let mush = food + cheese;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fn main() {
2-
fn echo<T>(c: int, x: native fn(T)) { #error("wee"); }
2+
fn echo<T>(c: int, x: fn@(T)) { #error("wee"); }
33

44
let y = bind echo(42, _);
55

6-
y(fn(&&i: str) { });
6+
y(fn@(&&i: str) { });
77
}

trunk/src/test/run-pass/sendfn-generic-fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn test05_start(&&f: fn~(&&float, &&str) -> pair<float, str>) {
2323
assert q.b == "Ho";
2424
}
2525

26-
fn spawn<A: copy, B: copy>(f: fn(fn~(A,B)->pair<A,B>)) {
26+
fn spawn<A: copy, B: copy>(f: native fn(fn~(A,B)->pair<A,B>)) {
2727
let arg = fn~(a: A, b: B) -> pair<A,B> {
2828
ret make_generic_record(a, b);
2929
};

0 commit comments

Comments
 (0)