Skip to content

Commit aae3a8c

Browse files
committed
---
yaml --- r: 138664 b: refs/heads/try2 c: 30bb09c h: refs/heads/master v: v3
1 parent 22368b9 commit aae3a8c

File tree

130 files changed

+307
-291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+307
-291
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 542119f61f376fa71bfc4b34fbb25be604279dc4
8+
refs/heads/try2: 30bb09c0e71d852d0521cc5d4d98096900d5d813
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,13 +2291,12 @@ be private. But this encapsulation is at the module level, not the
22912291
struct level. Note that fields and methods are _public_ by default.
22922292

22932293
~~~
2294-
mod farm {
2295-
# use farm;
2294+
pub mod farm {
22962295
# pub type Chicken = int;
22972296
# type Cow = int;
22982297
# enum Human = int;
22992298
# impl Human { fn rest(&self) { } }
2300-
# pub fn make_me_a_farm() -> farm::Farm { farm::Farm { chickens: ~[], cows: ~[], farmer: Human(0) } }
2299+
# pub fn make_me_a_farm() -> Farm { Farm { chickens: ~[], cows: ~[], farmer: Human(0) } }
23012300
pub struct Farm {
23022301
priv chickens: ~[Chicken],
23032302
priv cows: ~[Cow],

branches/try2/src/test/auxiliary/cci_nested_lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use core::dvec::DVec;
1414

1515
pub struct Entry<A,B> {key: A, value: B}
1616

17-
pub struct alist<A,B> { eq_fn: fn@(A,A) -> bool, data: DVec<Entry<A,B>> }
17+
pub struct alist<A,B> { eq_fn: @fn(A,A) -> bool, data: DVec<Entry<A,B>> }
1818

1919
pub fn alist_add<A:Copy,B:Copy>(lst: alist<A,B>, k: A, v: B) {
2020
lst.data.push(Entry{key:k, value:v});

branches/try2/src/test/auxiliary/issue4516_ty_param_lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
// except according to those terms.
1010

1111
pub fn to_closure<A:Durable + Copy>(x: A) -> @fn() -> A {
12-
fn@() -> A { copy x }
12+
let result: @fn() -> A = || copy x;
13+
result
1314
}

branches/try2/src/test/bench/core-std.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::time::precise_time_s;
1616
use std::oldmap;
1717
use std::oldmap::{Map, HashMap};
1818

19-
use io::{Reader, ReaderUtil};
19+
use core::io::{Reader, ReaderUtil};
2020

2121
macro_rules! bench (
2222
($id:ident) => (maybe_run_test(argv, stringify!($id).to_owned(), $id))

branches/try2/src/test/bench/core-vec-append.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// A raw test of vector appending performance.
1212

1313
extern mod std;
14-
use dvec::DVec;
15-
use io::WriterUtil;
14+
use core::dvec::DVec;
15+
use core::io::WriterUtil;
1616

1717
fn collect_raw(num: uint) -> ~[uint] {
1818
let mut result = ~[];

branches/try2/src/test/bench/graph500-bfs.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
267267
colors = do par::mapi(*color_vec) {
268268
let colors = arc::clone(&color);
269269
let graph = arc::clone(&graph);
270-
fn~(+i: uint, +c: &color) -> color {
270+
let result: ~fn(+x: uint, +y: &color) -> color = |i, c| {
271271
let colors = arc::get(&colors);
272272
let graph = arc::get(&graph);
273273
match *c {
@@ -290,20 +290,22 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
290290
gray(parent) => { black(parent) }
291291
black(parent) => { black(parent) }
292292
}
293-
}
293+
};
294+
result
294295
};
295296
assert(colors.len() == old_len);
296297
}
297298
298299
// Convert the results.
299300
do par::map(colors) {
300-
fn~(c: &color) -> i64 {
301+
let result: ~fn(c: &color) -> i64 = |c| {
301302
match *c {
302303
white => { -1i64 }
303304
black(parent) => { parent }
304305
_ => { fail!(~"Found remaining gray nodes in BFS") }
305306
}
306-
}
307+
};
308+
result
307309
}
308310
}
309311
@@ -387,14 +389,15 @@ fn validate(edges: ~[(node_id, node_id)],
387389
388390
let status = do par::alli(tree) {
389391
let edges = copy edges;
390-
fn~(+u: uint, v: &i64) -> bool {
392+
let result: ~fn(+x: uint, v: &i64) -> bool = |u, v| {
391393
let u = u as node_id;
392394
if *v == -1i64 || u == root {
393395
true
394396
} else {
395397
edges.contains(&(u, *v)) || edges.contains(&(*v, u))
396398
}
397-
}
399+
};
400+
result
398401
};
399402
400403
if !status { return status }

branches/try2/src/test/bench/msgsend-pipes-shared.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#[legacy_modes];
2222

2323
extern mod std;
24-
use io::Writer;
25-
use io::WriterUtil;
24+
use core::io::Writer;
25+
use core::io::WriterUtil;
2626

27-
use comm::{Port, Chan, SharedChan};
27+
use core::comm::{Port, Chan, SharedChan};
2828

2929
macro_rules! move_out (
3030
{ $x:expr } => { unsafe { let y = *ptr::addr_of(&($x)); y } }

branches/try2/src/test/bench/msgsend-pipes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#[legacy_modes];
1818

1919
extern mod std;
20-
use io::Writer;
21-
use io::WriterUtil;
20+
use core::io::Writer;
21+
use core::io::WriterUtil;
2222

23-
use comm::{Port, PortSet, Chan, stream};
23+
use core::comm::{Port, PortSet, Chan, stream};
2424

2525
macro_rules! move_out (
2626
{ $x:expr } => { unsafe { let y = *ptr::addr_of(&($x)); y } }

branches/try2/src/test/bench/shootout-fasta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* http://shootout.alioth.debian.org/
1717
*/
1818
extern mod std;
19-
use io::WriterUtil;
19+
use core::io::WriterUtil;
2020

2121
fn LINE_LENGTH() -> uint { return 60u; }
2222

branches/try2/src/test/bench/shootout-k-nucleotide-pipes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ extern mod std;
1717
use std::oldmap;
1818
use std::oldmap::HashMap;
1919
use std::sort;
20-
use io::ReaderUtil;
21-
use comm::{stream, Port, Chan};
22-
use cmp::Ord;
20+
use core::io::ReaderUtil;
21+
use core::comm::{stream, Port, Chan};
22+
use core::cmp::Ord;
2323

2424
// given a map, print a sorted version of it
2525
fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {

branches/try2/src/test/bench/shootout-mandelbrot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
//
2525
// writes pbm image to output path
2626

27-
use io::WriterUtil;
27+
use core::io::WriterUtil;
2828
use core::hashmap::linear::LinearMap;
2929

3030
struct cmplx {

branches/try2/src/test/bench/shootout-nbody.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn main() {
4545
io::println(fmt!("%f", NBodySystem::energy(bodies)));
4646
}
4747

48-
mod NBodySystem {
48+
pub mod NBodySystem {
4949
use Body;
5050

5151
pub fn make() -> ~[Body::Props] {
@@ -162,7 +162,7 @@ mod NBodySystem {
162162
}
163163
}
164164

165-
mod Body {
165+
pub mod Body {
166166
use Body;
167167

168168
pub const PI: float = 3.141592653589793;

branches/try2/src/test/bench/shootout-pfib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use core::comm::*;
2929
use core::io::WriterUtil;
3030

3131
use core::result;
32-
use result::{Ok, Err};
32+
use core::result::{Ok, Err};
3333

3434
fn fib(n: int) -> int {
3535
fn pfib(c: Chan<int>, n: int) {

branches/try2/src/test/bench/std-smallintmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
extern mod std;
1414
use std::smallintmap::SmallIntMap;
15-
use io::WriterUtil;
15+
use core::io::WriterUtil;
1616

1717
fn append_sequential(min: uint, max: uint, map: &mut SmallIntMap<uint>) {
1818
for uint::range(min, max) |i| {

branches/try2/src/test/bench/sudoku.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
extern mod std;
1414

1515
use std::bitv;
16-
use io::{ReaderUtil, WriterUtil};
16+
use core::io::{ReaderUtil, WriterUtil};
17+
use core::io;
1718

1819
// Computes a single solution to a given 9x9 sudoku
1920
//

branches/try2/src/test/bench/task-perf-alloc-unwind.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type nillist = List<()>;
4646
struct State {
4747
box: @nillist,
4848
unique: ~nillist,
49-
fn_box: fn@() -> @nillist,
49+
fn_box: @fn() -> @nillist,
5050
tuple: (@nillist, ~nillist),
5151
vec: ~[@nillist],
5252
res: r
@@ -78,7 +78,7 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
7878
State {
7979
box: @Nil,
8080
unique: ~Nil,
81-
fn_box: fn@() -> @nillist { @Nil::<()> },
81+
fn_box: || @Nil::<()>,
8282
tuple: (@Nil, ~Nil),
8383
vec: ~[@Nil],
8484
res: r(@Nil)
@@ -90,7 +90,7 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
9090
State {
9191
box: @Cons((), st.box),
9292
unique: ~Cons((), @*st.unique),
93-
fn_box: fn@() -> @nillist { @Cons((), fn_box()) },
93+
fn_box: || @Cons((), fn_box()),
9494
tuple: (@Cons((), st.tuple.first()),
9595
~Cons((), @*st.tuple.second())),
9696
vec: st.vec + ~[@Cons((), st.vec.last())],

branches/try2/src/test/bench/task-perf-linked-failure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn grandchild_group(num_tasks: uint) {
4646
// Master grandchild task exits early.
4747
}
4848

49-
fn spawn_supervised_blocking(myname: &str, +f: fn~()) {
49+
fn spawn_supervised_blocking(myname: &str, +f: ~fn()) {
5050
let mut res = None;
5151
task::task().future_result(|+r| res = Some(r)).supervised().spawn(f);
5252
error!("%s group waiting", myname);

branches/try2/src/test/compile-fail/assign-to-method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ fn cat(in_x : uint, in_y : int) -> cat {
2828

2929
fn main() {
3030
let nyan : cat = cat(52u, 99);
31-
nyan.speak = fn@() { debug!("meow"); }; //~ ERROR attempted to take value of method
31+
nyan.speak = || debug!("meow"); //~ ERROR attempted to take value of method
3232
}

branches/try2/src/test/compile-fail/borrowck-addr-of-upvar.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn foo(x: @int) -> fn@() -> &static/int {
12-
fn@() -> &static/int {&*x} //~ ERROR illegal borrow
11+
fn foo(x: @int) -> @fn() -> &static/int {
12+
let result: @fn() -> &static/int = || &*x; //~ ERROR illegal borrow
13+
result
1314
}
1415

15-
fn bar(x: @int) -> fn@() -> &int {
16-
fn@() -> &int {&*x} //~ ERROR illegal borrow
16+
fn bar(x: @int) -> @fn() -> &int {
17+
let result: @fn() -> &int = || &*x; //~ ERROR illegal borrow
18+
result
1719
}
1820

19-
fn zed(x: @int) -> fn@() -> int {
20-
fn@() -> int {*&*x}
21+
fn zed(x: @int) -> @fn() -> int {
22+
let result: @fn() -> int = || *&*x;
23+
result
2124
}
2225

2326
fn main() {

branches/try2/src/test/compile-fail/borrowck-call-sendfn.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010

1111
// xfail-test #2978
1212

13-
fn call(x: @{f: fn~()}) {
13+
struct Foo {
14+
f: ~fn()
15+
}
16+
17+
fn call(x: @Foo) {
1418
x.f(); //~ ERROR foo
1519
//~^ NOTE bar
1620
}

branches/try2/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn box_imm() {
2222

2323
let v = ~3;
2424
let _w = &v; //~ NOTE loan of immutable local variable granted here
25-
task::spawn(fn~() {
25+
task::spawn(|| {
2626
debug!("v=%d", *v);
2727
//~^ ERROR by-move capture of immutable local variable prohibited due to outstanding loan
2828
});

branches/try2/src/test/compile-fail/do2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn f(f: fn@(int) -> bool) -> bool { f(10i) }
11+
fn f(f: @fn(int) -> bool) -> bool { f(10i) }
1212

1313
fn main() {
1414
assert do f() |i| { i == 10i } == 10i;

branches/try2/src/test/compile-fail/fn-variance-2.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn reproduce<T:Copy>(t: T) -> fn@() -> T {
12-
fn@() -> T { t }
11+
fn reproduce<T:Copy>(t: T) -> @fn() -> T {
12+
let result: @fn() -> T = || t;
13+
result
1314
}
1415

1516
fn main() {
1617
// type of x is the variable X,
1718
// with the lower bound @mut int
1819
let x = @mut 3;
1920

20-
// type of r is fn@() -> X
21+
// type of r is @fn() -> X
2122
let r = reproduce(x);
2223

2324
// Requires that X be a subtype of

branches/try2/src/test/compile-fail/fn-variance-3.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn mk_identity<T:Copy>() -> fn@(T) -> T {
12-
fn@(t: T) -> T { t }
11+
fn mk_identity<T:Copy>() -> @fn(T) -> T {
12+
let result: @fn(t: T) -> T = |t| t;
13+
result
1314
}
1415

1516
fn main() {
16-
// type of r is fn@(X) -> X
17+
// type of r is @fn(X) -> X
1718
// for some fresh X
1819
let r = mk_identity();
1920

branches/try2/src/test/compile-fail/issue-1451.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
// xfail-test
12-
struct T { f: fn@() };
13-
struct S { f: fn@() };
12+
struct T { f: @fn() };
13+
struct S { f: @fn() };
1414

1515
fn fooS(t: S) {
1616
}
@@ -22,11 +22,11 @@ fn bar() {
2222
}
2323

2424
fn main() {
25-
let x: fn@() = bar;
25+
let x: @fn() = bar;
2626
fooS(S {f: x});
2727
fooS(S {f: bar});
2828

29-
let x: fn@() = bar;
29+
let x: @fn() = bar;
3030
fooT(T {f: x});
3131
fooT(T {f: bar});
3232
}

branches/try2/src/test/compile-fail/issue-1896-1.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
struct boxedFn { theFn: fn~() -> uint }
11+
struct boxedFn { theFn: ~fn() -> uint }
1212

1313
fn createClosure (closedUint: uint) -> boxedFn {
14-
boxedFn {theFn: fn@ () -> uint { closedUint }} //~ ERROR mismatched types
14+
let result: @fn() -> uint = || closedUint;
15+
boxedFn { theFn: result } //~ ERROR mismatched types
1516
}
1617

1718
fn main () {

0 commit comments

Comments
 (0)