Skip to content

Commit 98e161f

Browse files
committed
Switch the compiler over to using ~[] notation instead of []/~. Closes #2759.
1 parent e6baf44 commit 98e161f

File tree

420 files changed

+4078
-4079
lines changed

Some content is hidden

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

420 files changed

+4078
-4079
lines changed

src/cargo/cargo.rs

Lines changed: 57 additions & 57 deletions
Large diffs are not rendered by default.

src/cargo/pgp.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn gpg(args: [str]/~) -> { status: int, out: str, err: str } {
1+
fn gpg(args: ~[str]) -> { status: int, out: str, err: str } {
22
ret run::program_output("gpg", args);
33
}
44

@@ -59,15 +59,15 @@ fn signing_key_fp() -> str {
5959
}
6060

6161
fn supported() -> bool {
62-
let r = gpg(["--version"]/~);
62+
let r = gpg(~["--version"]);
6363
r.status == 0
6464
}
6565

6666
fn init(root: str) {
6767
let p = path::connect(root, "gpg");
6868
if !os::path_is_dir(p) {
6969
os::make_dir(p, 0x1c0i32);
70-
let p = run::start_program("gpg", ["--homedir", p, "--import"]/~);
70+
let p = run::start_program("gpg", ~["--homedir", p, "--import"]);
7171
p.input().write_str(signing_key());
7272
let s = p.finish();
7373
if s != 0 {
@@ -79,16 +79,16 @@ fn init(root: str) {
7979
fn add(root: str, key: str) {
8080
let path = path::connect(root, "gpg");
8181
let p =
82-
run::program_output("gpg", ["--homedir", path, "--import", key]/~);
82+
run::program_output("gpg", ~["--homedir", path, "--import", key]);
8383
if p.status != 0 {
8484
fail "pgp add failed: " + p.out;
8585
}
8686
}
8787

8888
fn verify(root: str, data: str, sig: str, keyfp: str) -> bool {
8989
let path = path::connect(root, "gpg");
90-
let p = gpg(["--homedir", path, "--with-fingerprint", "--verify", sig,
91-
data]/~);
90+
let p = gpg(~["--homedir", path, "--with-fingerprint", "--verify", sig,
91+
data]);
9292
let res = "Primary key fingerprint: " + keyfp;
9393
for str::split_char(p.err, '\n').each {|line|
9494
if line == res { ret true; }

src/compiletest/compiletest.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,23 @@ import common::mode_pretty;
2121
import common::mode;
2222
import util::logv;
2323

24-
fn main(args: [str]/~) {
24+
fn main(args: ~[str]) {
2525
let config = parse_config(args);
2626
log_config(config);
2727
run_tests(config);
2828
}
2929

30-
fn parse_config(args: [str]/~) -> config {
30+
fn parse_config(args: ~[str]) -> config {
3131
let opts =
32-
[getopts::reqopt("compile-lib-path"), getopts::reqopt("run-lib-path"),
33-
getopts::reqopt("rustc-path"), getopts::reqopt("src-base"),
34-
getopts::reqopt("build-base"), getopts::reqopt("aux-base"),
35-
getopts::reqopt("stage-id"),
36-
getopts::reqopt("mode"), getopts::optflag("ignored"),
37-
getopts::optopt("runtool"), getopts::optopt("rustcflags"),
38-
getopts::optflag("verbose"),
39-
getopts::optopt("logfile")]/~;
32+
~[getopts::reqopt("compile-lib-path"),
33+
getopts::reqopt("run-lib-path"),
34+
getopts::reqopt("rustc-path"), getopts::reqopt("src-base"),
35+
getopts::reqopt("build-base"), getopts::reqopt("aux-base"),
36+
getopts::reqopt("stage-id"),
37+
getopts::reqopt("mode"), getopts::optflag("ignored"),
38+
getopts::optopt("runtool"), getopts::optopt("rustcflags"),
39+
getopts::optflag("verbose"),
40+
getopts::optopt("logfile")];
4041

4142
check (vec::is_not_empty(args));
4243
let args_ = vec::tail(args);
@@ -132,9 +133,9 @@ fn test_opts(config: config) -> test::test_opts {
132133
}
133134
}
134135

135-
fn make_tests(config: config) -> [test::test_desc]/~ {
136+
fn make_tests(config: config) -> ~[test::test_desc] {
136137
#debug("making tests from %s", config.src_base);
137-
let mut tests = []/~;
138+
let mut tests = ~[];
138139
for os::list_dir_path(config.src_base).each {|file|
139140
let file = file;
140141
#debug("inspecting file %s", file);
@@ -148,8 +149,8 @@ fn make_tests(config: config) -> [test::test_desc]/~ {
148149
fn is_test(config: config, testfile: str) -> bool {
149150
// Pretty-printer does not work with .rc files yet
150151
let valid_extensions =
151-
alt config.mode { mode_pretty { [".rs"]/~ } _ { [".rc", ".rs"]/~ } };
152-
let invalid_prefixes = [".", "#", "~"]/~;
152+
alt config.mode { mode_pretty { ~[".rs"] } _ { ~[".rc", ".rs"] } };
153+
let invalid_prefixes = ~[".", "#", "~"];
153154
let name = path::basename(testfile);
154155

155156
let mut valid = false;

src/compiletest/errors.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export expected_error;
88
type expected_error = { line: uint, kind: str, msg: str };
99

1010
// Load any test directives embedded in the file
11-
fn load_errors(testfile: str) -> [expected_error]/~ {
12-
let mut error_patterns = []/~;
11+
fn load_errors(testfile: str) -> ~[expected_error] {
12+
let mut error_patterns = ~[];
1313
let rdr = result::get(io::file_reader(testfile));
1414
let mut line_num = 1u;
1515
while !rdr.eof() {
@@ -20,11 +20,11 @@ fn load_errors(testfile: str) -> [expected_error]/~ {
2020
ret error_patterns;
2121
}
2222

23-
fn parse_expected(line_num: uint, line: str) -> [expected_error]/~ unsafe {
23+
fn parse_expected(line_num: uint, line: str) -> ~[expected_error] unsafe {
2424
let error_tag = "//!";
2525
let mut idx;
2626
alt str::find_str(line, error_tag) {
27-
option::none { ret []/~; }
27+
option::none { ret ~[]; }
2828
option::some(nn) { idx = (nn as uint) + str::len(error_tag); }
2929
}
3030

@@ -49,5 +49,5 @@ fn parse_expected(line_num: uint, line: str) -> [expected_error]/~ unsafe {
4949

5050
#debug("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
5151

52-
ret [{line: line_num - adjust_line, kind: kind, msg: msg}]/~;
52+
ret ~[{line: line_num - adjust_line, kind: kind, msg: msg}];
5353
}

src/compiletest/header.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ export is_test_ignored;
1010

1111
type test_props = {
1212
// Lines that should be expected, in order, on standard out
13-
error_patterns: [str]/~,
13+
error_patterns: ~[str],
1414
// Extra flags to pass to the compiler
1515
compile_flags: option<str>,
1616
// If present, the name of a file that this test should match when
1717
// pretty-printed
1818
pp_exact: option<str>,
1919
// Modules from aux directory that should be compiled
20-
aux_builds: [str]/~,
20+
aux_builds: ~[str],
2121
// Environment settings to use during execution
22-
exec_env: [(str,str)]/~
22+
exec_env: ~[(str,str)]
2323
};
2424

2525
// Load any test directives embedded in the file
2626
fn load_props(testfile: str) -> test_props {
27-
let mut error_patterns = []/~;
28-
let mut aux_builds = []/~;
29-
let mut exec_env = []/~;
27+
let mut error_patterns = ~[];
28+
let mut aux_builds = ~[];
29+
let mut exec_env = ~[];
3030
let mut compile_flags = option::none;
3131
let mut pp_exact = option::none;
3232
for iter_header(testfile) {|ln|

src/compiletest/procsrv.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import libc::{c_int, pid_t};
55
export run;
66

77
#[cfg(target_os = "win32")]
8-
fn target_env(lib_path: str, prog: str) -> [(str,str)]/~ {
8+
fn target_env(lib_path: str, prog: str) -> ~[(str,str)] {
99

1010
let mut env = os::env();
1111

@@ -27,16 +27,16 @@ fn target_env(lib_path: str, prog: str) -> [(str,str)]/~ {
2727
#[cfg(target_os = "linux")]
2828
#[cfg(target_os = "macos")]
2929
#[cfg(target_os = "freebsd")]
30-
fn target_env(_lib_path: str, _prog: str) -> [(str,str)]/~ {
31-
[]/~
30+
fn target_env(_lib_path: str, _prog: str) -> ~[(str,str)] {
31+
~[]
3232
}
3333

3434

3535
// FIXME (#2659): This code is duplicated in core::run::program_output
3636
fn run(lib_path: str,
3737
prog: str,
38-
args: [str]/~,
39-
env: [(str, str)]/~,
38+
args: ~[str],
39+
env: ~[(str, str)],
4040
input: option<str>) -> {status: int, out: str, err: str} {
4141

4242
let pipe_in = os::pipe();

src/compiletest/runtest.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn run_pretty_test(config: config, props: test_props, testfile: str) {
9292
let rounds =
9393
alt props.pp_exact { option::some(_) { 1 } option::none { 2 } };
9494

95-
let mut srcs = [result::get(io::read_whole_file_str(testfile))]/~;
95+
let mut srcs = ~[result::get(io::read_whole_file_str(testfile))];
9696

9797
let mut round = 0;
9898
while round < rounds {
@@ -139,12 +139,12 @@ fn run_pretty_test(config: config, props: test_props, testfile: str) {
139139

140140
fn print_source(config: config, testfile: str, src: str) -> procres {
141141
compose_and_run(config, testfile, make_pp_args(config, testfile),
142-
[]/~, config.compile_lib_path, option::some(src))
142+
~[], config.compile_lib_path, option::some(src))
143143
}
144144

145145
fn make_pp_args(config: config, _testfile: str) -> procargs {
146146
let prog = config.rustc_path;
147-
let args = ["-", "--pretty", "normal"]/~;
147+
let args = ~["-", "--pretty", "normal"];
148148
ret {prog: prog, args: args};
149149
}
150150

@@ -178,8 +178,8 @@ actual:\n\
178178

179179
fn make_typecheck_args(config: config, testfile: str) -> procargs {
180180
let prog = config.rustc_path;
181-
let mut args = ["-", "--no-trans", "--lib", "-L", config.build_base,
182-
"-L", aux_output_dir_name(config, testfile)]/~;
181+
let mut args = ~["-", "--no-trans", "--lib", "-L", config.build_base,
182+
"-L", aux_output_dir_name(config, testfile)];
183183
args += split_maybe_args(config.rustcflags);
184184
ret {prog: prog, args: args};
185185
}
@@ -227,7 +227,7 @@ fn check_error_patterns(props: test_props,
227227
}
228228
}
229229

230-
fn check_expected_errors(expected_errors: [errors::expected_error]/~,
230+
fn check_expected_errors(expected_errors: ~[errors::expected_error],
231231
testfile: str,
232232
procres: procres) {
233233

@@ -286,13 +286,13 @@ fn check_expected_errors(expected_errors: [errors::expected_error]/~,
286286
}
287287
}
288288

289-
type procargs = {prog: str, args: [str]/~};
289+
type procargs = {prog: str, args: ~[str]};
290290

291291
type procres = {status: int, stdout: str, stderr: str, cmdline: str};
292292

293293
fn compile_test(config: config, props: test_props,
294294
testfile: str) -> procres {
295-
let link_args = ["-L", aux_output_dir_name(config, testfile)]/~;
295+
let link_args = ~["-L", aux_output_dir_name(config, testfile)];
296296
compose_and_run_compiler(
297297
config, props, testfile,
298298
make_compile_args(config, props, link_args,
@@ -319,14 +319,14 @@ fn compose_and_run_compiler(
319319
ensure_dir(aux_output_dir_name(config, testfile));
320320
}
321321

322-
let extra_link_args = ["-L", aux_output_dir_name(config, testfile)]/~;
322+
let extra_link_args = ~["-L", aux_output_dir_name(config, testfile)];
323323

324324
vec::iter(props.aux_builds) {|rel_ab|
325325
let abs_ab = path::connect(config.aux_base, rel_ab);
326326
let aux_args =
327-
make_compile_args(config, props, ["--lib"]/~ + extra_link_args,
327+
make_compile_args(config, props, ~["--lib"] + extra_link_args,
328328
{|a,b|make_lib_name(a, b, testfile)}, abs_ab);
329-
let auxres = compose_and_run(config, abs_ab, aux_args, []/~,
329+
let auxres = compose_and_run(config, abs_ab, aux_args, ~[],
330330
config.compile_lib_path, option::none);
331331
if auxres.status != 0 {
332332
fatal_procres(
@@ -335,7 +335,7 @@ fn compose_and_run_compiler(
335335
}
336336
}
337337

338-
compose_and_run(config, testfile, args, []/~,
338+
compose_and_run(config, testfile, args, ~[],
339339
config.compile_lib_path, input)
340340
}
341341

@@ -348,19 +348,19 @@ fn ensure_dir(path: path) {
348348

349349
fn compose_and_run(config: config, testfile: str,
350350
procargs: procargs,
351-
procenv: [(str, str)]/~,
351+
procenv: ~[(str, str)],
352352
lib_path: str,
353353
input: option<str>) -> procres {
354354
ret program_output(config, testfile, lib_path,
355355
procargs.prog, procargs.args, procenv, input);
356356
}
357357

358-
fn make_compile_args(config: config, props: test_props, extras: [str]/~,
358+
fn make_compile_args(config: config, props: test_props, extras: ~[str],
359359
xform: fn(config, str) -> str, testfile: str) ->
360360
procargs {
361361
let prog = config.rustc_path;
362-
let mut args = [testfile, "-o", xform(config, testfile),
363-
"-L", config.build_base]/~ + extras;
362+
let mut args = ~[testfile, "-o", xform(config, testfile),
363+
"-L", config.build_base] + extras;
364364
args += split_maybe_args(config.rustcflags);
365365
args += split_maybe_args(props.compile_flags);
366366
ret {prog: prog, args: args};
@@ -390,12 +390,12 @@ fn make_run_args(config: config, _props: test_props, testfile: str) ->
390390
split_maybe_args(runtool)
391391
};
392392

393-
let args = toolargs + [make_exe_name(config, testfile)]/~;
393+
let args = toolargs + ~[make_exe_name(config, testfile)];
394394
ret {prog: args[0], args: vec::slice(args, 1u, vec::len(args))};
395395
}
396396

397-
fn split_maybe_args(argstr: option<str>) -> [str]/~ {
398-
fn rm_whitespace(v: [str]/~) -> [str]/~ {
397+
fn split_maybe_args(argstr: option<str>) -> ~[str] {
398+
fn rm_whitespace(v: ~[str]) -> ~[str] {
399399
fn flt(&&s: str) -> option<str> {
400400
if !str::is_whitespace(s) { option::some(s) } else { option::none }
401401
}
@@ -404,12 +404,12 @@ fn split_maybe_args(argstr: option<str>) -> [str]/~ {
404404

405405
alt argstr {
406406
option::some(s) { rm_whitespace(str::split_char(s, ' ')) }
407-
option::none { []/~ }
407+
option::none { ~[] }
408408
}
409409
}
410410

411411
fn program_output(config: config, testfile: str, lib_path: str, prog: str,
412-
args: [str]/~, env: [(str, str)]/~,
412+
args: ~[str], env: ~[(str, str)],
413413
input: option<str>) -> procres {
414414
let cmdline =
415415
{
@@ -429,12 +429,12 @@ fn program_output(config: config, testfile: str, lib_path: str, prog: str,
429429
#[cfg(target_os = "linux")]
430430
#[cfg(target_os = "macos")]
431431
#[cfg(target_os = "freebsd")]
432-
fn make_cmdline(_libpath: str, prog: str, args: [str]/~) -> str {
432+
fn make_cmdline(_libpath: str, prog: str, args: ~[str]) -> str {
433433
#fmt["%s %s", prog, str::connect(args, " ")]
434434
}
435435

436436
#[cfg(target_os = "win32")]
437-
fn make_cmdline(libpath: str, prog: str, args: [str]/~) -> str {
437+
fn make_cmdline(libpath: str, prog: str, args: ~[str]) -> str {
438438
#fmt["%s %s %s", lib_path_cmd_prefix(libpath), prog,
439439
str::connect(args, " ")]
440440
}
@@ -454,7 +454,7 @@ fn dump_output(config: config, testfile: str, out: str, err: str) {
454454
fn dump_output_file(config: config, testfile: str, out: str, extension: str) {
455455
let outfile = make_out_name(config, testfile, extension);
456456
let writer = result::get(
457-
io::file_writer(outfile, [io::create, io::truncate]/~));
457+
io::file_writer(outfile, ~[io::create, io::truncate]));
458458
writer.write_str(out);
459459
}
460460

src/fuzzer/ast_match.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std;
22
import vec;
33

4-
fn vec_equal<T>(v: [T]/~, u: [T]/~,
4+
fn vec_equal<T>(v: ~[T], u: ~[T],
55
element_equality_test: fn@(&&T, &&T) -> bool) ->
66
bool {
77
let Lv = vec::len(v);
@@ -20,11 +20,11 @@ pure fn builtin_equal_int(&&a: int, &&b: int) -> bool { ret a == b; }
2020
fn main() {
2121
assert (builtin_equal(5, 5));
2222
assert (!builtin_equal(5, 4));
23-
assert (!vec_equal([5, 5]/~, [5]/~, bind builtin_equal(_, _)));
24-
assert (!vec_equal([5, 5]/~, [5]/~, builtin_equal_int));
25-
assert (!vec_equal([5, 5]/~, [5, 4]/~, builtin_equal_int));
26-
assert (!vec_equal([5, 5]/~, [4, 5]/~, builtin_equal_int));
27-
assert (vec_equal([5, 5]/~, [5, 5]/~, builtin_equal_int));
23+
assert (!vec_equal(~[5, 5], ~[5], bind builtin_equal(_, _)));
24+
assert (!vec_equal(~[5, 5], ~[5], builtin_equal_int));
25+
assert (!vec_equal(~[5, 5], ~[5, 4], builtin_equal_int));
26+
assert (!vec_equal(~[5, 5], ~[4, 5], builtin_equal_int));
27+
assert (vec_equal(~[5, 5], ~[5, 5], builtin_equal_int));
2828

2929
#error("Pass");
3030
}

0 commit comments

Comments
 (0)