diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-09-12 11:27:30 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-09-12 12:04:14 +0200 |
| commit | fc6b7c8b381bcb506eab0f50c69b6cc18aafacb2 (patch) | |
| tree | c3511313bdb6c7cc8919426ce980e558396fe92c /src/test | |
| parent | 64a6376da5ef6e40870af77410d3542ff7bab140 (diff) | |
| download | rust-fc6b7c8b381bcb506eab0f50c69b6cc18aafacb2.tar.gz rust-fc6b7c8b381bcb506eab0f50c69b6cc18aafacb2.zip | |
Reformat for new mode syntax, step 1
Long lines were fixed in a very crude way, as I'll be following up with another reformat in a bit.
Diffstat (limited to 'src/test')
104 files changed, 288 insertions, 294 deletions
diff --git a/src/test/bench/99bob-iter.rs b/src/test/bench/99bob-iter.rs index a1a3e1b984a..aa79590a246 100644 --- a/src/test/bench/99bob-iter.rs +++ b/src/test/bench/99bob-iter.rs @@ -22,7 +22,7 @@ fn b8() -> str { ret "Go to the store and buy some more, # of beer on the wall."; } -fn sub(t: &str, n: int) -> str { +fn sub(t: str, n: int) -> str { let b: str = ""; let i: uint = 0u; let ns: str; diff --git a/src/test/bench/99bob-simple.rs b/src/test/bench/99bob-simple.rs index ae1c30fb9ec..2db6321d257 100644 --- a/src/test/bench/99bob-simple.rs +++ b/src/test/bench/99bob-simple.rs @@ -22,7 +22,7 @@ fn b8() -> str { ret "Go to the store and buy some more, # of beer on the wall."; } -fn sub(t: &str, n: int) -> str { +fn sub(t: str, n: int) -> str { let b: str = ""; let i: uint = 0u; let ns: str; diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index 99b06a98416..2fbadc2461c 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -23,16 +23,16 @@ obj myrandom(mutable last: u32) { type aminoacids = {ch: char, prob: u32}; -fn make_cumulative(aa: &[aminoacids]) -> [aminoacids] { +fn make_cumulative(aa: [aminoacids]) -> [aminoacids] { let cp: u32 = 0u32; let ans: [aminoacids] = []; for a: aminoacids in aa { cp += a.prob; ans += [{ch: a.ch, prob: cp}]; } ret ans; } -fn select_random(r: u32, genelist: &[aminoacids]) -> char { +fn select_random(r: u32, genelist: [aminoacids]) -> char { if r < genelist[0].prob { ret genelist[0].ch; } - fn bisect(v: &[aminoacids], lo: uint, hi: uint, target: u32) -> char { + fn bisect(v: [aminoacids], lo: uint, hi: uint, target: u32) -> char { if hi > lo + 1u { let mid: uint = lo + (hi - lo) / 2u; if target < v[mid].prob { @@ -43,7 +43,7 @@ fn select_random(r: u32, genelist: &[aminoacids]) -> char { ret bisect(genelist, 0u, vec::len::<aminoacids>(genelist) - 1u, r); } -fn make_random_fasta(id: &str, desc: &str, genelist: &[aminoacids], n: int) { +fn make_random_fasta(id: str, desc: str, genelist: [aminoacids], n: int) { log ">" + id + " " + desc; let rng = myrandom(std::rand::mk_rng().next()); let op: str = ""; @@ -54,7 +54,7 @@ fn make_random_fasta(id: &str, desc: &str, genelist: &[aminoacids], n: int) { if str::byte_len(op) > 0u { log op; } } -fn make_repeat_fasta(id: &str, desc: &str, s: &str, n: int) { +fn make_repeat_fasta(id: str, desc: str, s: str, n: int) { log ">" + id + " " + desc; let op: str = ""; let sl: uint = str::byte_len(s); diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index 5e888041981..92da06f186a 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -56,7 +56,7 @@ mod NBodySystem { ret bodies; } - fn advance(bodies: &[Body::props], dt: float) { + fn advance(bodies: [Body::props], dt: float) { let i: int = 0; while i < 5 { @@ -70,7 +70,7 @@ mod NBodySystem { while i < 5 { move(bodies[i], dt); i += 1; } } - fn advance_one(bi: &Body::props, bj: &Body::props, dt: float) { + fn advance_one(bi: Body::props, bj: Body::props, dt: float) { let dx: float = bi.x - bj.x; let dy: float = bi.y - bj.y; let dz: float = bi.z - bj.z; @@ -89,13 +89,13 @@ mod NBodySystem { bj.vz += dz * bi.mass * mag; } - fn move(b: &Body::props, dt: float) { + fn move(b: Body::props, dt: float) { b.x += dt * b.vx; b.y += dt * b.vy; b.z += dt * b.vz; } - fn energy(bodies: &[Body::props]) -> float { + fn energy(bodies: [Body::props]) -> float { let dx: float; let dy: float; let dz: float; @@ -194,7 +194,7 @@ mod Body { mass: SOLAR_MASS}; } - fn offsetMomentum(props: &Body::props, px: float, py: float, pz: float) { + fn offsetMomentum(props: Body::props, px: float, py: float, pz: float) { props.vx = -px / SOLAR_MASS; props.vy = -py / SOLAR_MASS; props.vz = -pz / SOLAR_MASS; diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 9551aa6b982..1531a3f61b2 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -49,7 +49,7 @@ fn fib(n: int) -> int { type config = {stress: bool}; -fn parse_opts(argv: &[str]) -> config { +fn parse_opts(argv: [str]) -> config { let opts = [getopts::optflag("stress")]; let opt_args = vec::slice(argv, 1u, vec::len(argv)); diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index adb5040fa25..24df1508f9f 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -29,7 +29,7 @@ import std::comm::port; import std::comm::recv; import std::comm::send; -fn map(filename: &[u8], emit: &map_reduce::putter<[u8], int>) { +fn map(filename: [u8], emit: map_reduce::putter<[u8], int>) { let f = io::file_reader(str::unsafe_from_bytes(filename)); while true { @@ -40,7 +40,7 @@ fn map(filename: &[u8], emit: &map_reduce::putter<[u8], int>) { } } -fn reduce(word: &[u8], get: &map_reduce::getter<int>) { +fn reduce(word: [u8], get: map_reduce::getter<int>) { let count = 0; while true { alt get() { some(_) { count += 1; } none. { break } } } @@ -53,15 +53,15 @@ mod map_reduce { export reducer; export map_reduce; - type putter<~K, ~V> = fn(&K, &V); + type putter<~K, ~V> = fn(K, V); // FIXME: the first K1 parameter should probably be a -, but that // doesn't parse at the moment. - type mapper<~K1, ~K2, ~V> = fn(&K1, &putter<K2, V>); + type mapper<~K1, ~K2, ~V> = fn(K1, putter<K2, V>); type getter<~V> = fn() -> option<V>; - type reducer<~K, ~V> = fn(&K, &getter<V>); + type reducer<~K, ~V> = fn(K, getter<V>); tag ctrl_proto<~K, ~V> { find_reducer(K, chan<chan<reduce_proto<V>>>); @@ -72,7 +72,7 @@ mod map_reduce { fn start_mappers<~K1, ~K2, ~V>(map: mapper<K1, K2, V>, - ctrl: chan<ctrl_proto<K2, V>>, inputs: &[K1]) -> + ctrl: chan<ctrl_proto<K2, V>>, inputs: [K1]) -> [joinable_task] { let tasks = []; for i in inputs { @@ -89,8 +89,8 @@ mod map_reduce { let intermediates = treemap::init(); fn emit<~K2, - ~V>(im: &treemap::treemap<K2, chan<reduce_proto<V>>>, - ctrl: &chan<ctrl_proto<K2, V>>, key: &K2, val: &V) { + ~V>(im: treemap::treemap<K2, chan<reduce_proto<V>>>, + ctrl: chan<ctrl_proto<K2, V>>, key: K2, val: V) { let c; alt treemap::find(im, key) { some(_c) { c = _c } @@ -107,7 +107,7 @@ mod map_reduce { map(input, bind emit(intermediates, ctrl, _, _)); - fn finish<~K, ~V>(k: &K, v: &chan<reduce_proto<V>>) { + fn finish<~K, ~V>(k: K, v: chan<reduce_proto<V>>) { send(v, release); } treemap::traverse(intermediates, finish); @@ -124,7 +124,7 @@ mod map_reduce { let ref_count = 0; let is_done = false; - fn get<~V>(p: &port<reduce_proto<V>>, ref_count: &mutable int, + fn get<~V>(p: port<reduce_proto<V>>, ref_count: &mutable int, is_done: &mutable bool) -> option<V> { while !is_done || ref_count > 0 { alt recv(p) { @@ -148,7 +148,7 @@ mod map_reduce { fn map_reduce<~K1, ~K2, ~V>(map: mapper<K1, K2, V>, reduce: reducer<K2, V>, - inputs: &[K1]) { + inputs: [K1]) { let ctrl = port(); // This task becomes the master control task. It task::_spawns @@ -190,7 +190,7 @@ mod map_reduce { } } - fn finish<~K, ~V>(k: &K, v: &chan<reduce_proto<V>>) { send(v, done); } + fn finish<~K, ~V>(k: K, v: chan<reduce_proto<V>>) { send(v, done); } treemap::traverse(reducers, finish); for t in tasks { task::join(t); } diff --git a/src/test/bench/task-perf-word-count.rs b/src/test/bench/task-perf-word-count.rs index a90abd9e526..9ec856b9c47 100644 --- a/src/test/bench/task-perf-word-count.rs +++ b/src/test/bench/task-perf-word-count.rs @@ -29,7 +29,7 @@ import std::comm::port; import std::comm::recv; import std::comm::send; -fn map(filename: &str, emit: map_reduce::putter) { +fn map(filename: str, emit: map_reduce::putter) { let f = io::file_reader(filename); @@ -38,7 +38,7 @@ fn map(filename: &str, emit: map_reduce::putter) { } } -fn reduce(word: &str, get: map_reduce::getter) { +fn reduce(word: str, get: map_reduce::getter) { let count = 0; @@ -52,13 +52,13 @@ mod map_reduce { export reducer; export map_reduce; - type putter = fn(&str, int); + type putter = fn(str, int); - type mapper = fn(&str, putter); + type mapper = fn(str, putter); type getter = fn() -> option<int>; - type reducer = fn(&str, getter); + type reducer = fn(str, getter); tag ctrl_proto { find_reducer(str, chan<chan<reduce_proto>>); @@ -67,7 +67,7 @@ mod map_reduce { tag reduce_proto { emit_val(int); done; ref; release; } - fn start_mappers(ctrl: chan<ctrl_proto>, inputs: &[str]) -> + fn start_mappers(ctrl: chan<ctrl_proto>, inputs: [str]) -> [joinable_task] { let tasks = []; for i: str in inputs { @@ -76,12 +76,12 @@ mod map_reduce { ret tasks; } - fn map_task(ctrl: chan<ctrl_proto>, input: &str) { + fn map_task(ctrl: chan<ctrl_proto>, input: str) { // log_err "map_task " + input; let intermediates = map::new_str_hash(); - fn emit(im: &map::hashmap<str, chan<reduce_proto>>, - ctrl: chan<ctrl_proto>, key: &str, val: int) { + fn emit(im: map::hashmap<str, chan<reduce_proto>>, + ctrl: chan<ctrl_proto>, key: str, val: int) { let c; alt im.find(key) { some(_c) { @@ -109,7 +109,7 @@ mod map_reduce { send(ctrl, mapper_done); } - fn reduce_task(key: &str, out: chan<chan<reduce_proto>>) { + fn reduce_task(key: str, out: chan<chan<reduce_proto>>) { let p = port(); send(out, chan(p)); @@ -117,7 +117,7 @@ mod map_reduce { let ref_count = 0; let is_done = false; - fn get(p: &port<reduce_proto>, ref_count: &mutable int, + fn get(p: port<reduce_proto>, ref_count: &mutable int, is_done: &mutable bool) -> option<int> { while !is_done || ref_count > 0 { alt recv(p) { @@ -139,7 +139,7 @@ mod map_reduce { reduce(key, bind get(p, ref_count, is_done)); } - fn map_reduce(inputs: &[str]) { + fn map_reduce(inputs: [str]) { let ctrl = port::<ctrl_proto>(); // This task becomes the master control task. It task::_spawns diff --git a/src/test/compile-fail/block-coerce-no.rs b/src/test/compile-fail/block-coerce-no.rs index bb3e53028c2..37d56439c11 100644 --- a/src/test/compile-fail/block-coerce-no.rs +++ b/src/test/compile-fail/block-coerce-no.rs @@ -3,9 +3,9 @@ // Make sure that fn-to-block coercion isn't incorrectly lifted over // other tycons. -fn coerce(b: &block()) -> fn() { - fn lol(f: &fn(&block()) -> fn(), g: &block()) -> fn() { ret f(g); } - fn fn_id(f: &fn()) -> fn() { ret f } +fn coerce(b: block()) -> fn() { + fn lol(f: fn(block()) -> fn(), g: block()) -> fn() { ret f(g); } + fn fn_id(f: fn()) -> fn() { ret f } ret lol(fn_id, b); } diff --git a/src/test/compile-fail/block-copy.rs b/src/test/compile-fail/block-copy.rs index 76b05792f2f..f6819fee5c6 100644 --- a/src/test/compile-fail/block-copy.rs +++ b/src/test/compile-fail/block-copy.rs @@ -1,4 +1,4 @@ // error-pattern: mismatched kinds -fn lol(f: &block()) -> block() { ret f; } +fn lol(f: block()) -> block() { ret f; } fn main() { let i = 8; let f = lol(block () { log_err i; }); f(); } diff --git a/src/test/compile-fail/block-deinitializes-upvar.rs b/src/test/compile-fail/block-deinitializes-upvar.rs index bc1292021a9..72cd09b18ab 100644 --- a/src/test/compile-fail/block-deinitializes-upvar.rs +++ b/src/test/compile-fail/block-deinitializes-upvar.rs @@ -1,10 +1,10 @@ // error-pattern:Tried to deinitialize a variable declared in a different -fn force(f: &block() -> int) -> int { ret f(); } +fn force(f: block() -> int) -> int { ret f(); } fn main() { - let x = @{x:17, y:2}; - let y = @{x:5, y:5}; + let x = @{x: 17, y: 2}; + let y = @{x: 5, y: 5}; - let f = {|&i| log_err i; x <- y; ret 7; }; + let f = {|i| log_err i; x <- y; ret 7; }; assert (f(5) == 7); log_err x; log_err y; diff --git a/src/test/compile-fail/block-require-return.rs b/src/test/compile-fail/block-require-return.rs index f2796296da4..f7d895ac383 100644 --- a/src/test/compile-fail/block-require-return.rs +++ b/src/test/compile-fail/block-require-return.rs @@ -1,3 +1,3 @@ // error-pattern: not all control paths return -fn force(f: &block() -> int) -> int { f() } -fn main() { log_err force({ | | }); } +fn force(f: block() -> int) -> int { f() } +fn main() { log_err force({|| }); } diff --git a/src/test/compile-fail/block-uninit.rs b/src/test/compile-fail/block-uninit.rs index 9028d5fa435..7ad58e45a43 100644 --- a/src/test/compile-fail/block-uninit.rs +++ b/src/test/compile-fail/block-uninit.rs @@ -1,4 +1,4 @@ // error-pattern: Unsatisfied precondition constraint -fn force(f: &block()) { f(); } +fn force(f: block()) { f(); } fn main() { let x: int; force(block () { log_err x; }); } diff --git a/src/test/compile-fail/nested-ty-params.rs b/src/test/compile-fail/nested-ty-params.rs index 7a249c657fd..a78546e0412 100644 --- a/src/test/compile-fail/nested-ty-params.rs +++ b/src/test/compile-fail/nested-ty-params.rs @@ -1,6 +1,6 @@ // error-pattern:Attempt to use a type argument out of scope -fn hd<U>(v: &[U]) -> U { - fn hd1(w: &[U]) -> U { ret w[0]; } +fn hd<U>(v: [U]) -> U { + fn hd1(w: [U]) -> U { ret w[0]; } ret hd1(v); } diff --git a/src/test/compile-fail/not-a-pred-2.rs b/src/test/compile-fail/not-a-pred-2.rs index 2226c5cbf32..b1bfb15bff3 100644 --- a/src/test/compile-fail/not-a-pred-2.rs +++ b/src/test/compile-fail/not-a-pred-2.rs @@ -9,4 +9,5 @@ fn main() { + } diff --git a/src/test/compile-fail/type-arg-out-of-scope.rs b/src/test/compile-fail/type-arg-out-of-scope.rs index 19be0933c48..334cba2a271 100644 --- a/src/test/compile-fail/type-arg-out-of-scope.rs +++ b/src/test/compile-fail/type-arg-out-of-scope.rs @@ -1,5 +1,5 @@ // error-pattern:Attempt to use a type argument out of scope -fn foo<T>(x: &T) { - fn bar(f: fn(&T) -> T) { } +fn foo<T>(x: T) { + fn bar(f: fn(T) -> T) { } } fn main() { foo(1); } diff --git a/src/test/compile-fail/unsafe-alias.rs b/src/test/compile-fail/unsafe-alias.rs index 9b3e277a1fa..7038f6bdbb1 100644 --- a/src/test/compile-fail/unsafe-alias.rs +++ b/src/test/compile-fail/unsafe-alias.rs @@ -1,10 +1,8 @@ // error-pattern:may alias with argument -fn foo(x: &{mutable x: int}, f: fn()) { log x; } +fn foo(x: {mutable x: int}, f: fn()) { log x; } -fn whoknows(x: @mutable {mutable x: int}) { - *x = {mutable x: 10}; -} +fn whoknows(x: @mutable {mutable x: int}) { *x = {mutable x: 10}; } fn main() { let box = @mutable {mutable x: 1}; diff --git a/src/test/compile-fail/unsafe-mutable-alias.rs b/src/test/compile-fail/unsafe-mutable-alias.rs index c94fca11d5a..3fac666bad4 100644 --- a/src/test/compile-fail/unsafe-mutable-alias.rs +++ b/src/test/compile-fail/unsafe-mutable-alias.rs @@ -1,7 +1,8 @@ // error-pattern:mutable alias to a variable that roots another alias -fn f(a: &{mutable x: int}, b: &mutable {mutable x: int}) -> int { - b.x += 1; ret a.x + b.x; +fn f(a: {mutable x: int}, b: &mutable {mutable x: int}) -> int { + b.x += 1; + ret a.x + b.x; } fn main() { let i = {mutable x: 4}; log f(i, i); } diff --git a/src/test/compile-fail/writing-through-read-alias.rs b/src/test/compile-fail/writing-through-read-alias.rs index 9de010eca93..d4dec3c3f00 100644 --- a/src/test/compile-fail/writing-through-read-alias.rs +++ b/src/test/compile-fail/writing-through-read-alias.rs @@ -4,6 +4,6 @@ type point = {x: int, y: int, z: int}; -fn f(p: &point) { p.x = 13; } +fn f(p: point) { p.x = 13; } fn main() { let x: point = {x: 10, y: 11, z: 12}; f(x); } diff --git a/src/test/compiletest/compiletest.rs b/src/test/compiletest/compiletest.rs index c931369cfc7..6f0b853e6a9 100644 --- a/src/test/compiletest/compiletest.rs +++ b/src/test/compiletest/compiletest.rs @@ -27,7 +27,7 @@ fn main(args: [str]) { run_tests(config); } -fn parse_config(args: &[str]) -> config { +fn parse_config(args: [str]) -> config { let opts = [getopts::reqopt("compile-lib-path"), getopts::reqopt("run-lib-path"), getopts::reqopt("rustc-path"), getopts::reqopt("src-base"), @@ -61,7 +61,7 @@ fn parse_config(args: &[str]) -> config { verbose: getopts::opt_present(match, "verbose")}; } -fn log_config(config: &config) { +fn log_config(config: config) { let c = config; logv(c, #fmt["configuration:"]); logv(c, #fmt["compile_lib_path: %s", config.compile_lib_path]); @@ -83,11 +83,11 @@ fn opt_str(maybestr: option::t<str>) -> str { alt maybestr { option::some(s) { s } option::none. { "(none)" } } } -fn str_opt(maybestr: &str) -> option::t<str> { +fn str_opt(maybestr: str) -> option::t<str> { if maybestr != "(none)" { option::some(maybestr) } else { option::none } } -fn str_mode(s: &str) -> mode { +fn str_mode(s: str) -> mode { alt s { "compile-fail" { mode_compile_fail } "run-fail" { mode_run_fail } @@ -106,7 +106,7 @@ fn mode_str(mode: mode) -> str { } } -fn run_tests(config: &config) { +fn run_tests(config: config) { let opts = test_opts(config); let cx = {config: config, procsrv: procsrv::mk()}; let tests = make_tests(cx); @@ -114,7 +114,7 @@ fn run_tests(config: &config) { procsrv::close(cx.procsrv); } -fn test_opts(config: &config) -> test::test_opts { +fn test_opts(config: config) -> test::test_opts { {filter: alt config.filter { option::some(s) { option::some(s) } @@ -124,9 +124,9 @@ fn test_opts(config: &config) -> test::test_opts { } type tests_and_conv_fn = - {tests: [test::test_desc], to_task: fn(&fn()) -> test::joinable}; + {tests: [test::test_desc], to_task: fn(fn()) -> test::joinable}; -fn make_tests(cx: &cx) -> tests_and_conv_fn { +fn make_tests(cx: cx) -> tests_and_conv_fn { log #fmt["making tests from %s", cx.config.src_base]; let configport = port::<[u8]>(); let tests = []; @@ -140,7 +140,7 @@ fn make_tests(cx: &cx) -> tests_and_conv_fn { ret {tests: tests, to_task: bind closure_to_task(cx, configport, _)}; } -fn is_test(config: &config, testfile: &str) -> bool { +fn is_test(config: config, testfile: str) -> bool { // Pretty-printer does not work with .rc files yet let valid_extensions = alt config.mode { mode_pretty. { [".rs"] } _ { [".rc", ".rs"] } }; @@ -160,14 +160,14 @@ fn is_test(config: &config, testfile: &str) -> bool { ret valid; } -fn make_test(cx: &cx, testfile: &str, configport: &port<[u8]>) -> +fn make_test(cx: cx, testfile: str, configport: port<[u8]>) -> test::test_desc { {name: make_test_name(cx.config, testfile), fn: make_test_closure(testfile, chan(configport)), ignore: header::is_test_ignored(cx.config, testfile)} } -fn make_test_name(config: &config, testfile: &str) -> str { +fn make_test_name(config: config, testfile: str) -> str { #fmt["[%s] %s", mode_str(config.mode), testfile] } @@ -190,8 +190,7 @@ up. Then we'll spawn that data into another task and return the task. Really convoluted. Need to think up of a better definition for tests. */ -fn make_test_closure(testfile: &str, configchan: chan<[u8]>) -> - test::test_fn { +fn make_test_closure(testfile: str, configchan: chan<[u8]>) -> test::test_fn { bind send_config(testfile, configchan) } @@ -209,7 +208,7 @@ break up the config record and pass everything individually to the spawned function. */ -fn closure_to_task(cx: cx, configport: port<[u8]>, testfn: &fn()) -> +fn closure_to_task(cx: cx, configport: port<[u8]>, testfn: fn()) -> test::joinable { testfn(); let testfile = recv(configport); diff --git a/src/test/compiletest/header.rs b/src/test/compiletest/header.rs index 8a03378742b..9f896c48e74 100644 --- a/src/test/compiletest/header.rs +++ b/src/test/compiletest/header.rs @@ -23,7 +23,7 @@ type test_props = { }; // Load any test directives embedded in the file -fn load_props(testfile: &str) -> test_props { +fn load_props(testfile: str) -> test_props { let error_patterns = []; let compile_flags = option::none; let pp_exact = option::none; @@ -54,7 +54,7 @@ fn load_props(testfile: &str) -> test_props { }; } -fn is_test_ignored(config: &config, testfile: &str) -> bool { +fn is_test_ignored(config: config, testfile: str) -> bool { let found = false; for each ln: str in iter_header(testfile) { // FIXME: Can't return or break from iterator @@ -66,7 +66,7 @@ fn is_test_ignored(config: &config, testfile: &str) -> bool { ret found; } -iter iter_header(testfile: &str) -> str { +iter iter_header(testfile: str) -> str { let rdr = io::file_reader(testfile); while !rdr.eof() { let ln = rdr.read_line(); @@ -81,15 +81,15 @@ iter iter_header(testfile: &str) -> str { } } -fn parse_error_pattern(line: &str) -> option::t<str> { +fn parse_error_pattern(line: str) -> option::t<str> { parse_name_value_directive(line, "error-pattern") } -fn parse_compile_flags(line: &str) -> option::t<str> { +fn parse_compile_flags(line: str) -> option::t<str> { parse_name_value_directive(line, "compile-flags") } -fn parse_pp_exact(line: &str, testfile: &str) -> option::t<str> { +fn parse_pp_exact(line: str, testfile: str) -> option::t<str> { alt parse_name_value_directive(line, "pp-exact") { option::some(s) { option::some(s) } option::none. { @@ -102,12 +102,12 @@ fn parse_pp_exact(line: &str, testfile: &str) -> option::t<str> { } } -fn parse_name_directive(line: &str, directive: &str) -> bool { +fn parse_name_directive(line: str, directive: str) -> bool { str::find(line, directive) >= 0 } -fn parse_name_value_directive(line: &str, - directive: &str) -> option::t<str> { +fn parse_name_value_directive(line: str, + directive: str) -> option::t<str> { let keycolon = directive + ":"; if str::find(line, keycolon) >= 0 { let colon = str::find(line, keycolon) as uint; diff --git a/src/test/compiletest/procsrv.rs b/src/test/compiletest/procsrv.rs index 63a3807f6a5..ae98853976e 100644 --- a/src/test/compiletest/procsrv.rs +++ b/src/test/compiletest/procsrv.rs @@ -47,15 +47,15 @@ fn mk() -> handle { ret {task: option::some(task), chan: recv(setupport)}; } -fn from_chan(ch: &reqchan) -> handle { {task: option::none, chan: ch} } +fn from_chan(ch: reqchan) -> handle { {task: option::none, chan: ch} } -fn close(handle: &handle) { +fn close(handle: handle) { send(handle.chan, stop); task::join(option::get(handle.task)); } -fn run(handle: &handle, lib_path: &str, prog: &str, args: &[str], - input: &option::t<str>) -> {status: int, out: str, err: str} { +fn run(handle: handle, lib_path: str, prog: str, args: [str], + input: option::t<str>) -> {status: int, out: str, err: str} { let p = port(); let ch = chan(p); send(handle.chan, @@ -70,7 +70,7 @@ fn run(handle: &handle, lib_path: &str, prog: &str, args: &[str], ret {status: status, out: output, err: errput}; } -fn writeclose(fd: int, s: &option::t<str>) { +fn writeclose(fd: int, s: option::t<str>) { if option::is_some(s) { let writer = io::new_writer(io::fd_buf_writer(fd, option::none)); writer.write_str(option::get(s)); @@ -151,7 +151,7 @@ fn worker(p: port<request>) { } } -fn with_lib_path<@T>(path: &str, f: fn() -> T) -> T { +fn with_lib_path<@T>(path: str, f: fn() -> T) -> T { let maybe_oldpath = getenv(util::lib_path_env_var()); append_lib_path(path); let res = f(); @@ -164,17 +164,17 @@ fn with_lib_path<@T>(path: &str, f: fn() -> T) -> T { ret res; } -fn append_lib_path(path: &str) { export_lib_path(util::make_new_path(path)); } +fn append_lib_path(path: str) { export_lib_path(util::make_new_path(path)); } -fn export_lib_path(path: &str) { setenv(util::lib_path_env_var(), path); } +fn export_lib_path(path: str) { setenv(util::lib_path_env_var(), path); } -fn clone_vecstr(v: &[str]) -> [[u8]] { +fn clone_vecstr(v: [str]) -> [[u8]] { let r = []; for t: str in vec::slice(v, 0u, vec::len(v)) { r += [str::bytes(t)]; } ret r; } -fn clone_vecu8str(v: &[[u8]]) -> [str] { +fn clone_vecu8str(v: [[u8]]) -> [str] { let r = []; for t in vec::slice(v, 0u, vec::len(v)) { r += [str::unsafe_from_bytes(t)]; diff --git a/src/test/compiletest/runtest.rs b/src/test/compiletest/runtest.rs index 87ae7750e03..a715985b2cd 100644 --- a/src/test/compiletest/runtest.rs +++ b/src/test/compiletest/runtest.rs @@ -18,7 +18,7 @@ import util::logv; export run; -fn run(cx: &cx, _testfile: -[u8]) { +fn run(cx: cx, _testfile: -[u8]) { let testfile = str::unsafe_from_bytes(_testfile); if cx.config.verbose { // We're going to be dumping a lot of info. Start on a new line. @@ -34,7 +34,7 @@ fn run(cx: &cx, _testfile: -[u8]) { } } -fn run_cfail_test(cx: &cx, props: &test_props, testfile: &str) { +fn run_cfail_test(cx: cx, props: test_props, testfile: str) { let procres = compile_test(cx, props, testfile); if procres.status == 0 { @@ -44,7 +44,7 @@ fn run_cfail_test(cx: &cx, props: &test_props, testfile: &str) { check_error_patterns(props, testfile, procres); } -fn run_rfail_test(cx: &cx, props: &test_props, testfile: &str) { +fn run_rfail_test(cx: cx, props: test_props, testfile: str) { let procres = compile_test(cx, props, testfile); if procres.status != 0 { fatal_procres("compilation failed!", procres); } @@ -67,7 +67,7 @@ fn run_rfail_test(cx: &cx, props: &test_props, testfile: &str) { check_error_patterns(props, testfile, procres); } -fn run_rpass_test(cx: &cx, props: &test_props, testfile: &str) { +fn run_rpass_test(cx: cx, props: test_props, testfile: str) { let procres = compile_test(cx, props, testfile); if procres.status != 0 { fatal_procres("compilation failed!", procres); } @@ -78,7 +78,7 @@ fn run_rpass_test(cx: &cx, props: &test_props, testfile: &str) { if procres.status != 0 { fatal_procres("test run failed!", procres); } } -fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) { +fn run_pretty_test(cx: cx, props: test_props, testfile: str) { if option::is_some(props.pp_exact) { logv(cx.config, "testing for exact pretty-printing"); } else { logv(cx.config, "testing for converging pretty-printing"); } @@ -131,18 +131,18 @@ fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) { ret; - fn print_source(cx: &cx, testfile: &str, src: &str) -> procres { + fn print_source(cx: cx, testfile: str, src: str) -> procres { compose_and_run(cx, testfile, make_pp_args, cx.config.compile_lib_path, option::some(src)) } - fn make_pp_args(config: &config, _testfile: &str) -> procargs { + fn make_pp_args(config: config, _testfile: str) -> procargs { let prog = config.rustc_path; let args = ["-", "--pretty", "normal"]; ret {prog: prog, args: args}; } - fn compare_source(expected: &str, actual: &str) { + fn compare_source(expected: str, actual: str) { if expected != actual { error("pretty-printed source does match expected source"); let msg = @@ -162,20 +162,19 @@ actual:\n\ } } - fn typecheck_source(cx: &cx, testfile: &str, src: &str) -> procres { + fn typecheck_source(cx: cx, testfile: str, src: str) -> procres { compose_and_run(cx, testfile, make_typecheck_args, cx.config.compile_lib_path, option::some(src)) } - fn make_typecheck_args(config: &config, _testfile: &str) -> procargs { + fn make_typecheck_args(config: config, _testfile: str) -> procargs { let prog = config.rustc_path; let args = ["-", "--no-trans", "--lib"]; ret {prog: prog, args: args}; } } -fn check_error_patterns(props: &test_props, testfile: &str, - procres: &procres) { +fn check_error_patterns(props: test_props, testfile: str, procres: procres) { if vec::is_empty(props.error_patterns) { fatal("no error pattern specified in " + testfile); } @@ -216,26 +215,25 @@ type procargs = {prog: str, args: [str]}; type procres = {status: int, stdout: str, stderr: str, cmdline: str}; -fn compile_test(cx: &cx, props: &test_props, testfile: &str) -> procres { +fn compile_test(cx: cx, props: test_props, testfile: str) -> procres { compose_and_run(cx, testfile, bind make_compile_args(_, props, _), cx.config.compile_lib_path, option::none) } -fn exec_compiled_test(cx: &cx, props: &test_props, testfile: &str) -> - procres { +fn exec_compiled_test(cx: cx, props: test_props, testfile: str) -> procres { compose_and_run(cx, testfile, bind make_run_args(_, props, _), cx.config.run_lib_path, option::none) } -fn compose_and_run(cx: &cx, testfile: &str, - make_args: fn(&config, &str) -> procargs, lib_path: &str, +fn compose_and_run(cx: cx, testfile: str, + make_args: fn(config, str) -> procargs, lib_path: str, input: option::t<str>) -> procres { let procargs = make_args(cx.config, testfile); ret program_output(cx, testfile, lib_path, procargs.prog, procargs.args, input); } -fn make_compile_args(config: &config, props: &test_props, testfile: &str) -> +fn make_compile_args(config: config, props: test_props, testfile: str) -> procargs { let prog = config.rustc_path; let args = [testfile, "-o", make_exe_name(config, testfile)]; @@ -249,11 +247,11 @@ fn make_compile_args(config: &config, props: &test_props, testfile: &str) -> ret {prog: prog, args: args}; } -fn make_exe_name(config: &config, testfile: &str) -> str { +fn make_exe_name(config: config, testfile: str) -> str { output_base_name(config, testfile) + os::exec_suffix() } -fn make_run_args(config: &config, props: &test_props, testfile: &str) -> +fn make_run_args(config: config, props: test_props, testfile: str) -> procargs { let toolargs = if !props.no_valgrind { @@ -271,14 +269,14 @@ fn make_run_args(config: &config, props: &test_props, testfile: &str) -> ret {prog: args[0], args: vec::slice(args, 1u, vec::len(args))}; } -fn split_maybe_args(argstr: &option::t<str>) -> [str] { - fn rm_whitespace(v: &[str]) -> [str] { - fn flt(s: &str) -> option::t<str> { +fn split_maybe_args(argstr: option::t<str>) -> [str] { + fn rm_whitespace(v: [str]) -> [str] { + fn flt(s: str) -> option::t<str> { if !is_whitespace(s) { option::some(s) } else { option::none } } // FIXME: This should be in std - fn is_whitespace(s: &str) -> bool { + fn is_whitespace(s: str) -> bool { for c: u8 in s { if c != ' ' as u8 { ret false; } } ret true; } @@ -291,8 +289,8 @@ fn split_maybe_args(argstr: &option::t<str>) -> [str] { } } -fn program_output(cx: &cx, testfile: &str, lib_path: &str, prog: &str, - args: &[str], input: option::t<str>) -> procres { +fn program_output(cx: cx, testfile: str, lib_path: str, prog: str, + args: [str], input: option::t<str>) -> procres { let cmdline = { let cmdline = make_cmdline(lib_path, prog, args); @@ -307,18 +305,18 @@ fn program_output(cx: &cx, testfile: &str, lib_path: &str, prog: &str, cmdline: cmdline}; } -fn make_cmdline(libpath: &str, prog: &str, args: &[str]) -> str { +fn make_cmdline(libpath: str, prog: str, args: [str]) -> str { #fmt["%s %s %s", lib_path_cmd_prefix(libpath), prog, str::connect(args, " ")] } // Build the LD_LIBRARY_PATH variable as it would be seen on the command line // for diagnostic purposes -fn lib_path_cmd_prefix(path: &str) -> str { +fn lib_path_cmd_prefix(path: str) -> str { #fmt["%s=\"%s\"", util::lib_path_env_var(), util::make_new_path(path)] } -fn dump_output(config: &config, testfile: &str, out: &str, err: &str) { +fn dump_output(config: config, testfile: str, out: str, err: str) { dump_output_file(config, testfile, out, "out"); dump_output_file(config, testfile, err, "err"); maybe_dump_to_stdout(config, out, err); @@ -326,8 +324,7 @@ fn dump_output(config: &config, testfile: &str, out: &str, err: &str) { #[cfg(target_os = "win32")] #[cfg(target_os = "linux")] -fn dump_output_file(config: &config, testfile: &str, out: &str, - extension: &str) { +fn dump_output_file(config: config, testfile: str, out: str, extension: str) { let outfile = make_out_name(config, testfile, extension); let writer = io::file_writer(outfile, [io::create, io::truncate]); writer.write_str(out); @@ -335,15 +332,14 @@ fn dump_output_file(config: &config, testfile: &str, out: &str, // FIXME (726): Can't use file_writer on mac #[cfg(target_os = "macos")] -fn dump_output_file(config: &config, testfile: &str, out: &str, - extension: &str) { +fn dump_output_file(config: config, testfile: str, out: str, extension: str) { } -fn make_out_name(config: &config, testfile: &str, extension: &str) -> str { +fn make_out_name(config: config, testfile: str, extension: str) -> str { output_base_name(config, testfile) + "." + extension } -fn output_base_name(config: &config, testfile: &str) -> str { +fn output_base_name(config: config, testfile: str) -> str { let base = config.build_base; let filename = { @@ -354,7 +350,7 @@ fn output_base_name(config: &config, testfile: &str) -> str { #fmt["%s%s.%s", base, filename, config.stage_id] } -fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) { +fn maybe_dump_to_stdout(config: config, out: str, err: str) { if config.verbose { let sep1 = #fmt["------%s------------------------------", "stdout"]; let sep2 = #fmt["------%s------------------------------", "stderr"]; @@ -367,11 +363,11 @@ fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) { } } -fn error(err: &str) { io::stdout().write_line(#fmt["\nerror: %s", err]); } +fn error(err: str) { io::stdout().write_line(#fmt["\nerror: %s", err]); } -fn fatal(err: &str) -> ! { error(err); fail; } +fn fatal(err: str) -> ! { error(err); fail; } -fn fatal_procres(err: &str, procres: procres) -> ! { +fn fatal_procres(err: str, procres: procres) -> ! { let msg = #fmt["\n\ error: %s\n\ diff --git a/src/test/compiletest/util.rs b/src/test/compiletest/util.rs index 769b409ea43..855aeb26e99 100644 --- a/src/test/compiletest/util.rs +++ b/src/test/compiletest/util.rs @@ -5,7 +5,7 @@ import std::str; import common::config; -fn make_new_path(path: &str) -> str { +fn make_new_path(path: str) -> str { // Windows just uses PATH as the library search path, so we have to // maintain the current value while adding our own @@ -24,7 +24,7 @@ fn lib_path_env_var() -> str { "DYLD_LIBRARY_PATH" } #[cfg(target_os = "win32")] fn lib_path_env_var() -> str { "PATH" } -fn logv(config: &config, s: &str) { +fn logv(config: config, s: str) { log s; if config.verbose { io::stdout().write_line(s); } } diff --git a/src/test/run-fail/port-type.rs b/src/test/run-fail/port-type.rs index 65b15b56d72..75474a17a75 100644 --- a/src/test/run-fail/port-type.rs +++ b/src/test/run-fail/port-type.rs @@ -5,7 +5,7 @@ import std::comm::port; import std::comm::send; import std::comm::recv; -fn echo<~T>(c: &chan<T>, oc: &chan<chan<T>>) { +fn echo<~T>(c: chan<T>, oc: chan<chan<T>>) { // Tests that the type argument in port gets // visited let p = port::<T>(); diff --git a/src/test/run-pass/alias-uninit-value.rs b/src/test/run-pass/alias-uninit-value.rs index 22a14dc3e50..9b7e0001f3c 100644 --- a/src/test/run-pass/alias-uninit-value.rs +++ b/src/test/run-pass/alias-uninit-value.rs @@ -9,7 +9,7 @@ tag sty { ty_nil; } type raw_t = {struct: sty, cname: option::t<str>, hash: uint}; -fn mk_raw_ty(st: sty, cname: &option::t<str>) -> raw_t { +fn mk_raw_ty(st: sty, cname: option::t<str>) -> raw_t { ret {struct: st, cname: cname, hash: 0u}; } diff --git a/src/test/run-pass/alt-join.rs b/src/test/run-pass/alt-join.rs index 4d1be53cdf3..e6cf1dec958 100644 --- a/src/test/run-pass/alt-join.rs +++ b/src/test/run-pass/alt-join.rs @@ -5,7 +5,7 @@ import std::option::t; import std::option::none; import std::option::some; -fn foo<T>(y: &option::t<T>) { +fn foo<T>(y: option::t<T>) { let x: int; let rs: [int] = []; /* tests that x doesn't get put in the precondition for the diff --git a/src/test/run-pass/argument-passing.rs b/src/test/run-pass/argument-passing.rs index 1e4ca8e9dff..32ce6ed6ef9 100644 --- a/src/test/run-pass/argument-passing.rs +++ b/src/test/run-pass/argument-passing.rs @@ -6,13 +6,13 @@ fn f1(a: {mutable x: int}, b: &mutable int, c: -int) -> int { ret r; } -fn f2(a: int, f: block(x: int)) -> int { f(1); ret a; } +fn f2(a: int, f: block(int)) -> int { f(1); ret a; } fn main() { let a = {mutable x: 1}, b = 2, c = 3; assert (f1(a, b, c) == 6); assert (a.x == 0); assert (b == 10); - assert (f2(a.x, {| x | a.x = 50; }) == 0); + assert (f2(a.x, {|x| a.x = 50; }) == 0); assert (a.x == 50); } diff --git a/src/test/run-pass/auto-instantiate.rs b/src/test/run-pass/auto-instantiate.rs index e06da60789c..8def06bfe98 100644 --- a/src/test/run-pass/auto-instantiate.rs +++ b/src/test/run-pass/auto-instantiate.rs @@ -2,6 +2,6 @@ // -*- rust -*- -fn f<@T, @U>(x: &T, y: &U) -> {a: T, b: U} { ret {a: x, b: y}; } +fn f<@T, @U>(x: T, y: U) -> {a: T, b: U} { ret {a: x, b: y}; } fn main() { log f({x: 3, y: 4, z: 5}, 4).a.x; log f(5, 6).a; } diff --git a/src/test/run-pass/autobind.rs b/src/test/run-pass/autobind.rs index ebf2bd432d4..29a8527e6f3 100644 --- a/src/test/run-pass/autobind.rs +++ b/src/test/run-pass/autobind.rs @@ -1,9 +1,9 @@ -fn f<@T>(x: &[T]) -> T { ret x[0]; } +fn f<@T>(x: [T]) -> T { ret x[0]; } -fn g(act: fn(&[int]) -> int) -> int { ret act([1, 2, 3]); } +fn g(act: fn([int]) -> int) -> int { ret act([1, 2, 3]); } fn main() { assert (g(f) == 1); - let f1: fn(&[str]) -> str = f; + let f1: fn([str]) -> str = f; assert (f1(["x", "y", "z"]) == "x"); } diff --git a/src/test/run-pass/bind-parameterized-args-2.rs b/src/test/run-pass/bind-parameterized-args-2.rs index 68d47073413..266ad2ddbed 100644 --- a/src/test/run-pass/bind-parameterized-args-2.rs +++ b/src/test/run-pass/bind-parameterized-args-2.rs @@ -1,7 +1,7 @@ fn main() { - fn echo<T>(c: int, x: fn(&T)) { log_err "wee"; } + fn echo<T>(c: int, x: fn(T)) { log_err "wee"; } let y = bind echo(42, _); - y(fn (i: &str) { }); + y(fn (i: str) { }); } diff --git a/src/test/run-pass/bind-parameterized-args.rs b/src/test/run-pass/bind-parameterized-args.rs index 1f3e8efbf37..d1feb5ac91d 100644 --- a/src/test/run-pass/bind-parameterized-args.rs +++ b/src/test/run-pass/bind-parameterized-args.rs @@ -1,7 +1,7 @@ fn main() { - fn echo<T>(c: int, x: &[T]) { } + fn echo<T>(c: int, x: [T]) { } - let y: fn(&[int]) = bind echo(42, _); + let y: fn([int]) = bind echo(42, _); y([1]); } diff --git a/src/test/run-pass/block-fn-coerce.rs b/src/test/run-pass/block-fn-coerce.rs index 163d99ee5d6..7e70c9d633a 100644 --- a/src/test/run-pass/block-fn-coerce.rs +++ b/src/test/run-pass/block-fn-coerce.rs @@ -1,4 +1,4 @@ -fn force(f: &block() -> int) -> int { ret f(); } +fn force(f: block() -> int) -> int { ret f(); } fn main() { let f = fn () -> int { ret 7 }; assert (force(f) == 7); diff --git a/src/test/run-pass/block-iter-1.rs b/src/test/run-pass/block-iter-1.rs index 006d4f18fe4..7b10e124c64 100644 --- a/src/test/run-pass/block-iter-1.rs +++ b/src/test/run-pass/block-iter-1.rs @@ -1,10 +1,9 @@ -fn iter_vec<T>(v: &[T], f: &block(&T)) { for x: T in v { f(x); } } +fn iter_vec<T>(v: [T], f: block(T)) { for x: T in v { f(x); } } fn main() { let v = [1, 2, 3, 4, 5, 6, 7]; let odds = 0; - iter_vec(v, - {|&i| log_err i; if i % 2 == 1 { odds += 1; } log_err odds; }); + iter_vec(v, {|i| log_err i; if i % 2 == 1 { odds += 1; } log_err odds; }); log_err odds; assert (odds == 4); } diff --git a/src/test/run-pass/block-iter-2.rs b/src/test/run-pass/block-iter-2.rs index d49cffbcc72..f80cd270440 100644 --- a/src/test/run-pass/block-iter-2.rs +++ b/src/test/run-pass/block-iter-2.rs @@ -1,9 +1,9 @@ -fn iter_vec<T>(v: &[T], f: &block(&T)) { for x: T in v { f(x); } } +fn iter_vec<T>(v: [T], f: block(T)) { for x: T in v { f(x); } } fn main() { let v = [1, 2, 3, 4, 5]; let sum = 0; - iter_vec(v, {|&i| iter_vec(v, {|&j| log_err i * j; sum += i * j; }); }); + iter_vec(v, {|i| iter_vec(v, {|j| log_err i * j; sum += i * j; }); }); log_err sum; assert (sum == 225); } diff --git a/src/test/run-pass/block-vec-map2.rs b/src/test/run-pass/block-vec-map2.rs index 35b979b3694..da677abebac 100644 --- a/src/test/run-pass/block-vec-map2.rs +++ b/src/test/run-pass/block-vec-map2.rs @@ -3,7 +3,7 @@ import std::vec; fn main() { let v = - std::vec::map2({|&i, &b| if b { -i } else { i } }, [1, 2, 3, 4, 5], + std::vec::map2({|i, b| if b { -i } else { i } }, [1, 2, 3, 4, 5], [true, false, false, true, true]); log_err v; assert (v == [-1, 2, 3, -4, -5]); diff --git a/src/test/run-pass/box-unbox.rs b/src/test/run-pass/box-unbox.rs index 08633a572a3..54558d1785a 100644 --- a/src/test/run-pass/box-unbox.rs +++ b/src/test/run-pass/box-unbox.rs @@ -2,7 +2,7 @@ type box<T> = {c: @T}; -fn unbox<@T>(b: &box<T>) -> T { ret *b.c; } +fn unbox<@T>(b: box<T>) -> T { ret *b.c; } fn main() { let foo: int = 17; diff --git a/src/test/run-pass/double-unbox.rs b/src/test/run-pass/double-unbox.rs index aacfbb91509..827dbb908b4 100644 --- a/src/test/run-pass/double-unbox.rs +++ b/src/test/run-pass/double-unbox.rs @@ -1,6 +1,6 @@ type quux = {bar: int}; -fn g(i: &int) { } +fn g(i: int) { } fn f(foo: @@quux) { g(foo.bar); } fn main() { } diff --git a/src/test/run-pass/drop-parametric-closure-with-bound-box.rs b/src/test/run-pass/drop-parametric-closure-with-bound-box.rs index f24cf65e70e..ce270d7b06b 100644 --- a/src/test/run-pass/drop-parametric-closure-with-bound-box.rs +++ b/src/test/run-pass/drop-parametric-closure-with-bound-box.rs @@ -1,5 +1,5 @@ -fn f<T>(i: @int, t: &T) { } +fn f<T>(i: @int, t: T) { } fn main() { let x = bind f::<char>(@0xdeafbeef, _); } diff --git a/src/test/run-pass/expr-alt-generic-box1.rs b/src/test/run-pass/expr-alt-generic-box1.rs index 763f303bbd6..ce11b0a990e 100644 --- a/src/test/run-pass/expr-alt-generic-box1.rs +++ b/src/test/run-pass/expr-alt-generic-box1.rs @@ -4,7 +4,7 @@ // -*- rust -*- type compare<T> = fn(@T, @T) -> bool; -fn test_generic<T>(expected: @T, eq: &compare<T>) { +fn test_generic<T>(expected: @T, eq: compare<T>) { let actual: @T = alt true { true { expected } }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-box2.rs b/src/test/run-pass/expr-alt-generic-box2.rs index 046d77cd438..ec67c72ae0d 100644 --- a/src/test/run-pass/expr-alt-generic-box2.rs +++ b/src/test/run-pass/expr-alt-generic-box2.rs @@ -2,15 +2,15 @@ // -*- rust -*- -type compare<T> = fn(&T, &T) -> bool; +type compare<T> = fn(T, T) -> bool; -fn test_generic<T>(expected: &T, eq: &compare<T>) { +fn test_generic<T>(expected: T, eq: compare<T>) { let actual: T = alt true { true { expected } }; assert (eq(expected, actual)); } fn test_vec() { - fn compare_box(v1: &@int, v2: &@int) -> bool { ret v1 == v2; } + fn compare_box(v1: @int, v2: @int) -> bool { ret v1 == v2; } let eq = bind compare_box(_, _); test_generic::<@int>(@1, eq); } diff --git a/src/test/run-pass/expr-alt-generic.rs b/src/test/run-pass/expr-alt-generic.rs index c9990a0c756..d42e669b9ed 100644 --- a/src/test/run-pass/expr-alt-generic.rs +++ b/src/test/run-pass/expr-alt-generic.rs @@ -2,15 +2,15 @@ // -*- rust -*- -type compare<T> = fn(&T, &T) -> bool; +type compare<T> = fn(T, T) -> bool; -fn test_generic<T>(expected: &T, eq: &compare<T>) { +fn test_generic<T>(expected: T, eq: compare<T>) { let actual: T = alt true { true { expected } }; assert (eq(expected, actual)); } fn test_bool() { - fn compare_bool(b1: &bool, b2: &bool) -> bool { ret b1 == b2; } + fn compare_bool(b1: bool, b2: bool) -> bool { ret b1 == b2; } let eq = bind compare_bool(_, _); test_generic::<bool>(true, eq); } @@ -18,7 +18,7 @@ fn test_bool() { fn test_rec() { type t = {a: int, b: int}; - fn compare_rec(t1: &t, t2: &t) -> bool { ret t1 == t2; } + fn compare_rec(t1: t, t2: t) -> bool { ret t1 == t2; } let eq = bind compare_rec(_, _); test_generic::<t>({a: 1, b: 2}, eq); } diff --git a/src/test/run-pass/expr-block-generic-box1.rs b/src/test/run-pass/expr-block-generic-box1.rs index 5ab310cb309..28e5de3a830 100644 --- a/src/test/run-pass/expr-block-generic-box1.rs +++ b/src/test/run-pass/expr-block-generic-box1.rs @@ -4,7 +4,7 @@ // -*- rust -*- type compare<T> = fn(@T, @T) -> bool; -fn test_generic<T>(expected: @T, eq: &compare<T>) { +fn test_generic<T>(expected: @T, eq: compare<T>) { let actual: @T = { expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-block-generic-box2.rs b/src/test/run-pass/expr-block-generic-box2.rs index 3f8293490f3..e51e30525e0 100644 --- a/src/test/run-pass/expr-block-generic-box2.rs +++ b/src/test/run-pass/expr-block-generic-box2.rs @@ -2,15 +2,15 @@ // -*- rust -*- -type compare<T> = fn(&T, &T) -> bool; +type compare<T> = fn(T, T) -> bool; -fn test_generic<T>(expected: &T, eq: &compare<T>) { +fn test_generic<T>(expected: T, eq: compare<T>) { let actual: T = { expected }; assert (eq(expected, actual)); } fn test_vec() { - fn compare_vec(v1: &@int, v2: &@int) -> bool { ret v1 == v2; } + fn compare_vec(v1: @int, v2: @int) -> bool { ret v1 == v2; } let eq = bind compare_vec(_, _); test_generic::<@int>(@1, eq); } diff --git a/src/test/run-pass/expr-block-generic.rs b/src/test/run-pass/expr-block-generic.rs index 52d463eae2a..48e4a9dff20 100644 --- a/src/test/run-pass/expr-block-generic.rs +++ b/src/test/run-pass/expr-block-generic.rs @@ -4,15 +4,15 @@ // -*- rust -*- // Tests for standalone blocks as expressions with dynamic type sizes -type compare<T> = fn(&T, &T) -> bool; +type compare<T> = fn(T, T) -> bool; -fn test_generic<T>(expected: &T, eq: &compare<T>) { +fn test_generic<T>(expected: T, eq: compare<T>) { let actual: T = { expected }; assert (eq(expected, actual)); } fn test_bool() { - fn compare_bool(b1: &bool, b2: &bool) -> bool { ret b1 == b2; } + fn compare_bool(b1: bool, b2: bool) -> bool { ret b1 == b2; } let eq = bind compare_bool(_, _); test_generic::<bool>(true, eq); } @@ -20,7 +20,7 @@ fn test_bool() { fn test_rec() { type t = {a: int, b: int}; - fn compare_rec(t1: &t, t2: &t) -> bool { ret t1 == t2; } + fn compare_rec(t1: t, t2: t) -> bool { ret t1 == t2; } let eq = bind compare_rec(_, _); test_generic::<t>({a: 1, b: 2}, eq); } diff --git a/src/test/run-pass/expr-fn.rs b/src/test/run-pass/expr-fn.rs index b7070ead5ed..30ba5fa79e4 100644 --- a/src/test/run-pass/expr-fn.rs +++ b/src/test/run-pass/expr-fn.rs @@ -9,7 +9,7 @@ fn test_vec() { } fn test_generic() { - fn f<T>(t: &T) -> T { t } + fn f<T>(t: T) -> T { t } assert (f(10) == 10); } diff --git a/src/test/run-pass/expr-if-generic-box1.rs b/src/test/run-pass/expr-if-generic-box1.rs index 6d69cce9a1b..4b23d1a6e3f 100644 --- a/src/test/run-pass/expr-if-generic-box1.rs +++ b/src/test/run-pass/expr-if-generic-box1.rs @@ -4,7 +4,7 @@ // -*- rust -*- type compare<T> = fn(@T, @T) -> bool; -fn test_generic<T>(expected: @T, not_expected: @T, eq: &compare<T>) { +fn test_generic<T>(expected: @T, not_expected: @T, eq: compare<T>) { let actual: @T = if true { expected } else { not_expected }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-if-generic-box2.rs b/src/test/run-pass/expr-if-generic-box2.rs index b31fb91f229..fd56d79dab9 100644 --- a/src/test/run-pass/expr-if-generic-box2.rs +++ b/src/test/run-pass/expr-if-generic-box2.rs @@ -2,15 +2,15 @@ // -*- rust -*- -type compare<T> = fn(&T, &T) -> bool; +type compare<T> = fn(T, T) -> bool; -fn test_generic<T>(expected: &T, not_expected: &T, eq: &compare<T>) { +fn test_generic<T>(expected: T, not_expected: T, eq: compare<T>) { let actual: T = if true { expected } else { not_expected }; assert (eq(expected, actual)); } fn test_vec() { - fn compare_box(v1: &@int, v2: &@int) -> bool { ret v1 == v2; } + fn compare_box(v1: @int, v2: @int) -> bool { ret v1 == v2; } let eq = bind compare_box(_, _); test_generic::<@int>(@1, @2, eq); } diff --git a/src/test/run-pass/expr-if-generic.rs b/src/test/run-pass/expr-if-generic.rs index 99709ea396c..154290319c1 100644 --- a/src/test/run-pass/expr-if-generic.rs +++ b/src/test/run-pass/expr-if-generic.rs @@ -4,15 +4,15 @@ // -*- rust -*- // Tests for if as expressions with dynamic type sizes -type compare<T> = fn(&T, &T) -> bool; +type compare<T> = fn(T, T) -> bool; -fn test_generic<T>(expected: &T, not_expected: &T, eq: &compare<T>) { +fn test_generic<T>(expected: T, not_expected: T, eq: compare<T>) { let actual: T = if true { expected } else { not_expected }; assert (eq(expected, actual)); } fn test_bool() { - fn compare_bool(b1: &bool, b2: &bool) -> bool { ret b1 == b2; } + fn compare_bool(b1: bool, b2: bool) -> bool { ret b1 == b2; } let eq = bind compare_bool(_, _); test_generic::<bool>(true, false, eq); } @@ -20,7 +20,7 @@ fn test_bool() { fn test_rec() { type t = {a: int, b: int}; - fn compare_rec(t1: &t, t2: &t) -> bool { ret t1 == t2; } + fn compare_rec(t1: t, t2: t) -> bool { ret t1 == t2; } let eq = bind compare_rec(_, _); test_generic::<t>({a: 1, b: 2}, {a: 2, b: 3}, eq); } diff --git a/src/test/run-pass/fixed-point-bind-box.rs b/src/test/run-pass/fixed-point-bind-box.rs index 57dcc98b2a8..53f93347c74 100644 --- a/src/test/run-pass/fixed-point-bind-box.rs +++ b/src/test/run-pass/fixed-point-bind-box.rs @@ -1,12 +1,12 @@ -fn fix_help<A, @B>(f: @fn(@fn(&A) -> B, &A) -> B, x: &A) -> B { +fn fix_help<A, @B>(f: @fn(@fn(A) -> B, A) -> B, x: A) -> B { ret f(@bind fix_help(f, _), x); } -fn fix<A, @B>(f: @fn(@fn(&A) -> B, &A) -> B) -> @fn(&A) -> B { +fn fix<A, @B>(f: @fn(@fn(A) -> B, A) -> B) -> @fn(A) -> B { ret @bind fix_help(f, _); } -fn fact_(f: @fn(&int) -> int, n: &int) -> int { +fn fact_(f: @fn(int) -> int, n: int) -> int { // fun fact 0 = 1 ret if n == 0 { 1 } else { n * f(n - 1) }; } diff --git a/src/test/run-pass/foreach-box-drop.rs b/src/test/run-pass/foreach-box-drop.rs index 5ad4d1ca607..960ef4e20a6 100644 --- a/src/test/run-pass/foreach-box-drop.rs +++ b/src/test/run-pass/foreach-box-drop.rs @@ -4,6 +4,6 @@ obj ob<K>(k: K) { iter foo() -> @{a: K} { put @{a: k}; } } -fn x(o: &ob<str>) { for each i: @{a: str} in o.foo() { } } +fn x(o: ob<str>) { for each i: @{a: str} in o.foo() { } } fn main() { let o = ob::<str>("hi" + "there"); x(o); } diff --git a/src/test/run-pass/generic-alias-box.rs b/src/test/run-pass/generic-alias-box.rs index 3250b88ab82..cf7e8ba499c 100644 --- a/src/test/run-pass/generic-alias-box.rs +++ b/src/test/run-pass/generic-alias-box.rs @@ -1,6 +1,6 @@ -fn id<@T>(t: &T) -> T { ret t; } +fn id<@T>(t: T) -> T { ret t; } fn main() { let expected = @100; diff --git a/src/test/run-pass/generic-bind-2.rs b/src/test/run-pass/generic-bind-2.rs index 5c149ad5936..8d584534fd8 100644 --- a/src/test/run-pass/generic-bind-2.rs +++ b/src/test/run-pass/generic-bind-2.rs @@ -1,6 +1,6 @@ -fn id<@T>(t: &T) -> T { ret t; } +fn id<@T>(t: T) -> T { ret t; } fn main() { let t = {a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7}; diff --git a/src/test/run-pass/generic-bind.rs b/src/test/run-pass/generic-bind.rs index 01156f57900..320b22c0bee 100644 --- a/src/test/run-pass/generic-bind.rs +++ b/src/test/run-pass/generic-bind.rs @@ -1,6 +1,6 @@ -fn id<@T>(t: &T) -> T { ret t; } +fn id<@T>(t: T) -> T { ret t; } fn main() { let t = {_0: 1, _1: 2, _2: 3, _3: 4, _4: 5, _5: 6, _6: 7}; diff --git a/src/test/run-pass/generic-box.rs b/src/test/run-pass/generic-box.rs index 5762847139d..3e37834f47b 100644 --- a/src/test/run-pass/generic-box.rs +++ b/src/test/run-pass/generic-box.rs @@ -1,6 +1,6 @@ -fn box<T>(x: &{x: T, y: T, z: T}) -> @{x: T, y: T, z: T} { ret @x; } +fn box<T>(x: {x: T, y: T, z: T}) -> @{x: T, y: T, z: T} { ret @x; } fn main() { let x: @{x: int, y: int, z: int} = box::<int>({x: 1, y: 2, z: 3}); diff --git a/src/test/run-pass/generic-derived-type.rs b/src/test/run-pass/generic-derived-type.rs index c11dce2ac7b..a889021378f 100644 --- a/src/test/run-pass/generic-derived-type.rs +++ b/src/test/run-pass/generic-derived-type.rs @@ -1,8 +1,8 @@ -fn g<@X>(x: &X) -> X { ret x; } +fn g<@X>(x: X) -> X { ret x; } -fn f<@T>(t: &T) -> {a: T, b: T} { +fn f<@T>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; diff --git a/src/test/run-pass/generic-drop-glue.rs b/src/test/run-pass/generic-drop-glue.rs index ffadf46e8dd..ad89b7fe556 100644 --- a/src/test/run-pass/generic-drop-glue.rs +++ b/src/test/run-pass/generic-drop-glue.rs @@ -1,5 +1,5 @@ -fn f<T>(t: &T) { let t1: T = t; } +fn f<T>(t: T) { let t1: T = t; } fn main() { let x = {x: @10, y: @12}; f(x); } diff --git a/src/test/run-pass/generic-exterior-box.rs b/src/test/run-pass/generic-exterior-box.rs index 266fa987c3c..7573bff74e8 100644 --- a/src/test/run-pass/generic-exterior-box.rs +++ b/src/test/run-pass/generic-exterior-box.rs @@ -2,7 +2,7 @@ type recbox<T> = {x: @T}; -fn reclift<T>(t: &T) -> recbox<T> { ret {x: @t}; } +fn reclift<T>(t: T) -> recbox<T> { ret {x: @t}; } fn main() { let foo: int = 17; diff --git a/src/test/run-pass/generic-fn-infer.rs b/src/test/run-pass/generic-fn-infer.rs index 559fa4d0446..b1f5a06ee34 100644 --- a/src/test/run-pass/generic-fn-infer.rs +++ b/src/test/run-pass/generic-fn-infer.rs @@ -4,6 +4,6 @@ // -*- rust -*- // Issue #45: infer type parameters in function applications -fn id<@T>(x: &T) -> T { ret x; } +fn id<@T>(x: T) -> T { ret x; } fn main() { let x: int = 42; let y: int = id(x); assert (x == y); } diff --git a/src/test/run-pass/generic-fn.rs b/src/test/run-pass/generic-fn.rs index 940e0fe5aed..d72f32eeb10 100644 --- a/src/test/run-pass/generic-fn.rs +++ b/src/test/run-pass/generic-fn.rs @@ -2,7 +2,7 @@ // -*- rust -*- -fn id<@T>(x: &T) -> T { ret x; } +fn id<@T>(x: T) -> T { ret x; } type triple = {x: int, y: int, z: int}; diff --git a/src/test/run-pass/generic-iter-frame.rs b/src/test/run-pass/generic-iter-frame.rs index b575fe4809b..9d363906487 100644 --- a/src/test/run-pass/generic-iter-frame.rs +++ b/src/test/run-pass/generic-iter-frame.rs @@ -4,6 +4,6 @@ // Contrived example? No. It showed up in rustc's resolve pass. iter i() { put (); } -fn foo<T>(t: &T) { let x: int = 10; for each j: () in i() { log x; } } +fn foo<T>(t: T) { let x: int = 10; for each j: () in i() { log x; } } fn main() { foo(0xdeadbeef_u); } diff --git a/src/test/run-pass/generic-obj.rs b/src/test/run-pass/generic-obj.rs index 6653014b024..7226345d9c0 100644 --- a/src/test/run-pass/generic-obj.rs +++ b/src/test/run-pass/generic-obj.rs @@ -6,8 +6,8 @@ obj buf<@T>(data: {_0: T, _1: T, _2: T}) { ret data._0; } else { if i == 1 { ret data._1; } else { ret data._2; } } } - fn take(t: &T) { } - fn take2(t: &T) { } + fn take(t: T) { } + fn take2(t: T) { } } fn main() { diff --git a/src/test/run-pass/generic-tag-alt.rs b/src/test/run-pass/generic-tag-alt.rs index 0041e0fd268..d6f8dad88bc 100644 --- a/src/test/run-pass/generic-tag-alt.rs +++ b/src/test/run-pass/generic-tag-alt.rs @@ -2,7 +2,7 @@ tag foo<T> { arm(T); } -fn altfoo<T>(f: &foo<T>) { +fn altfoo<T>(f: foo<T>) { let hit = false; alt f { arm::<T>(x) { log "in arm"; hit = true; } } assert (hit); diff --git a/src/test/run-pass/generic-temporary.rs b/src/test/run-pass/generic-temporary.rs index afac9e176ee..36955938ef3 100644 --- a/src/test/run-pass/generic-temporary.rs +++ b/src/test/run-pass/generic-temporary.rs @@ -2,12 +2,12 @@ fn mk() -> int { ret 1; } -fn chk(a: &int) { log a; assert (a == 1); } +fn chk(a: int) { log a; assert (a == 1); } -fn apply<T>(produce: fn() -> T, consume: fn(&T)) { consume(produce()); } +fn apply<T>(produce: fn() -> T, consume: fn(T)) { consume(produce()); } fn main() { let produce: fn() -> int = mk; - let consume: fn(&int) = chk; + let consume: fn(int) = chk; apply::<int>(produce, consume); } diff --git a/src/test/run-pass/generic-tup.rs b/src/test/run-pass/generic-tup.rs index ac15998c1cc..08bf75b733b 100644 --- a/src/test/run-pass/generic-tup.rs +++ b/src/test/run-pass/generic-tup.rs @@ -1,4 +1,4 @@ -fn get_third<@T>(t: &(T, T, T)) -> T { let (_, _, x) = t; ret x; } +fn get_third<@T>(t: (T, T, T)) -> T { let (_, _, x) = t; ret x; } fn main() { log get_third((1, 2, 3)); diff --git a/src/test/run-pass/generic-type-synonym.rs b/src/test/run-pass/generic-type-synonym.rs index d05e9218a56..ebfbd8b4c7b 100644 --- a/src/test/run-pass/generic-type-synonym.rs +++ b/src/test/run-pass/generic-type-synonym.rs @@ -4,6 +4,6 @@ type foo<T> = {a: T}; type bar<T> = foo<T>; -fn takebar<T>(b: &bar<T>) { } +fn takebar<T>(b: bar<T>) { } fn main() { } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 6d5203f4884..0b6b07791d9 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -19,20 +19,20 @@ import std::comm::send; import std::comm::recv; import std::comm; -fn map(filename: &str, emit: map_reduce::putter) { emit(filename, "1"); } +fn map(filename: str, emit: map_reduce::putter) { emit(filename, "1"); } mod map_reduce { export putter; export mapper; export map_reduce; - type putter = fn(&str, &str); + type putter = fn(str, str); - type mapper = fn(&str, putter); + type mapper = fn(str, putter); tag ctrl_proto { find_reducer([u8], chan<int>); mapper_done; } - fn start_mappers(ctrl: chan<ctrl_proto>, inputs: &[str]) { + fn start_mappers(ctrl: chan<ctrl_proto>, inputs: [str]) { for i: str in inputs { task::spawn(bind map_task(ctrl, i)); } } @@ -40,8 +40,8 @@ mod map_reduce { let intermediates = map::new_str_hash(); - fn emit(im: &map::hashmap<str, int>, ctrl: chan<ctrl_proto>, - key: &str, val: &str) { + fn emit(im: map::hashmap<str, int>, ctrl: chan<ctrl_proto>, key: str, + val: str) { let c; alt im.find(key) { some(_c) { c = _c } @@ -61,7 +61,7 @@ mod map_reduce { send(ctrl, mapper_done); } - fn map_reduce(inputs: &[str]) { + fn map_reduce(inputs: [str]) { let ctrl = port(); // This task becomes the master control task. It spawns others diff --git a/src/test/run-pass/interior-vec.rs b/src/test/run-pass/interior-vec.rs index 956c97f23ec..20487ed6f4c 100644 --- a/src/test/run-pass/interior-vec.rs +++ b/src/test/run-pass/interior-vec.rs @@ -1,7 +1,7 @@ import rusti::vec_len; native "rust-intrinsic" mod rusti { - fn vec_len<T>(v: &[T]) -> uint; + fn vec_len<T>(v: [T]) -> uint; } fn main() { diff --git a/src/test/run-pass/issue-333.rs b/src/test/run-pass/issue-333.rs index b5304234b98..27bbc2506b0 100644 --- a/src/test/run-pass/issue-333.rs +++ b/src/test/run-pass/issue-333.rs @@ -1,5 +1,5 @@ -fn quux<@T>(x: &T) -> T { let f = id::<T>; ret f(x); } +fn quux<@T>(x: T) -> T { let f = id::<T>; ret f(x); } -fn id<@T>(x: &T) -> T { ret x; } +fn id<@T>(x: T) -> T { ret x; } fn main() { assert (quux(10) == 10); } diff --git a/src/test/run-pass/ivec-add.rs b/src/test/run-pass/ivec-add.rs index 17b0a77d6ad..f9378b21317 100644 --- a/src/test/run-pass/ivec-add.rs +++ b/src/test/run-pass/ivec-add.rs @@ -1,4 +1,4 @@ -fn double<T>(a: &T) -> [T] { ret [a] + [a]; } +fn double<T>(a: T) -> [T] { ret [a] + [a]; } fn double_int(a: int) -> [int] { ret [a] + [a]; } diff --git a/src/test/run-pass/lambda-no-leak.rs b/src/test/run-pass/lambda-no-leak.rs index 0643de4bcfb..2c527e4953d 100644 --- a/src/test/run-pass/lambda-no-leak.rs +++ b/src/test/run-pass/lambda-no-leak.rs @@ -1,5 +1,5 @@ // Make sure we don't leak lambdas in silly ways. -fn force(f: &fn()) { f() } +fn force(f: fn()) { f() } fn main() { let x = 7; lambda () { log_err x; } diff --git a/src/test/run-pass/leak-box-as-tydesc.rs b/src/test/run-pass/leak-box-as-tydesc.rs index 5a5cb1e4da4..6fb6d759723 100644 --- a/src/test/run-pass/leak-box-as-tydesc.rs +++ b/src/test/run-pass/leak-box-as-tydesc.rs @@ -1,5 +1,5 @@ -fn leaky<T>(t: &T) { } +fn leaky<T>(t: T) { } fn main() { let x = @10; leaky::<@int>(x); } diff --git a/src/test/run-pass/newtype-polymorphic.rs b/src/test/run-pass/newtype-polymorphic.rs index 27fbaee6a77..191e3e4b3c7 100644 --- a/src/test/run-pass/newtype-polymorphic.rs +++ b/src/test/run-pass/newtype-polymorphic.rs @@ -1,8 +1,8 @@ tag myvec<X> = [X]; -fn myvec_deref<@X>(mv: &myvec<X>) -> [X] { ret *mv; } +fn myvec_deref<@X>(mv: myvec<X>) -> [X] { ret *mv; } -fn myvec_elt<@X>(mv: &myvec<X>) -> X { ret mv[0]; } +fn myvec_elt<@X>(mv: myvec<X>) -> X { ret mv[0]; } fn main() { let mv = myvec([1, 2, 3]); diff --git a/src/test/run-pass/newtype.rs b/src/test/run-pass/newtype.rs index 0b0a8c7b2d9..f1869f8e21b 100644 --- a/src/test/run-pass/newtype.rs +++ b/src/test/run-pass/newtype.rs @@ -1,6 +1,6 @@ -tag mytype = {compute: fn(&mytype) -> int, val: int}; +tag mytype = {compute: fn(mytype) -> int, val: int}; -fn compute(i: &mytype) -> int { ret i.val + 20; } +fn compute(i: mytype) -> int { ret i.val + 20; } fn main() { let myval = mytype({compute: compute, val: 30}); diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs index 9478735d932..0f1558975a2 100644 --- a/src/test/run-pass/non-boolean-pure-fns.rs +++ b/src/test/run-pass/non-boolean-pure-fns.rs @@ -2,19 +2,19 @@ use std; import std::list::*; -pure fn pure_length_go<@T>(ls: &list<T>, acc: uint) -> uint { +pure fn pure_length_go<@T>(ls: list<T>, acc: uint) -> uint { alt ls { nil. { acc } cons(_, tl) { pure_length_go(*tl, acc + 1u) } } } -pure fn pure_length<@T>(ls: &list<T>) -> uint { pure_length_go(ls, 0u) } +pure fn pure_length<@T>(ls: list<T>) -> uint { pure_length_go(ls, 0u) } -pure fn nonempty_list<@T>(ls: &list<T>) -> bool { pure_length(ls) > 0u } +pure fn nonempty_list<@T>(ls: list<T>) -> bool { pure_length(ls) > 0u } // Of course, the compiler can't take advantage of the // knowledge that ls is a cons node. Future work. // Also, this is pretty contrived since nonempty_list // could be a "tag refinement", if we implement those. -fn safe_head<@T>(ls: &list<T>) : nonempty_list(ls) -> T { car(ls) } +fn safe_head<@T>(ls: list<T>) : nonempty_list(ls) -> T { car(ls) } fn main() { let mylist = cons(@1u, @nil); diff --git a/src/test/run-pass/or-pattern.rs b/src/test/run-pass/or-pattern.rs index 99682e0977a..9aa6694892d 100644 --- a/src/test/run-pass/or-pattern.rs +++ b/src/test/run-pass/or-pattern.rs @@ -1,6 +1,6 @@ tag blah { a(int, int, uint); b(int, int); c; } -fn or_alt(q: &blah) -> int { +fn or_alt(q: blah) -> int { alt q { a(x, y, _) | b(x, y) { ret x + y; } c. { ret 0; } } } diff --git a/src/test/run-pass/readalias.rs b/src/test/run-pass/readalias.rs index 93b8b22aef5..adc6432d016 100644 --- a/src/test/run-pass/readalias.rs +++ b/src/test/run-pass/readalias.rs @@ -4,6 +4,6 @@ // -*- rust -*- type point = {x: int, y: int, z: int}; -fn f(p: &point) { assert (p.z == 12); } +fn f(p: point) { assert (p.z == 12); } fn main() { let x: point = {x: 10, y: 11, z: 12}; f(x); } diff --git a/src/test/run-pass/rec-tup.rs b/src/test/run-pass/rec-tup.rs index 66cf866de9d..e5375403dfe 100644 --- a/src/test/run-pass/rec-tup.rs +++ b/src/test/run-pass/rec-tup.rs @@ -3,8 +3,8 @@ type point = {x: int, y: int}; type rect = (point, point); -fn fst(r: &rect) -> point { let (fst, _) = r; ret fst; } -fn snd(r: &rect) -> point { let (_, snd) = r; ret snd; } +fn fst(r: rect) -> point { let (fst, _) = r; ret fst; } +fn snd(r: rect) -> point { let (_, snd) = r; ret snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert (fst(r).x == x1); diff --git a/src/test/run-pass/record-pat.rs b/src/test/run-pass/record-pat.rs index f2f4c6af2c7..06228674e3f 100644 --- a/src/test/run-pass/record-pat.rs +++ b/src/test/run-pass/record-pat.rs @@ -2,7 +2,7 @@ tag t1 { a(int); b(uint); } type t2 = {x: t1, y: int}; tag t3 { c(t2, uint); } -fn m(in: &t3) -> int { +fn m(in: t3) -> int { alt in { c({x: a(m), _}, _) { ret m; } c({x: b(m), y: y}, z) { ret (m + z as int) + y; } diff --git a/src/test/run-pass/resource-destruct.rs b/src/test/run-pass/resource-destruct.rs index 25a3c79e1c3..2df6dddb2a4 100644 --- a/src/test/run-pass/resource-destruct.rs +++ b/src/test/run-pass/resource-destruct.rs @@ -1,6 +1,6 @@ resource shrinky_pointer(i: @mutable int) { *i -= 1; } -fn look_at(pt: &shrinky_pointer) -> int { ret **pt; } +fn look_at(pt: shrinky_pointer) -> int { ret **pt; } fn main() { let my_total = @mutable 10; diff --git a/src/test/run-pass/resource-generic.rs b/src/test/run-pass/resource-generic.rs index 34ecc55f2e4..814503c194b 100644 --- a/src/test/run-pass/resource-generic.rs +++ b/src/test/run-pass/resource-generic.rs @@ -1,8 +1,8 @@ -resource finish<T>(arg: {val: T, fin: fn(&T)}) { arg.fin(arg.val); } +resource finish<T>(arg: {val: T, fin: fn(T)}) { arg.fin(arg.val); } fn main() { let box = @mutable 10; - fn dec_box(i: &@mutable int) { *i -= 1; } + fn dec_box(i: @mutable int) { *i -= 1; } { let i <- finish({val: box, fin: dec_box}); } assert (*box == 9); diff --git a/src/test/run-pass/send-type-inference.rs b/src/test/run-pass/send-type-inference.rs index cfc358a9106..9ab1d758fea 100644 --- a/src/test/run-pass/send-type-inference.rs +++ b/src/test/run-pass/send-type-inference.rs @@ -6,7 +6,7 @@ import std::comm::port; // tests that ctrl's type gets inferred properly type command<~K, ~V> = {key: K, val: V}; -fn cache_server<~K, ~V>(c: &chan<chan<command<K, V>>>) { +fn cache_server<~K, ~V>(c: chan<chan<command<K, V>>>) { let ctrl = port(); send(c, chan(ctrl)); } diff --git a/src/test/run-pass/size-and-align.rs b/src/test/run-pass/size-and-align.rs index 929ce3500f1..10c1e45017d 100644 --- a/src/test/run-pass/size-and-align.rs +++ b/src/test/run-pass/size-and-align.rs @@ -4,7 +4,7 @@ // -*- rust -*- tag clam<T> { a(T, int); b; } -fn uhoh<T>(v: &[clam<T>]) { +fn uhoh<T>(v: [clam<T>]) { alt v[1] { a::<T>(t, u) { log "incorrect"; log u; fail; } b::<T>. { log "correct"; } diff --git a/src/test/run-pass/swap-2.rs b/src/test/run-pass/swap-2.rs index 5caf36f9b92..71c3fb99d03 100644 --- a/src/test/run-pass/swap-2.rs +++ b/src/test/run-pass/swap-2.rs @@ -1,4 +1,4 @@ -fn swap<@T>(v: &[mutable T], i: int, j: int) { v[i] <-> v[j]; } +fn swap<@T>(v: [mutable T], i: int, j: int) { v[i] <-> v[j]; } fn main() { let a: [mutable int] = [mutable 0, 1, 2, 3, 4, 5, 6]; diff --git a/src/test/run-pass/syntax-extension-fmt.rs b/src/test/run-pass/syntax-extension-fmt.rs index 88204cfffeb..c241a68e7f1 100644 --- a/src/test/run-pass/syntax-extension-fmt.rs +++ b/src/test/run-pass/syntax-extension-fmt.rs @@ -1,7 +1,7 @@ use std; import std::str; -fn test(actual: &str, expected: &str) { +fn test(actual: str, expected: str) { log actual; log expected; assert (str::eq(actual, expected)); diff --git a/src/test/run-pass/tag-and-generic-obj.rs b/src/test/run-pass/tag-and-generic-obj.rs index de38f08cbf8..529bb14a9b6 100644 --- a/src/test/run-pass/tag-and-generic-obj.rs +++ b/src/test/run-pass/tag-and-generic-obj.rs @@ -3,7 +3,7 @@ tag colour { red; green; } obj foo<T>() { - fn meth(x: &T) { } + fn meth(x: T) { } } fn main() { foo::<colour>().meth(red); } diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index a5ea4c223d4..2d6a88e625c 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -1,6 +1,6 @@ -fn p_foo<T>(pinned: &T) { } -fn s_foo<@T>(shared: &T) { } -fn u_foo<~T>(unique: &T) { } +fn p_foo<T>(pinned: T) { } +fn s_foo<@T>(shared: T) { } +fn u_foo<~T>(unique: T) { } resource r(i: int) { } diff --git a/src/test/run-pass/type-param.rs b/src/test/run-pass/type-param.rs index be55ba86cac..56ad610fcdf 100644 --- a/src/test/run-pass/type-param.rs +++ b/src/test/run-pass/type-param.rs @@ -1,5 +1,5 @@ -type lteq<T> = fn(&T) -> bool; +type lteq<T> = fn(T) -> bool; fn main(args: [str]) { } diff --git a/src/test/run-pass/type-params-in-for-each.rs b/src/test/run-pass/type-params-in-for-each.rs index 760e5dadfa1..d734769c769 100644 --- a/src/test/run-pass/type-params-in-for-each.rs +++ b/src/test/run-pass/type-params-in-for-each.rs @@ -5,7 +5,7 @@ iter range(lo: uint, hi: uint) -> uint { while lo_ < hi { put lo_; lo_ += 1u; } } -fn create_index<T>(index: &[{a: T, b: uint}], hash_fn: fn(&T) -> uint) { +fn create_index<T>(index: [{a: T, b: uint}], hash_fn: fn(T) -> uint) { for each i: uint in range(0u, 256u) { let bucket: [T] = []; } } diff --git a/src/test/run-pass/unchecked-predicates.rs b/src/test/run-pass/unchecked-predicates.rs index d456f1f2e90..9c7cfc39963 100644 --- a/src/test/run-pass/unchecked-predicates.rs +++ b/src/test/run-pass/unchecked-predicates.rs @@ -5,24 +5,24 @@ import std::list::*; // Can't easily be written as a "pure fn" because there's // no syntax for specifying that f is pure. -fn pure_foldl<@T, @U>(ls: &list<T>, u: &U, f: &block(&T, &U) -> U) -> U { +fn pure_foldl<@T, @U>(ls: list<T>, u: U, f: block(T, U) -> U) -> U { alt ls { nil. { u } cons(hd, tl) { f(hd, pure_foldl(*tl, f(hd, u), f)) } } } // Shows how to use an "unchecked" block to call a general // fn from a pure fn -pure fn pure_length<@T>(ls: &list<T>) -> uint { - fn count<T>(_t: &T, u: &uint) -> uint { u + 1u } +pure fn pure_length<@T>(ls: list<T>) -> uint { + fn count<T>(_t: T, u: uint) -> uint { u + 1u } unchecked{ pure_foldl(ls, 0u, count) } } -pure fn nonempty_list<@T>(ls: &list<T>) -> bool { pure_length(ls) > 0u } +pure fn nonempty_list<@T>(ls: list<T>) -> bool { pure_length(ls) > 0u } // Of course, the compiler can't take advantage of the // knowledge that ls is a cons node. Future work. // Also, this is pretty contrived since nonempty_list // could be a "tag refinement", if we implement those. -fn safe_head<@T>(ls: &list<T>) : nonempty_list(ls) -> T { car(ls) } +fn safe_head<@T>(ls: list<T>) : nonempty_list(ls) -> T { car(ls) } fn main() { let mylist = cons(@1u, @nil); diff --git a/src/test/run-pass/use-uninit-alt.rs b/src/test/run-pass/use-uninit-alt.rs index 7315bf08fef..e1656c8dda9 100644 --- a/src/test/run-pass/use-uninit-alt.rs +++ b/src/test/run-pass/use-uninit-alt.rs @@ -1,6 +1,6 @@ -fn foo<T>(o: &myoption<T>) -> int { +fn foo<T>(o: myoption<T>) -> int { let x: int = 5; alt o { none::<T>. { } some::<T>(t) { x += 1; } } ret x; diff --git a/src/test/run-pass/use-uninit-alt2.rs b/src/test/run-pass/use-uninit-alt2.rs index 615296d974f..f702694d75a 100644 --- a/src/test/run-pass/use-uninit-alt2.rs +++ b/src/test/run-pass/use-uninit-alt2.rs @@ -1,6 +1,6 @@ -fn foo<T>(o: &myoption<T>) -> int { +fn foo<T>(o: myoption<T>) -> int { let x: int; alt o { none::<T>. { fail; } some::<T>(t) { x = 5; } } ret x; diff --git a/src/test/run-pass/vec-push.rs b/src/test/run-pass/vec-push.rs index c2f49311b1e..725dec057a9 100644 --- a/src/test/run-pass/vec-push.rs +++ b/src/test/run-pass/vec-push.rs @@ -1,5 +1,5 @@ -fn push<T>(v: &mutable [mutable? T], t: &T) { v += [t]; } +fn push<T>(v: &mutable [mutable? T], t: T) { v += [t]; } fn main() { let v = [1, 2, 3]; push(v, 1); } diff --git a/src/test/stdtest/deque.rs b/src/test/stdtest/deque.rs index acdde57b86e..104d68f03bb 100644 --- a/src/test/stdtest/deque.rs +++ b/src/test/stdtest/deque.rs @@ -79,9 +79,9 @@ fn test_boxes(a: @int, b: @int, c: @int, d: @int) { assert (deq.get(3) == d); } -type eqfn<T> = fn(&T, &T) -> bool; +type eqfn<T> = fn(T, T) -> bool; -fn test_parameterized<@T>(e: eqfn<T>, a: &T, b: &T, c: &T, d: &T) { +fn test_parameterized<@T>(e: eqfn<T>, a: T, b: T, c: T, d: T) { let deq: deque::t<T> = deque::create::<T>(); assert (deq.size() == 0u); deq.add_front(a); @@ -119,9 +119,9 @@ type reccy = {x: int, y: int, t: taggy}; #[test] fn test() { - fn inteq(a: &int, b: &int) -> bool { ret a == b; } - fn intboxeq(a: &@int, b: &@int) -> bool { ret a == b; } - fn taggyeq(a: &taggy, b: &taggy) -> bool { + fn inteq(a: int, b: int) -> bool { ret a == b; } + fn intboxeq(a: @int, b: @int) -> bool { ret a == b; } + fn taggyeq(a: taggy, b: taggy) -> bool { alt a { one(a1) { alt b { one(b1) { ret a1 == b1; } _ { ret false; } } } two(a1, a2) { @@ -138,7 +138,7 @@ fn test() { } } } - fn taggypareq<@T>(a: &taggypar<T>, b: &taggypar<T>) -> bool { + fn taggypareq<@T>(a: taggypar<T>, b: taggypar<T>) -> bool { alt a { onepar::<T>(a1) { alt b { onepar::<T>(b1) { ret a1 == b1; } _ { ret false; } } @@ -159,7 +159,7 @@ fn test() { } } } - fn reccyeq(a: &reccy, b: &reccy) -> bool { + fn reccyeq(a: reccy, b: reccy) -> bool { ret a.x == b.x && a.y == b.y && taggyeq(a.t, b.t); } log "*** test boxes"; diff --git a/src/test/stdtest/either.rs b/src/test/stdtest/either.rs index 5b3a3959cb3..966a04f70f4 100644 --- a/src/test/stdtest/either.rs +++ b/src/test/stdtest/either.rs @@ -5,16 +5,16 @@ import std::vec::len; #[test] fn test_either_left() { let val = left(10); - fn f_left(x: &int) -> bool { x == 10 } - fn f_right(_x: &uint) -> bool { false } + fn f_left(x: int) -> bool { x == 10 } + fn f_right(_x: uint) -> bool { false } assert (either(f_left, f_right, val)); } #[test] fn test_either_right() { let val = right(10u); - fn f_left(_x: &int) -> bool { false } - fn f_right(x: &uint) -> bool { x == 10u } + fn f_left(_x: int) -> bool { false } + fn f_right(x: uint) -> bool { x == 10u } assert (either(f_left, f_right, val)); } diff --git a/src/test/stdtest/list.rs b/src/test/stdtest/list.rs index 3880ee8d613..7906d277a10 100644 --- a/src/test/stdtest/list.rs +++ b/src/test/stdtest/list.rs @@ -17,7 +17,7 @@ fn test_from_vec() { #[test] fn test_foldl() { let l = from_vec([0, 1, 2, 3, 4]); - fn add(a: &int, b: &uint) -> uint { ret (a as uint) + b; } + fn add(a: int, b: uint) -> uint { ret (a as uint) + b; } let rs = list::foldl(l, 0u, add); assert (rs == 10u); } @@ -25,7 +25,7 @@ fn test_foldl() { #[test] fn test_find_success() { let l = from_vec([0, 1, 2]); - fn match(i: &int) -> option::t<int> { + fn match(i: int) -> option::t<int> { ret if i == 2 { option::some(i) } else { option::none::<int> }; } let rs = list::find(l, match); @@ -35,7 +35,7 @@ fn test_find_success() { #[test] fn test_find_fail() { let l = from_vec([0, 1, 2]); - fn match(_i: &int) -> option::t<int> { ret option::none::<int>; } + fn match(_i: int) -> option::t<int> { ret option::none::<int>; } let rs = list::find(l, match); assert (rs == option::none::<int>); } diff --git a/src/test/stdtest/map.rs b/src/test/stdtest/map.rs index 67240a7c69b..ff978085a27 100644 --- a/src/test/stdtest/map.rs +++ b/src/test/stdtest/map.rs @@ -11,7 +11,7 @@ import std::option; #[test] fn test_simple() { log "*** starting test_simple"; - fn eq_uint(x: &uint, y: &uint) -> bool { ret x == y; } + fn eq_uint(x: uint, y: uint) -> bool { ret x == y; } let hasher_uint: map::hashfn<uint> = util::id; let eqer_uint: map::eqfn<uint> = eq_uint; let hasher_str: map::hashfn<str> = str::hash; @@ -83,7 +83,7 @@ fn test_simple() { fn test_growth() { log "*** starting test_growth"; let num_to_insert: uint = 64u; - fn eq_uint(x: &uint, y: &uint) -> bool { ret x == y; } + fn eq_uint(x: uint, y: uint) -> bool { ret x == y; } log "uint -> uint"; let hasher_uint: map::hashfn<uint> = util::id; let eqer_uint: map::eqfn<uint> = eq_uint; @@ -157,8 +157,8 @@ fn test_growth() { fn test_removal() { log "*** starting test_removal"; let num_to_insert: uint = 64u; - fn eq(x: &uint, y: &uint) -> bool { ret x == y; } - fn hash(u: &uint) -> uint { + fn eq(x: uint, y: uint) -> bool { ret x == y; } + fn hash(u: uint) -> uint { // This hash function intentionally causes collisions between // consecutive integer pairs. diff --git a/src/test/stdtest/qsort.rs b/src/test/stdtest/qsort.rs index 609adf3afe4..ad2a82ef426 100644 --- a/src/test/stdtest/qsort.rs +++ b/src/test/stdtest/qsort.rs @@ -5,9 +5,9 @@ import std::sort; import std::vec; import std::int; -fn check_sort(v1: &[mutable int], v2: &[mutable int]) { +fn check_sort(v1: [mutable int], v2: [mutable int]) { let len = std::vec::len::<int>(v1); - fn ltequal(a: &int, b: &int) -> bool { ret a <= b; } + fn ltequal(a: int, b: int) -> bool { ret a <= b; } let f = ltequal; std::sort::quick_sort::<int>(f, v1); let i = 0u; @@ -46,7 +46,7 @@ fn test_simple() { let expected = [1, 2, 3]; - fn lteq(a: &int, b: &int) -> bool { int::le(a, b) } + fn lteq(a: int, b: int) -> bool { int::le(a, b) } sort::quick_sort(lteq, names); let immut_names = vec::from_mut(names); diff --git a/src/test/stdtest/qsort3.rs b/src/test/stdtest/qsort3.rs index 6c8df212218..6688a175e8d 100644 --- a/src/test/stdtest/qsort3.rs +++ b/src/test/stdtest/qsort3.rs @@ -1,10 +1,10 @@ use std; -fn check_sort(v1: &[mutable int], v2: &[mutable int]) { +fn check_sort(v1: [mutable int], v2: [mutable int]) { let len = std::vec::len::<int>(v1); - fn lt(a: &int, b: &int) -> bool { ret a < b; } - fn equal(a: &int, b: &int) -> bool { ret a == b; } + fn lt(a: int, b: int) -> bool { ret a < b; } + fn equal(a: int, b: int) -> bool { ret a == b; } let f1 = lt; let f2 = equal; std::sort::quick_sort3::<int>(f1, f2, v1); diff --git a/src/test/stdtest/run.rs b/src/test/stdtest/run.rs index b60a3935500..218889c766b 100644 --- a/src/test/stdtest/run.rs +++ b/src/test/stdtest/run.rs @@ -45,7 +45,7 @@ fn test_pipes() { log actual; assert (expected == actual); - fn writeclose(fd: int, s: &str) { + fn writeclose(fd: int, s: str) { let writer = io::new_writer(io::fd_buf_writer(fd, option::none)); writer.write_str(s); diff --git a/src/test/stdtest/sha1.rs b/src/test/stdtest/sha1.rs index 6b72be20dd5..9b47b7f1f09 100644 --- a/src/test/stdtest/sha1.rs +++ b/src/test/stdtest/sha1.rs @@ -50,7 +50,7 @@ fn test() { 0xfau8, 0xd3u8, 0xe8u8, 0x5au8, 0x0bu8, 0xd1u8, 0x7du8, 0x9bu8, 0x10u8, 0x0du8, 0xb4u8, 0xb3u8]}]; let tests = fips_180_1_tests + wikipedia_tests; - fn check_vec_eq(v0: &[u8], v1: &[u8]) { + fn check_vec_eq(v0: [u8], v1: [u8]) { assert (vec::len::<u8>(v0) == vec::len::<u8>(v1)); let len = vec::len::<u8>(v0); let i = 0u; diff --git a/src/test/stdtest/sort.rs b/src/test/stdtest/sort.rs index c42f950ce6b..e27124dd015 100644 --- a/src/test/stdtest/sort.rs +++ b/src/test/stdtest/sort.rs @@ -1,9 +1,9 @@ use std; -fn check_sort(v1: &[int], v2: &[int]) { +fn check_sort(v1: [int], v2: [int]) { let len = std::vec::len::<int>(v1); - fn lteq(a: &int, b: &int) -> bool { ret a <= b; } + fn lteq(a: int, b: int) -> bool { ret a <= b; } let f = lteq; let v3 = std::sort::merge_sort::<int>(f, v1); let i = 0u; diff --git a/src/test/stdtest/str.rs b/src/test/stdtest/str.rs index 2852822f8d4..5e79bb6fc20 100644 --- a/src/test/stdtest/str.rs +++ b/src/test/stdtest/str.rs @@ -39,7 +39,7 @@ fn test_index_and_rindex() { #[test] fn test_split() { - fn t(s: &str, c: char, i: int, k: &str) { + fn t(s: str, c: char, i: int, k: str) { log "splitting: " + s; log i; let v = str::split(s, c as u8); @@ -59,7 +59,7 @@ fn test_split() { #[test] fn test_find() { - fn t(haystack: &str, needle: &str, i: int) { + fn t(haystack: str, needle: str, i: int) { let j: int = str::find(haystack, needle); log "searched for " + needle; log j; @@ -74,7 +74,7 @@ fn test_find() { #[test] fn test_substr() { - fn t(a: &str, b: &str, start: int) { + fn t(a: str, b: str, start: int) { assert (str::eq(str::substr(a, start as uint, str::byte_len(b)), b)); } t("hello", "llo", 2); @@ -84,7 +84,7 @@ fn test_substr() { #[test] fn test_concat() { - fn t(v: &[str], s: &str) { assert (str::eq(str::concat(v), s)); } + fn t(v: [str], s: str) { assert (str::eq(str::concat(v), s)); } t(["you", "know", "I'm", "no", "good"], "youknowI'mnogood"); let v: [str] = []; t(v, ""); @@ -93,7 +93,7 @@ fn test_concat() { #[test] fn test_connect() { - fn t(v: &[str], sep: &str, s: &str) { + fn t(v: [str], sep: str, s: str) { assert (str::eq(str::connect(v, sep), s)); } t(["you", "know", "I'm", "no", "good"], " ", "you know I'm no good"); diff --git a/src/test/stdtest/treemap.rs b/src/test/stdtest/treemap.rs index 0f4119c6c3d..3d7bd4fd747 100644 --- a/src/test/stdtest/treemap.rs +++ b/src/test/stdtest/treemap.rs @@ -40,7 +40,7 @@ fn traverse_in_order() { insert(m, 1, ()); let n = 0; - fn t(n: &mutable int, k: &int, v: &()) { assert (n == k); n += 1; } + fn t(n: &mutable int, k: int, v: ()) { assert (n == k); n += 1; } traverse(m, bind t(n, _, _)); } diff --git a/src/test/stdtest/vec.rs b/src/test/stdtest/vec.rs index 6194c461c15..a9cda6c73d6 100644 --- a/src/test/stdtest/vec.rs +++ b/src/test/stdtest/vec.rs @@ -8,15 +8,15 @@ import std::option::some; fn square(n: uint) -> uint { ret n * n; } -fn square_alias(n: &uint) -> uint { ret n * n; } +fn square_alias(n: uint) -> uint { ret n * n; } -pure fn is_three(n: &uint) -> bool { ret n == 3u; } +pure fn is_three(n: uint) -> bool { ret n == 3u; } -fn square_if_odd(n: &uint) -> option::t<uint> { +fn square_if_odd(n: uint) -> option::t<uint> { ret if n % 2u == 1u { some(n * n) } else { none }; } -fn add(x: &uint, y: &uint) -> uint { ret x + y; } +fn add(x: uint, y: uint) -> uint { ret x + y; } #[test] fn test_unsafe_ptrs() { @@ -228,7 +228,7 @@ fn test_map() { #[test] fn test_map2() { - fn times(x: &int, y: &int) -> int { ret x * y; } + fn times(x: int, y: int) -> int { ret x * y; } let f = times; let v0 = [1, 2, 3, 4, 5]; let v1 = [5, 4, 3, 2, 1]; @@ -254,12 +254,12 @@ fn test_filter_map() { assert (w[1] == 9u); assert (w[2] == 25u); - fn halve(i: &int) -> option::t<int> { + fn halve(i: int) -> option::t<int> { if i % 2 == 0 { ret option::some::<int>(i / 2); } else { ret option::none::<int>; } } - fn halve_for_sure(i: &int) -> int { ret i / 2; } + fn halve_for_sure(i: int) -> int { ret i / 2; } let all_even: [int] = [0, 2, 8, 6]; let all_odd1: [int] = [1, 7, 3]; let all_odd2: [int] = []; @@ -328,8 +328,8 @@ fn test_position() { #[test] fn test_position_pred() { - fn less_than_three(i: &int) -> bool { ret i < 3; } - fn is_eighteen(i: &int) -> bool { ret i == 18; } + fn less_than_three(i: int) -> bool { ret i < 3; } + fn is_eighteen(i: int) -> bool { ret i == 18; } let v1: [int] = [5, 4, 3, 2, 1]; assert (position_pred(less_than_three, v1) == option::some::<uint>(3u)); assert (position_pred(is_eighteen, v1) == option::none::<uint>); |
