Skip to content

Commit ee2d611

Browse files
author
Elly Jones
committed
---
yaml --- r: 6727 b: refs/heads/master c: 7953a5d h: refs/heads/master i: 6725: 9e84d87 6723: 9ccfd88 6719: 9a071d4 v: v3
1 parent bc6e520 commit ee2d611

File tree

13 files changed

+86
-113
lines changed

13 files changed

+86
-113
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: fd1dd76977f808ec40796d6ca66e4bf98de6de9c
2+
refs/heads/master: 7953a5dcfcb779a4a127b34e9cc85b0359c45d1a

trunk/src/cargo/cargo.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import rustc::syntax::parse::parser;
66
import std::fs;
77
import std::generic_os;
88
import std::io;
9+
import std::json;
910
import option;
1011
import option::{none, some};
1112
import std::os;
@@ -206,6 +207,36 @@ fn install_file(c: cargo, wd: str, _path: str) {
206207
install_source(c, wd);
207208
}
208209

210+
fn install_resolved(c: cargo, wd: str, key: str) {
211+
fs::remove_dir(wd);
212+
let u = "https://rust-package-index.appspot.com/pkg/" + key;
213+
let p = run::program_output("curl", [u]);
214+
if p.status != 0 {
215+
fail #fmt["Fetch of %s failed: %s", u, p.err];
216+
}
217+
let j = json::from_str(p.out);
218+
alt j {
219+
some (json::dict(_j)) {
220+
alt _j.find("install") {
221+
some (json::string(g)) {
222+
log #fmt["Resolved: %s -> %s", key, g];
223+
cmd_install(c, ["cargo", "install", g]);
224+
}
225+
_ { fail #fmt["Bogus install: '%s'", p.out]; }
226+
}
227+
}
228+
_ { fail #fmt["Bad json: '%s'", p.out]; }
229+
}
230+
}
231+
232+
fn install_uuid(c: cargo, wd: str, uuid: str) {
233+
install_resolved(c, wd, "by-uuid/" + uuid);
234+
}
235+
236+
fn install_named(c: cargo, wd: str, name: str) {
237+
install_resolved(c, wd, "by-name/" + name);
238+
}
239+
209240
fn cmd_install(c: cargo, argv: [str]) {
210241
// cargo install <pkg>
211242
if vec::len(argv) < 3u {
@@ -226,6 +257,11 @@ fn cmd_install(c: cargo, argv: [str]) {
226257
} else if str::starts_with(argv[2], "file:") {
227258
let path = rest(argv[2], 5u);
228259
install_file(c, wd, path);
260+
} else if str::starts_with(argv[2], "uuid:") {
261+
let uuid = rest(argv[2], 5u);
262+
install_uuid(c, wd, uuid);
263+
} else {
264+
install_named(c, wd, argv[2]);
229265
}
230266
}
231267

trunk/src/comp/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ fn get_tag_variants(_data: @[u8], def: ast::def_id, tcx: ty::ctxt,
244244

245245
}
246246
}
247-
infos += [@{args: arg_tys, ctor_ty: ctor_ty, id: did}];
247+
infos += [{args: arg_tys, ctor_ty: ctor_ty, id: did}];
248248
}
249249
ret infos;
250250
}

trunk/src/comp/middle/check_alt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
149149
}
150150
pat_tag(_, args) {
151151
let vdef = variant_def_ids(tcx.def_map.get(pat.id));
152-
if vec::len(*ty::tag_variants(tcx, vdef.tg)) != 1u { ret true; }
152+
if vec::len(ty::tag_variants(tcx, vdef.tg)) != 1u { ret true; }
153153
for p: @pat in args { if is_refutable(tcx, p) { ret true; } }
154154
false
155155
}

trunk/src/comp/middle/gc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fn type_is_gc_relevant(cx: ty::ctxt, ty: ty::t) -> bool {
128128

129129
ty::ty_tag(did, tps) {
130130
let variants = ty::tag_variants(cx, did);
131-
for variant in *variants {
131+
for variant in variants {
132132
for aty in variant.args {
133133
let arg_ty = ty::substitute_type_params(cx, tps, aty);
134134
if type_is_gc_relevant(cx, arg_ty) { ret true; }

trunk/src/comp/middle/mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn expr_root(tcx: ty::ctxt, ex: @expr, autoderef: bool) ->
3232
}
3333
ty::ty_tag(did, tps) {
3434
let variants = ty::tag_variants(tcx, did);
35-
if vec::len(*variants) != 1u ||
35+
if vec::len(variants) != 1u ||
3636
vec::len(variants[0].args) != 1u {
3737
break;
3838
}

trunk/src/comp/middle/shape.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn largest_variants(ccx: @crate_ctxt, tag_id: ast::def_id) -> [uint] {
106106
// just T.
107107
let ranges = [];
108108
let variants = ty::tag_variants(ccx.tcx, tag_id);
109-
for variant: ty::variant_info in *variants {
109+
for variant: ty::variant_info in variants {
110110
let bounded = true;
111111
let {a: min_size, b: min_align} = {a: 0u, b: 0u};
112112
for elem_t: ty::t in variant.args {
@@ -134,7 +134,7 @@ fn largest_variants(ccx: @crate_ctxt, tag_id: ast::def_id) -> [uint] {
134134

135135
// Initialize the candidate set to contain all variants.
136136
let candidates = [mutable];
137-
for variant in *variants { candidates += [mutable true]; }
137+
for variant in variants { candidates += [mutable true]; }
138138

139139
// Do a pairwise comparison among all variants still in the candidate set.
140140
// Throw out any variant that we know has size and alignment at least as
@@ -214,7 +214,7 @@ fn compute_static_tag_size(ccx: @crate_ctxt, largest_variants: [uint],
214214
// Add space for the tag if applicable.
215215
// FIXME (issue #792): This is wrong. If the tag starts with an 8 byte
216216
// aligned quantity, we don't align it.
217-
if vec::len(*variants) > 1u {
217+
if vec::len(variants) > 1u {
218218
let variant_t = T_tag_variant(ccx);
219219
max_size += trans::llsize_of_real(ccx, variant_t) as u16;
220220
let align = trans::llalign_of_real(ccx, variant_t) as u8;
@@ -228,11 +228,11 @@ tag tag_kind { tk_unit; tk_enum; tk_complex; }
228228

229229
fn tag_kind(ccx: @crate_ctxt, did: ast::def_id) -> tag_kind {
230230
let variants = ty::tag_variants(ccx.tcx, did);
231-
if vec::len(*variants) == 0u { ret tk_complex; }
232-
for v: ty::variant_info in *variants {
231+
if vec::len(variants) == 0u { ret tk_complex; }
232+
for v: ty::variant_info in variants {
233233
if vec::len(v.args) > 0u { ret tk_complex; }
234234
}
235-
if vec::len(*variants) == 1u { ret tk_unit; }
235+
if vec::len(variants) == 1u { ret tk_unit; }
236236
ret tk_enum;
237237
}
238238

@@ -452,7 +452,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
452452
let item_tyt = ty::lookup_item_type(ccx.tcx, did);
453453
let ty_param_count = vec::len(item_tyt.kinds);
454454

455-
for v: ty::variant_info in *variants {
455+
for v: ty::variant_info in variants {
456456
offsets += [vec::len(data) as u16];
457457

458458
let variant_shape = shape_of_variant(ccx, v, ty_param_count);
@@ -476,7 +476,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
476476
let did = did_; // Satisfy alias checker.
477477
let variants = ty::tag_variants(ccx.tcx, did);
478478
add_u16(header, header_sz + info_sz);
479-
info_sz += 2u16 * ((vec::len(*variants) as u16) + 2u16) + 3u16;
479+
info_sz += 2u16 * ((vec::len(variants) as u16) + 2u16) + 3u16;
480480
}
481481

482482
// Construct the info tables, which contain offsets to the shape of each
@@ -488,7 +488,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
488488
for did_: ast::def_id in ccx.shape_cx.tag_order {
489489
let did = did_; // Satisfy alias checker.
490490
let variants = ty::tag_variants(ccx.tcx, did);
491-
add_u16(info, vec::len(*variants) as u16);
491+
add_u16(info, vec::len(variants) as u16);
492492

493493
// Construct the largest-variants table.
494494
add_u16(info,
@@ -500,7 +500,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
500500

501501
// Determine whether the tag has dynamic size.
502502
let dynamic = false;
503-
for variant: ty::variant_info in *variants {
503+
for variant: ty::variant_info in variants {
504504
for typ: ty::t in variant.args {
505505
if ty::type_has_dynamic_size(ccx.tcx, typ) { dynamic = true; }
506506
}
@@ -516,7 +516,7 @@ fn gen_tag_shapes(ccx: @crate_ctxt) -> ValueRef {
516516
info += [size_align.align];
517517

518518
// Now write in the offset of each variant.
519-
for v: ty::variant_info in *variants {
519+
for v: ty::variant_info in variants {
520520
add_u16(info, header_sz + info_sz + offsets[i]);
521521
i += 1u;
522522
}

trunk/src/comp/middle/trans.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ fn type_of_inner(cx: @crate_ctxt, sp: span, t: ty::t)
211211

212212
fn type_of_tag(cx: @crate_ctxt, sp: span, did: ast::def_id, t: ty::t)
213213
-> TypeRef {
214-
let degen = vec::len(*ty::tag_variants(cx.tcx, did)) == 1u;
214+
let degen = vec::len(ty::tag_variants(cx.tcx, did)) == 1u;
215215
if check type_has_static_size(cx, t) {
216216
let size = static_size_of_tag(cx, sp, t);
217217
if !degen { T_tag(cx, size) }
@@ -511,7 +511,7 @@ fn static_size_of_tag(cx: @crate_ctxt, sp: span, t: ty::t)
511511

512512
let max_size = 0u;
513513
let variants = ty::tag_variants(cx.tcx, tid);
514-
for variant: ty::variant_info in *variants {
514+
for variant: ty::variant_info in variants {
515515
let tup_ty = simplify_type(cx, ty::mk_tup(cx.tcx, variant.args));
516516
// Perform any type parameter substitutions.
517517

@@ -592,7 +592,7 @@ fn dynamic_size_of(cx: @block_ctxt, t: ty::t, mode: align_mode) -> result {
592592
let max_size: ValueRef = alloca(bcx, ccx.int_type);
593593
Store(bcx, C_int(ccx, 0), max_size);
594594
let variants = ty::tag_variants(bcx_tcx(bcx), tid);
595-
for variant: ty::variant_info in *variants {
595+
for variant: ty::variant_info in variants {
596596
// Perform type substitution on the raw argument types.
597597

598598
let raw_tys: [ty::t] = variant.args;
@@ -609,7 +609,7 @@ fn dynamic_size_of(cx: @block_ctxt, t: ty::t, mode: align_mode) -> result {
609609
}
610610
let max_size_val = Load(bcx, max_size);
611611
let total_size =
612-
if vec::len(*variants) != 1u {
612+
if vec::len(variants) != 1u {
613613
Add(bcx, max_size_val, llsize_of(ccx, ccx.int_type))
614614
} else { max_size_val };
615615
ret rslt(bcx, total_size);
@@ -1693,7 +1693,7 @@ fn iter_structural_ty(cx: @block_ctxt, av: ValueRef, t: ty::t,
16931693
}
16941694
ty::ty_tag(tid, tps) {
16951695
let variants = ty::tag_variants(bcx_tcx(cx), tid);
1696-
let n_variants = vec::len(*variants);
1696+
let n_variants = vec::len(variants);
16971697

16981698
// Cast the tags to types we can GEP into.
16991699
if n_variants == 1u {
@@ -1715,7 +1715,7 @@ fn iter_structural_ty(cx: @block_ctxt, av: ValueRef, t: ty::t,
17151715
let llswitch = Switch(cx, lldiscrim_a, unr_cx.llbb, n_variants);
17161716
let next_cx = new_sub_block_ctxt(cx, "tag-iter-next");
17171717
let i = 0u;
1718-
for variant: ty::variant_info in *variants {
1718+
for variant: ty::variant_info in variants {
17191719
let variant_cx =
17201720
new_sub_block_ctxt(cx,
17211721
"tag-iter-variant-" +
@@ -2340,7 +2340,7 @@ fn autoderef(cx: @block_ctxt, v: ValueRef, t: ty::t) -> result_t {
23402340
}
23412341
ty::ty_tag(did, tps) {
23422342
let variants = ty::tag_variants(ccx.tcx, did);
2343-
if vec::len(*variants) != 1u ||
2343+
if vec::len(variants) != 1u ||
23442344
vec::len(variants[0].args) != 1u {
23452345
break;
23462346
}
@@ -2714,7 +2714,7 @@ fn trans_var(cx: @block_ctxt, sp: span, def: ast::def, id: ast::node_id)
27142714
let bcx = alloc_result.bcx;
27152715
let lltagptr = PointerCast(bcx, lltagblob, T_ptr(lltagty));
27162716
let lldiscrimptr = GEPi(bcx, lltagptr, [0, 0]);
2717-
let d = if vec::len(*ty::tag_variants(ccx.tcx, tid)) != 1u {
2717+
let d = if vec::len(ty::tag_variants(ccx.tcx, tid)) != 1u {
27182718
let lldiscrim_gv = lookup_discriminant(bcx.fcx.lcx, vid);
27192719
let lldiscrim = Load(bcx, lldiscrim_gv);
27202720
lldiscrim

trunk/src/comp/middle/trans_alt.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn variant_opt(ccx: @crate_ctxt, pat_id: ast::node_id) -> opt {
6565
let vdef = ast_util::variant_def_ids(ccx.tcx.def_map.get(pat_id));
6666
let variants = ty::tag_variants(ccx.tcx, vdef.tg);
6767
let i = 0u;
68-
for v: ty::variant_info in *variants {
68+
for v: ty::variant_info in variants {
6969
if vdef.var == v.id { ret var(i, vdef); }
7070
i += 1u;
7171
}
@@ -265,7 +265,7 @@ fn extract_variant_args(bcx: @block_ctxt, pat_id: ast::node_id,
265265
let args = [];
266266
let size =
267267
vec::len(ty::tag_variant_with_id(ccx.tcx, vdefs.tg, vdefs.var).args);
268-
if size > 0u && vec::len(*variants) != 1u {
268+
if size > 0u && vec::len(variants) != 1u {
269269
let tagptr =
270270
PointerCast(bcx, val, trans_common::T_opaque_tag_ptr(ccx));
271271
blobptr = GEPi(bcx, tagptr, [0, 1]);
@@ -470,7 +470,7 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
470470
if vec::len(opts) > 0u {
471471
alt opts[0] {
472472
var(_, vdef) {
473-
if vec::len(*ty::tag_variants(ccx.tcx, vdef.tg)) == 1u {
473+
if vec::len(ty::tag_variants(ccx.tcx, vdef.tg)) == 1u {
474474
kind = single;
475475
} else {
476476
let tagptr =

0 commit comments

Comments
 (0)