Skip to content

Commit ab9c900

Browse files
committed
Merge pull request #2576 from mozilla/incoming
Incoming
2 parents 07bba39 + 11e30b2 commit ab9c900

Some content is hidden

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

49 files changed

+988
-581
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@ x86_64-apple-darwin/
7878
doc/core/
7979
tmp.*.rs
8080
config.stamp
81+
.DS_Store

src/cargo/cargo.rs

+37-39
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ import syntax::diagnostic;
99

1010
import result::{ok, err};
1111
import io::writer_util;
12-
import result;
1312
import std::{map, json, tempfile, term, sort, getopts};
1413
import map::hashmap;
15-
import str;
16-
import vec;
14+
import json::to_str;
1715
import getopts::{optflag, optopt, opt_present};
1816

1917
type package = {
@@ -399,28 +397,28 @@ fn parse_source(name: str, j: json::json) -> source {
399397
}
400398

401399
alt j {
402-
json::dict(_j) {
403-
let mut url = alt _j.find("url") {
400+
json::dict(j) {
401+
let mut url = alt j.find("url") {
404402
some(json::string(u)) {
405-
u
403+
*u
406404
}
407405
_ { fail "needed 'url' field in source"; }
408406
};
409-
let method = alt _j.find("method") {
407+
let method = alt j.find("method") {
410408
some(json::string(u)) {
411-
u
409+
*u
412410
}
413411
_ { assume_source_method(url) }
414412
};
415-
let key = alt _j.find("key") {
413+
let key = alt j.find("key") {
416414
some(json::string(u)) {
417-
some(u)
415+
some(*u)
418416
}
419417
_ { none }
420418
};
421-
let keyfp = alt _j.find("keyfp") {
419+
let keyfp = alt j.find("keyfp") {
422420
some(json::string(u)) {
423-
some(u)
421+
some(*u)
424422
}
425423
_ { none }
426424
};
@@ -450,20 +448,20 @@ fn try_parse_sources(filename: str, sources: map::hashmap<str, source>) {
450448
}
451449
}
452450
ok(_) { fail "malformed sources.json"; }
453-
err(e) { fail #fmt("%s:%u:%u: %s", filename, e.line, e.col, e.msg); }
451+
err(e) { fail #fmt("%s:%s", filename, e.to_str()); }
454452
}
455453
}
456454

457455
fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
458456
let name = alt p.find("name") {
459-
some(json::string(_n)) {
460-
if !valid_pkg_name(_n) {
461-
warn("malformed source json: " + src.name + ", '" + _n + "'"+
457+
some(json::string(n)) {
458+
if !valid_pkg_name(*n) {
459+
warn("malformed source json: " + src.name + ", '" + *n + "'"+
462460
" is an invalid name (alphanumeric, underscores and" +
463461
" dashes only)");
464462
ret;
465463
}
466-
_n
464+
*n
467465
}
468466
_ {
469467
warn("malformed source json: " + src.name + " (missing name)");
@@ -472,13 +470,13 @@ fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
472470
};
473471

474472
let uuid = alt p.find("uuid") {
475-
some(json::string(_n)) {
476-
if !is_uuid(_n) {
477-
warn("malformed source json: " + src.name + ", '" + _n + "'"+
473+
some(json::string(n)) {
474+
if !is_uuid(*n) {
475+
warn("malformed source json: " + src.name + ", '" + *n + "'"+
478476
" is an invalid uuid");
479477
ret;
480478
}
481-
_n
479+
*n
482480
}
483481
_ {
484482
warn("malformed source json: " + src.name + " (missing uuid)");
@@ -487,32 +485,32 @@ fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
487485
};
488486

489487
let url = alt p.find("url") {
490-
some(json::string(_n)) { _n }
488+
some(json::string(n)) { *n }
491489
_ {
492490
warn("malformed source json: " + src.name + " (missing url)");
493491
ret;
494492
}
495493
};
496494

497495
let method = alt p.find("method") {
498-
some(json::string(_n)) { _n }
496+
some(json::string(n)) { *n }
499497
_ {
500498
warn("malformed source json: " + src.name + " (missing method)");
501499
ret;
502500
}
503501
};
504502

505503
let ref = alt p.find("ref") {
506-
some(json::string(_n)) { some(_n) }
504+
some(json::string(n)) { some(*n) }
507505
_ { none }
508506
};
509507

510508
let mut tags = [];
511509
alt p.find("tags") {
512510
some(json::list(js)) {
513-
for js.each {|j|
511+
for (*js).each {|j|
514512
alt j {
515-
json::string(_j) { vec::grow(tags, 1u, _j); }
513+
json::string(j) { vec::grow(tags, 1u, *j); }
516514
_ { }
517515
}
518516
}
@@ -521,7 +519,7 @@ fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
521519
}
522520

523521
let description = alt p.find("description") {
524-
some(json::string(_n)) { _n }
522+
some(json::string(n)) { *n }
525523
_ {
526524
warn("malformed source json: " + src.name
527525
+ " (missing description)");
@@ -570,7 +568,7 @@ fn load_source_info(c: cargo, src: source) {
570568
"(source info is not a dict)");
571569
}
572570
err(e) {
573-
warn(#fmt("%s:%u:%u: %s", src.name, e.line, e.col, e.msg));
571+
warn(#fmt("%s:%s", src.name, e.to_str()));
574572
}
575573
};
576574
}
@@ -582,10 +580,10 @@ fn load_source_packages(c: cargo, src: source) {
582580
let pkgstr = io::read_whole_file_str(pkgfile);
583581
alt json::from_str(result::get(pkgstr)) {
584582
ok(json::list(js)) {
585-
for js.each {|_j|
586-
alt _j {
587-
json::dict(_p) {
588-
load_one_source_package(src, _p);
583+
for (*js).each {|j|
584+
alt j {
585+
json::dict(p) {
586+
load_one_source_package(src, p);
589587
}
590588
_ {
591589
warn("malformed source json: " + src.name +
@@ -599,7 +597,7 @@ fn load_source_packages(c: cargo, src: source) {
599597
"(packages is not a list)");
600598
}
601599
err(e) {
602-
warn(#fmt("%s:%u:%u: %s", src.name, e.line, e.col, e.msg));
600+
warn(#fmt("%s:%s", src.name, e.to_str()));
603601
}
604602
};
605603
}
@@ -766,8 +764,8 @@ fn install_one_crate(c: cargo, path: str, cf: str) {
766764

767765
fn rustc_sysroot() -> str {
768766
alt os::self_exe_path() {
769-
some(_path) {
770-
let path = [_path, "..", "bin", "rustc"];
767+
some(path) {
768+
let path = [path, "..", "bin", "rustc"];
771769
check vec::is_not_empty(path);
772770
let rustc = path::normalize(path::connect_many(path));
773771
#debug(" rustc: %s", rustc);
@@ -1578,18 +1576,18 @@ fn dump_sources(c: cargo) {
15781576
let chash = map::str_hash();
15791577
let child = json::dict(chash);
15801578

1581-
chash.insert("url", json::string(v.url));
1582-
chash.insert("method", json::string(v.method));
1579+
chash.insert("url", json::string(@v.url));
1580+
chash.insert("method", json::string(@v.method));
15831581

15841582
alt copy v.key {
15851583
some(key) {
1586-
chash.insert("key", json::string(key));
1584+
chash.insert("key", json::string(@key));
15871585
}
15881586
_ {}
15891587
}
15901588
alt copy v.keyfp {
15911589
some(keyfp) {
1592-
chash.insert("keyfp", json::string(keyfp));
1590+
chash.insert("keyfp", json::string(@keyfp));
15931591
}
15941592
_ {}
15951593
}

src/libcore/int-template.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ export ord, eq, num;
1616
const min_value: T = -1 as T << (inst::bits - 1 as T);
1717
const max_value: T = min_value - 1 as T;
1818

19-
pure fn min(x: T, y: T) -> T { if x < y { x } else { y } }
20-
pure fn max(x: T, y: T) -> T { if x > y { x } else { y } }
21-
22-
pure fn add(x: T, y: T) -> T { x + y }
23-
pure fn sub(x: T, y: T) -> T { x - y }
24-
pure fn mul(x: T, y: T) -> T { x * y }
25-
pure fn div(x: T, y: T) -> T { x / y }
26-
pure fn rem(x: T, y: T) -> T { x % y }
27-
28-
pure fn lt(x: T, y: T) -> bool { x < y }
29-
pure fn le(x: T, y: T) -> bool { x <= y }
30-
pure fn eq(x: T, y: T) -> bool { x == y }
31-
pure fn ne(x: T, y: T) -> bool { x != y }
32-
pure fn ge(x: T, y: T) -> bool { x >= y }
33-
pure fn gt(x: T, y: T) -> bool { x > y }
19+
pure fn min(&&x: T, &&y: T) -> T { if x < y { x } else { y } }
20+
pure fn max(&&x: T, &&y: T) -> T { if x > y { x } else { y } }
21+
22+
pure fn add(&&x: T, &&y: T) -> T { x + y }
23+
pure fn sub(&&x: T, &&y: T) -> T { x - y }
24+
pure fn mul(&&x: T, &&y: T) -> T { x * y }
25+
pure fn div(&&x: T, &&y: T) -> T { x / y }
26+
pure fn rem(&&x: T, &&y: T) -> T { x % y }
27+
28+
pure fn lt(&&x: T, &&y: T) -> bool { x < y }
29+
pure fn le(&&x: T, &&y: T) -> bool { x <= y }
30+
pure fn eq(&&x: T, &&y: T) -> bool { x == y }
31+
pure fn ne(&&x: T, &&y: T) -> bool { x != y }
32+
pure fn ge(&&x: T, &&y: T) -> bool { x >= y }
33+
pure fn gt(&&x: T, &&y: T) -> bool { x > y }
3434

3535
pure fn is_positive(x: T) -> bool { x > 0 as T }
3636
pure fn is_negative(x: T) -> bool { x < 0 as T }

src/libcore/int-template/int.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const bits: T = 32 as T;
77
const bits: T = 64 as T;
88

99
#[doc = "Produce a uint suitable for use in a hash table"]
10-
pure fn hash(x: int) -> uint { ret x as uint; }
10+
pure fn hash(&&x: int) -> uint { ret x as uint; }
1111

1212
#[doc = "Returns `base` raised to the power of `exponent`"]
1313
fn pow(base: int, exponent: uint) -> int {

0 commit comments

Comments
 (0)