Skip to content

Incoming #2576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jun 13, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d04ed0c
Reorder things in hash_type_structure to make more sense.
msullivan Jun 12, 2012
bffb7db
syntax: clarify that trailing separators are never required
lkuper Jun 12, 2012
8a730a2
Allow trailing comma in vectors. Closes #2482.
lkuper Jun 12, 2012
1655c1a
Add a test for explicit `i` suffix on integer literals
lkuper Jun 12, 2012
d1ec1d4
Treat enums with one variant specially in borrowck: #2573
nikomatsakis Jun 12, 2012
7236097
Change trans::common::block to be a class
catamorphism Jun 12, 2012
ebdf0c2
Correct typo in comment
catamorphism Jun 12, 2012
e67b5b2
Introduce a SHAPE_UNBOXED_VEC shape in order to seperate out vector l…
msullivan Jun 11, 2012
4f61dcb
Introduce an unboxed_vec type
msullivan Jun 12, 2012
ccf4e8c
Make vectors contain the right type descriptor. Closes #2536.
msullivan Jun 12, 2012
35dd717
Simplify a bunch of trans functions to not need the rust type. Remove…
msullivan Jun 12, 2012
e9fc19c
Make git ignore the .DS_Store file on Macs (wherever it is)
catamorphism Jun 12, 2012
aa9d2d8
Handle class destructors correctly in metadata
catamorphism Jun 12, 2012
eadd74b
Test case for previous commit
catamorphism Jun 12, 2012
ac4ac32
cargo: remove leading underscores
erickt Jun 11, 2012
a816176
std: Add a to_str impl for json::error.
erickt Jun 11, 2012
f574cb4
Clean up cargo imports.
erickt Jun 11, 2012
4335ce4
Convert most str and vec fns to slices
erickt Jun 12, 2012
48e877a
Rewrite int/uint helper functions to use refs
erickt Jun 12, 2012
01118be
whitespace cleanup
erickt Jun 12, 2012
2cc0a0e
std: Remove copy from all the hashmap key type params
erickt Jun 12, 2012
b361f6c
Fix json no-implicit-copy warnings
erickt Jun 13, 2012
11e30b2
Forgot to xfail-fast this
catamorphism Jun 13, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ x86_64-apple-darwin/
doc/core/
tmp.*.rs
config.stamp
.DS_Store
76 changes: 37 additions & 39 deletions src/cargo/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import syntax::diagnostic;

import result::{ok, err};
import io::writer_util;
import result;
import std::{map, json, tempfile, term, sort, getopts};
import map::hashmap;
import str;
import vec;
import json::to_str;
import getopts::{optflag, optopt, opt_present};

type package = {
Expand Down Expand Up @@ -399,28 +397,28 @@ fn parse_source(name: str, j: json::json) -> source {
}

alt j {
json::dict(_j) {
let mut url = alt _j.find("url") {
json::dict(j) {
let mut url = alt j.find("url") {
some(json::string(u)) {
u
*u
}
_ { fail "needed 'url' field in source"; }
};
let method = alt _j.find("method") {
let method = alt j.find("method") {
some(json::string(u)) {
u
*u
}
_ { assume_source_method(url) }
};
let key = alt _j.find("key") {
let key = alt j.find("key") {
some(json::string(u)) {
some(u)
some(*u)
}
_ { none }
};
let keyfp = alt _j.find("keyfp") {
let keyfp = alt j.find("keyfp") {
some(json::string(u)) {
some(u)
some(*u)
}
_ { none }
};
Expand Down Expand Up @@ -450,20 +448,20 @@ fn try_parse_sources(filename: str, sources: map::hashmap<str, source>) {
}
}
ok(_) { fail "malformed sources.json"; }
err(e) { fail #fmt("%s:%u:%u: %s", filename, e.line, e.col, e.msg); }
err(e) { fail #fmt("%s:%s", filename, e.to_str()); }
}
}

fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
let name = alt p.find("name") {
some(json::string(_n)) {
if !valid_pkg_name(_n) {
warn("malformed source json: " + src.name + ", '" + _n + "'"+
some(json::string(n)) {
if !valid_pkg_name(*n) {
warn("malformed source json: " + src.name + ", '" + *n + "'"+
" is an invalid name (alphanumeric, underscores and" +
" dashes only)");
ret;
}
_n
*n
}
_ {
warn("malformed source json: " + src.name + " (missing name)");
Expand All @@ -472,13 +470,13 @@ fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
};

let uuid = alt p.find("uuid") {
some(json::string(_n)) {
if !is_uuid(_n) {
warn("malformed source json: " + src.name + ", '" + _n + "'"+
some(json::string(n)) {
if !is_uuid(*n) {
warn("malformed source json: " + src.name + ", '" + *n + "'"+
" is an invalid uuid");
ret;
}
_n
*n
}
_ {
warn("malformed source json: " + src.name + " (missing uuid)");
Expand All @@ -487,32 +485,32 @@ fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
};

let url = alt p.find("url") {
some(json::string(_n)) { _n }
some(json::string(n)) { *n }
_ {
warn("malformed source json: " + src.name + " (missing url)");
ret;
}
};

let method = alt p.find("method") {
some(json::string(_n)) { _n }
some(json::string(n)) { *n }
_ {
warn("malformed source json: " + src.name + " (missing method)");
ret;
}
};

let ref = alt p.find("ref") {
some(json::string(_n)) { some(_n) }
some(json::string(n)) { some(*n) }
_ { none }
};

let mut tags = [];
alt p.find("tags") {
some(json::list(js)) {
for js.each {|j|
for (*js).each {|j|
alt j {
json::string(_j) { vec::grow(tags, 1u, _j); }
json::string(j) { vec::grow(tags, 1u, *j); }
_ { }
}
}
Expand All @@ -521,7 +519,7 @@ fn load_one_source_package(src: source, p: map::hashmap<str, json::json>) {
}

let description = alt p.find("description") {
some(json::string(_n)) { _n }
some(json::string(n)) { *n }
_ {
warn("malformed source json: " + src.name
+ " (missing description)");
Expand Down Expand Up @@ -570,7 +568,7 @@ fn load_source_info(c: cargo, src: source) {
"(source info is not a dict)");
}
err(e) {
warn(#fmt("%s:%u:%u: %s", src.name, e.line, e.col, e.msg));
warn(#fmt("%s:%s", src.name, e.to_str()));
}
};
}
Expand All @@ -582,10 +580,10 @@ fn load_source_packages(c: cargo, src: source) {
let pkgstr = io::read_whole_file_str(pkgfile);
alt json::from_str(result::get(pkgstr)) {
ok(json::list(js)) {
for js.each {|_j|
alt _j {
json::dict(_p) {
load_one_source_package(src, _p);
for (*js).each {|j|
alt j {
json::dict(p) {
load_one_source_package(src, p);
}
_ {
warn("malformed source json: " + src.name +
Expand All @@ -599,7 +597,7 @@ fn load_source_packages(c: cargo, src: source) {
"(packages is not a list)");
}
err(e) {
warn(#fmt("%s:%u:%u: %s", src.name, e.line, e.col, e.msg));
warn(#fmt("%s:%s", src.name, e.to_str()));
}
};
}
Expand Down Expand Up @@ -766,8 +764,8 @@ fn install_one_crate(c: cargo, path: str, cf: str) {

fn rustc_sysroot() -> str {
alt os::self_exe_path() {
some(_path) {
let path = [_path, "..", "bin", "rustc"];
some(path) {
let path = [path, "..", "bin", "rustc"];
check vec::is_not_empty(path);
let rustc = path::normalize(path::connect_many(path));
#debug(" rustc: %s", rustc);
Expand Down Expand Up @@ -1578,18 +1576,18 @@ fn dump_sources(c: cargo) {
let chash = map::str_hash();
let child = json::dict(chash);

chash.insert("url", json::string(v.url));
chash.insert("method", json::string(v.method));
chash.insert("url", json::string(@v.url));
chash.insert("method", json::string(@v.method));

alt copy v.key {
some(key) {
chash.insert("key", json::string(key));
chash.insert("key", json::string(@key));
}
_ {}
}
alt copy v.keyfp {
some(keyfp) {
chash.insert("keyfp", json::string(keyfp));
chash.insert("keyfp", json::string(@keyfp));
}
_ {}
}
Expand Down
30 changes: 15 additions & 15 deletions src/libcore/int-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ export ord, eq, num;
const min_value: T = -1 as T << (inst::bits - 1 as T);
const max_value: T = min_value - 1 as T;

pure fn min(x: T, y: T) -> T { if x < y { x } else { y } }
pure fn max(x: T, y: T) -> T { if x > y { x } else { y } }

pure fn add(x: T, y: T) -> T { x + y }
pure fn sub(x: T, y: T) -> T { x - y }
pure fn mul(x: T, y: T) -> T { x * y }
pure fn div(x: T, y: T) -> T { x / y }
pure fn rem(x: T, y: T) -> T { x % y }

pure fn lt(x: T, y: T) -> bool { x < y }
pure fn le(x: T, y: T) -> bool { x <= y }
pure fn eq(x: T, y: T) -> bool { x == y }
pure fn ne(x: T, y: T) -> bool { x != y }
pure fn ge(x: T, y: T) -> bool { x >= y }
pure fn gt(x: T, y: T) -> bool { x > y }
pure fn min(&&x: T, &&y: T) -> T { if x < y { x } else { y } }
pure fn max(&&x: T, &&y: T) -> T { if x > y { x } else { y } }

pure fn add(&&x: T, &&y: T) -> T { x + y }
pure fn sub(&&x: T, &&y: T) -> T { x - y }
pure fn mul(&&x: T, &&y: T) -> T { x * y }
pure fn div(&&x: T, &&y: T) -> T { x / y }
pure fn rem(&&x: T, &&y: T) -> T { x % y }

pure fn lt(&&x: T, &&y: T) -> bool { x < y }
pure fn le(&&x: T, &&y: T) -> bool { x <= y }
pure fn eq(&&x: T, &&y: T) -> bool { x == y }
pure fn ne(&&x: T, &&y: T) -> bool { x != y }
pure fn ge(&&x: T, &&y: T) -> bool { x >= y }
pure fn gt(&&x: T, &&y: T) -> bool { x > y }

pure fn is_positive(x: T) -> bool { x > 0 as T }
pure fn is_negative(x: T) -> bool { x < 0 as T }
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/int-template/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const bits: T = 32 as T;
const bits: T = 64 as T;

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

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