Skip to content

Commit 329eca6

Browse files
committed
Make vectors uglier ([]/~). Sorry. Should be temporary. Closes #2725.
1 parent c087aaf commit 329eca6

File tree

418 files changed

+4123
-4034
lines changed

Some content is hidden

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

418 files changed

+4123
-4034
lines changed

src/cargo/cargo.rs

+50-47
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ type package = {
2121
method: str,
2222
description: str,
2323
ref: option<str>,
24-
tags: [str],
25-
versions: [(str, str)]
24+
tags: [str]/~,
25+
versions: [(str, str)]/~
2626
};
2727

2828
type local_package = {
2929
name: str,
3030
metaname: str,
3131
version: str,
32-
files: [str]
32+
files: [str]/~
3333
};
3434

3535
type source = @{
@@ -38,7 +38,7 @@ type source = @{
3838
mut method: str,
3939
mut key: option<str>,
4040
mut keyfp: option<str>,
41-
mut packages: [mut package]
41+
mut packages: [mut package]/~
4242
};
4343

4444
type cargo = {
@@ -62,21 +62,21 @@ type crate = {
6262
desc: option<str>,
6363
sigs: option<str>,
6464
crate_type: option<str>,
65-
deps: [str]
65+
deps: [str]/~
6666
};
6767

6868
type options = {
6969
test: bool,
7070
mode: mode,
71-
free: [str],
71+
free: [str]/~,
7272
help: bool,
7373
};
7474

7575
enum mode { system_mode, user_mode, local_mode }
7676

77-
fn opts() -> [getopts::opt] {
77+
fn opts() -> [getopts::opt]/~ {
7878
[optflag("g"), optflag("G"), optflag("test"),
79-
optflag("h"), optflag("help")]
79+
optflag("h"), optflag("help")]/~
8080
}
8181

8282
fn info(msg: str) {
@@ -216,7 +216,7 @@ fn assume_source_method(url: str) -> str {
216216
"curl"
217217
}
218218

219-
fn load_link(mis: [@ast::meta_item]) -> (option<str>,
219+
fn load_link(mis: [@ast::meta_item]/~) -> (option<str>,
220220
option<str>,
221221
option<str>) {
222222
let mut name = none;
@@ -240,7 +240,7 @@ fn load_link(mis: [@ast::meta_item]) -> (option<str>,
240240

241241
fn load_crate(filename: str) -> option<crate> {
242242
let sess = parse::new_parse_sess(none);
243-
let c = parse::parse_crate_from_crate_file(filename, [], sess);
243+
let c = parse::parse_crate_from_crate_file(filename, []/~, sess);
244244

245245
let mut name = none;
246246
let mut vers = none;
@@ -275,15 +275,15 @@ fn load_crate(filename: str) -> option<crate> {
275275
}
276276

277277
type env = @{
278-
mut deps: [str]
278+
mut deps: [str]/~
279279
};
280280

281281
fn goto_view_item(e: env, i: @ast::view_item) {
282282
alt i.node {
283283
ast::view_item_use(ident, metas, id) {
284284
let name_items = attr::find_meta_items_by_name(metas, "name");
285285
let m = if name_items.is_empty() {
286-
metas + [attr::mk_name_value_item_str(@"name", *ident)]
286+
metas + [attr::mk_name_value_item_str(@"name", *ident)]/~
287287
} else {
288288
metas
289289
};
@@ -326,7 +326,7 @@ fn load_crate(filename: str) -> option<crate> {
326326
}
327327

328328
let e = @{
329-
mut deps: []
329+
mut deps: []/~
330330
};
331331
let v = visit::mk_simple_visitor(@{
332332
visit_view_item: {|a|goto_view_item(e, a)},
@@ -424,7 +424,7 @@ fn parse_source(name: str, j: json::json) -> source {
424424
mut method: method,
425425
mut key: key,
426426
mut keyfp: keyfp,
427-
mut packages: [mut] };
427+
mut packages: [mut]/~ };
428428
}
429429
_ { fail "needed dict value in source"; }
430430
};
@@ -498,7 +498,7 @@ fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
498498
_ { none }
499499
};
500500

501-
let mut tags = [];
501+
let mut tags = []/~;
502502
alt p.find("tags") {
503503
some(json::list(js)) {
504504
for (*js).each {|j|
@@ -528,7 +528,7 @@ fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
528528
description: description,
529529
ref: ref,
530530
tags: tags,
531-
versions: []
531+
versions: []/~
532532
};
533533

534534
alt src.packages.position({ |pkg| pkg.uuid == uuid }) {
@@ -595,7 +595,7 @@ fn load_source_packages(c: cargo, src: source) {
595595
};
596596
}
597597

598-
fn build_cargo_options(argv: [str]) -> options {
598+
fn build_cargo_options(argv: [str]/~) -> options {
599599
let match = alt getopts::getopts(argv, opts()) {
600600
result::ok(m) { m }
601601
result::err(f) {
@@ -699,19 +699,19 @@ fn for_each_package(c: cargo, b: fn(source, package)) {
699699
fn run_programs(buildpath: str) {
700700
let newv = os::list_dir_path(buildpath);
701701
for newv.each {|ct|
702-
run::run_program(ct, []);
702+
run::run_program(ct, []/~);
703703
}
704704
}
705705

706706
// Runs rustc in <path + subdir> with the given flags
707707
// and returns <path + subdir>
708708
fn run_in_buildpath(what: str, path: str, subdir: str, cf: str,
709-
extra_flags: [str]) -> option<str> {
709+
extra_flags: [str]/~) -> option<str> {
710710
let buildpath = path::connect(path, subdir);
711711
need_dir(buildpath);
712712
#debug("%s: %s -> %s", what, cf, buildpath);
713713
let p = run::program_output(rustc_sysroot(),
714-
["--out-dir", buildpath, cf] + extra_flags);
714+
["--out-dir", buildpath, cf]/~ + extra_flags);
715715
if p.status != 0 {
716716
error(#fmt["rustc failed: %d\n%s\n%s", p.status, p.err, p.out]);
717717
ret none;
@@ -721,7 +721,7 @@ fn run_in_buildpath(what: str, path: str, subdir: str, cf: str,
721721

722722
fn test_one_crate(_c: cargo, path: str, cf: str) {
723723
let buildpath = alt run_in_buildpath("testing", path, "/test", cf,
724-
[ "--test"]) {
724+
[ "--test"]/~) {
725725
none { ret; }
726726
some(bp) { bp }
727727
};
@@ -730,7 +730,7 @@ fn test_one_crate(_c: cargo, path: str, cf: str) {
730730

731731
fn install_one_crate(c: cargo, path: str, cf: str) {
732732
let buildpath = alt run_in_buildpath("installing", path,
733-
"/build", cf, []) {
733+
"/build", cf, []/~) {
734734
none { ret; }
735735
some(bp) { bp }
736736
};
@@ -758,7 +758,7 @@ fn install_one_crate(c: cargo, path: str, cf: str) {
758758
fn rustc_sysroot() -> str {
759759
alt os::self_exe_path() {
760760
some(path) {
761-
let path = [path, "..", "bin", "rustc"];
761+
let path = [path, "..", "bin", "rustc"]/~;
762762
check vec::is_not_empty(path);
763763
let rustc = path::normalize(path::connect_many(path));
764764
#debug(" rustc: %s", rustc);
@@ -772,7 +772,7 @@ fn install_source(c: cargo, path: str) {
772772
#debug("source: %s", path);
773773
os::change_dir(path);
774774

775-
let mut cratefiles = [];
775+
let mut cratefiles = []/~;
776776
for os::walk_dir(".") {|p|
777777
if str::ends_with(p, ".rc") {
778778
vec::push(cratefiles, p);
@@ -811,11 +811,11 @@ fn install_source(c: cargo, path: str) {
811811
}
812812

813813
fn install_git(c: cargo, wd: str, url: str, ref: option<str>) {
814-
run::program_output("git", ["clone", url, wd]);
814+
run::program_output("git", ["clone", url, wd]/~);
815815
if option::is_some(ref) {
816816
let r = option::get(ref);
817817
os::change_dir(wd);
818-
run::run_program("git", ["checkout", r]);
818+
run::run_program("git", ["checkout", r]/~);
819819
}
820820

821821
install_source(c, wd);
@@ -824,18 +824,18 @@ fn install_git(c: cargo, wd: str, url: str, ref: option<str>) {
824824
fn install_curl(c: cargo, wd: str, url: str) {
825825
let tarpath = path::connect(wd, "pkg.tar");
826826
let p = run::program_output("curl", ["-f", "-s", "-o",
827-
tarpath, url]);
827+
tarpath, url]/~);
828828
if p.status != 0 {
829829
fail #fmt["fetch of %s failed: %s", url, p.err];
830830
}
831831
run::run_program("tar", ["-x", "--strip-components=1",
832-
"-C", wd, "-f", tarpath]);
832+
"-C", wd, "-f", tarpath]/~);
833833
install_source(c, wd);
834834
}
835835

836836
fn install_file(c: cargo, wd: str, path: str) {
837837
run::program_output("tar", ["-x", "--strip-components=1",
838-
"-C", wd, "-f", path]);
838+
"-C", wd, "-f", path]/~);
839839
install_source(c, wd);
840840
}
841841

@@ -868,7 +868,7 @@ fn cargo_suggestion(c: cargo, fallback: fn())
868868
}
869869

870870
fn install_uuid(c: cargo, wd: str, uuid: str) {
871-
let mut ps = [];
871+
let mut ps = []/~;
872872
for_each_package(c, { |s, p|
873873
if p.uuid == uuid {
874874
vec::grow(ps, 1u, (s.name, copy p));
@@ -892,7 +892,7 @@ fn install_uuid(c: cargo, wd: str, uuid: str) {
892892
}
893893

894894
fn install_named(c: cargo, wd: str, name: str) {
895-
let mut ps = [];
895+
let mut ps = []/~;
896896
for_each_package(c, { |s, p|
897897
if p.name == name {
898898
vec::grow(ps, 1u, (s.name, copy p));
@@ -1082,7 +1082,7 @@ fn cmd_install(c: cargo) unsafe {
10821082

10831083
if vec::len(c.opts.free) == 2u {
10841084
let cwd = os::getcwd();
1085-
let status = run::run_program("cp", ["-R", cwd, wd]);
1085+
let status = run::run_program("cp", ["-R", cwd, wd]/~);
10861086

10871087
if status != 0 {
10881088
fail #fmt("could not copy directory: %s", cwd);
@@ -1135,7 +1135,7 @@ fn sync_one_file(c: cargo, dir: str, src: source) -> bool {
11351135
alt copy src.key {
11361136
some(u) {
11371137
let p = run::program_output("curl", ["-f", "-s", "-o", keyfile,
1138-
u]);
1138+
u]/~);
11391139
if p.status != 0 {
11401140
error(#fmt["fetch for source %s (key %s) failed", name, u]);
11411141
ret false;
@@ -1209,7 +1209,7 @@ fn sync_one_git(c: cargo, dir: str, src: source) -> bool {
12091209
}
12101210
else {
12111211
let p = run::program_output("git", ["reset", "--hard",
1212-
"HEAD@{1}"]);
1212+
"HEAD@{1}"]/~);
12131213

12141214
if p.status != 0 {
12151215
msg(name, insecure);
@@ -1218,7 +1218,7 @@ fn sync_one_git(c: cargo, dir: str, src: source) -> bool {
12181218
}
12191219

12201220
if !os::path_exists(path::connect(dir, ".git")) {
1221-
let p = run::program_output("git", ["clone", url, dir]);
1221+
let p = run::program_output("git", ["clone", url, dir]/~);
12221222

12231223
if p.status != 0 {
12241224
error(#fmt["fetch for source %s (url %s) failed", name, url]);
@@ -1231,7 +1231,7 @@ fn sync_one_git(c: cargo, dir: str, src: source) -> bool {
12311231
ret false;
12321232
}
12331233

1234-
let p = run::program_output("git", ["pull"]);
1234+
let p = run::program_output("git", ["pull"]/~);
12351235

12361236
if p.status != 0 {
12371237
error(#fmt["fetch for source %s (url %s) failed", name, url]);
@@ -1244,7 +1244,7 @@ fn sync_one_git(c: cargo, dir: str, src: source) -> bool {
12441244
alt copy src.key {
12451245
some(u) {
12461246
let p = run::program_output("curl", ["-f", "-s", "-o", keyfile,
1247-
u]);
1247+
u]/~);
12481248
if p.status != 0 {
12491249
error(#fmt["fetch for source %s (key %s) failed", name, u]);
12501250
rollback(name, dir, false);
@@ -1303,15 +1303,16 @@ fn sync_one_curl(c: cargo, dir: str, src: source) -> bool {
13031303
url += "/packages.json";
13041304
}
13051305

1306-
let p = run::program_output("curl", ["-f", "-s", "-o", pkgfile, url]);
1306+
let p = run::program_output("curl", ["-f", "-s", "-o", pkgfile, url]/~);
13071307

13081308
if p.status != 0 {
13091309
error(#fmt["fetch for source %s (url %s) failed", name, url]);
13101310
ret false;
13111311
}
13121312
if smart {
13131313
url = src.url + "/source.json";
1314-
let p = run::program_output("curl", ["-f", "-s", "-o", srcfile, url]);
1314+
let p =
1315+
run::program_output("curl", ["-f", "-s", "-o", srcfile, url]/~);
13151316

13161317
if p.status == 0 {
13171318
has_src_file = true;
@@ -1321,7 +1322,7 @@ fn sync_one_curl(c: cargo, dir: str, src: source) -> bool {
13211322
alt copy src.key {
13221323
some(u) {
13231324
let p = run::program_output("curl", ["-f", "-s", "-o", keyfile,
1324-
u]);
1325+
u]/~);
13251326
if p.status != 0 {
13261327
error(#fmt["fetch for source %s (key %s) failed", name, u]);
13271328
ret false;
@@ -1340,7 +1341,7 @@ fn sync_one_curl(c: cargo, dir: str, src: source) -> bool {
13401341
}
13411342

13421343
let mut p = run::program_output("curl", ["-f", "-s", "-o",
1343-
sigfile, url]);
1344+
sigfile, url]/~);
13441345
if p.status != 0 {
13451346
error(#fmt["fetch for source %s (sig %s) failed", name, url]);
13461347
ret false;
@@ -1358,7 +1359,7 @@ fn sync_one_curl(c: cargo, dir: str, src: source) -> bool {
13581359
url = src.url + "/source.json.sig";
13591360

13601361
p = run::program_output("curl", ["-f", "-s", "-o", srcsigfile,
1361-
url]);
1362+
url]/~);
13621363
if p.status != 0 {
13631364
error(#fmt["fetch for source %s (sig %s) failed",
13641365
name, url]);
@@ -1422,13 +1423,15 @@ fn cmd_init(c: cargo) {
14221423
let sigfile = path::connect(c.root, "sources.json.sig");
14231424
let destsrcfile = path::connect(c.root, "sources.json");
14241425

1425-
let p = run::program_output("curl", ["-f", "-s", "-o", srcfile, srcurl]);
1426+
let p =
1427+
run::program_output("curl", ["-f", "-s", "-o", srcfile, srcurl]/~);
14261428
if p.status != 0 {
14271429
error(#fmt["fetch of sources.json failed: %s", p.out]);
14281430
ret;
14291431
}
14301432

1431-
let p = run::program_output("curl", ["-f", "-s", "-o", sigfile, sigurl]);
1433+
let p =
1434+
run::program_output("curl", ["-f", "-s", "-o", sigfile, sigurl]/~);
14321435
if p.status != 0 {
14331436
error(#fmt["fetch of sources.json.sig failed: %s", p.out]);
14341437
ret;
@@ -1530,7 +1533,7 @@ fn cmd_search(c: cargo) {
15301533
fn install_to_dir(srcfile: str, destdir: str) {
15311534
let newfile = path::connect(destdir, path::basename(srcfile));
15321535

1533-
let status = run::run_program("cp", ["-r", srcfile, newfile]);
1536+
let status = run::run_program("cp", ["-r", srcfile, newfile]/~);
15341537
if status == 0 {
15351538
info(#fmt["installed: '%s'", newfile]);
15361539
} else {
@@ -1647,7 +1650,7 @@ fn cmd_sources(c: cargo) {
16471650
mut method: assume_source_method(url),
16481651
mut key: none,
16491652
mut keyfp: none,
1650-
mut packages: [mut]
1653+
mut packages: [mut]/~
16511654
});
16521655
info(#fmt("added source: %s", name));
16531656
}
@@ -1865,7 +1868,7 @@ Commands:
18651868
set-method Change the method for a source.");
18661869
}
18671870

1868-
fn main(argv: [str]) {
1871+
fn main(argv: [str]/~) {
18691872
let o = build_cargo_options(argv);
18701873

18711874
if vec::len(o.free) < 2u {

0 commit comments

Comments
 (0)