Skip to content

Commit cd02046

Browse files
committed
merge
2 parents 3685d53 + 0327dc0 commit cd02046

Some content is hidden

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

76 files changed

+748
-573
lines changed

Makefile.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,9 @@ else
421421
TSREQS := \
422422
$(foreach target,$(CFG_TARGET_TRIPLES), \
423423
$(SREQ3_T_$(target)_H_$(CFG_HOST_TRIPLE)))
424-
FUZZ := $(HBIN3_H_$(CFG_HOST_TRIPLE))/fuzzer$(X)
425-
CARGO := $(HBIN3_H_$(CFG_HOST_TRIPLE))/cargo$(X)
426-
RUSTDOC := $(HBIN3_H_$(CFG_HOST_TRIPLE))/rustdoc$(X)
424+
FUZZ := $(HBIN2_H_$(CFG_HOST_TRIPLE))/fuzzer$(X)
425+
CARGO := $(HBIN2_H_$(CFG_HOST_TRIPLE))/cargo$(X)
426+
RUSTDOC := $(HBIN2_H_$(CFG_HOST_TRIPLE))/rustdoc$(X)
427427

428428
all: rustc $(GENERATED) docs $(FUZZ) $(CARGO) $(RUSTDOC)
429429

src/cargo/cargo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ fn try_parse_sources(filename: str, sources: map::hashmap<str, source>) {
332332
}
333333
}
334334

335-
fn load_one_source_package(&src: source, p: map::hashmap<str, json::json>) {
335+
fn load_one_source_package(&&src: source, p: map::hashmap<str, json::json>) {
336336
let name = alt p.find("name") {
337337
some(json::string(_n)) { _n }
338338
_ {
@@ -404,8 +404,8 @@ fn load_one_source_package(&src: source, p: map::hashmap<str, json::json>) {
404404
log(debug, " loaded package: " + src.name + "/" + name);
405405
}
406406

407-
fn load_source_packages(&c: cargo, &src: source) {
408-
log(debug, "loading source: " + src.name);
407+
fn load_source_packages(&&c: cargo, &&src: source) {
408+
log(debug, "Loading source: " + src.name);
409409
let dir = path::connect(c.sourcedir, src.name);
410410
let pkgfile = path::connect(dir, "packages.json");
411411
if !os::path_exists(pkgfile) { ret; }

src/libcore/cmp.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#[doc="Interfaces used for comparison."]
2+
3+
iface ord {
4+
fn lt(&&other: self) -> bool;
5+
}
6+
7+
iface eq {
8+
fn eq(&&other: self) -> bool;
9+
}
10+

src/libcore/core.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export extfmt;
4444
export tuple;
4545
export to_str;
4646
export dvec, dvec_iter;
47+
export cmp;
4748

4849
// NDM seems to be necessary for resolve to work
4950
export option_iter;
@@ -152,6 +153,7 @@ mod tuple;
152153

153154
// Ubiquitous-utility-type modules
154155

156+
mod cmp;
155157
mod either;
156158
mod iter;
157159
mod logging;

src/libcore/dvec.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ fn dvec<A>() -> dvec<A> {
5757
{mut data: [mut]}
5858
}
5959

60+
#[doc = "Creates a new dvec with a single element"]
61+
fn from_elt<A>(+e: A) -> dvec<A> {
62+
{mut data: [mut e]}
63+
}
64+
6065
#[doc = "Creates a new dvec with the contents of a vector"]
6166
fn from_vec<A>(+v: [mut A]) -> dvec<A> {
6267
{mut data: v}
@@ -234,12 +239,19 @@ impl extensions<A:copy> for dvec<A> {
234239
self.data[idx] = a;
235240
}
236241

237-
#[doc = "Overwrites the contents of the element at `idx` with `a`"]
242+
#[doc = "Overwrites the contents of the element at `idx` with `a`,
243+
growing the vector if necessary. New elements will be initialized
244+
with `initval`"]
238245
fn grow_set_elt(idx: uint, initval: A, val: A) {
239246
self.swap { |v|
240247
let mut v <- v;
241248
vec::grow_set(v, idx, initval, val);
242249
v
243250
}
244251
}
252+
253+
#[doc = "Returns the last element, failing if the vector is empty"]
254+
fn last() -> A {
255+
self.get_elt(self.len() - 1u)
256+
}
245257
}

src/libcore/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn get<A:copy>(future: future<A>) -> A {
108108
fn with<A,B>(future: future<A>, blk: fn(A) -> B) -> B {
109109
#[doc = "Work with the value without copying it"];
110110

111-
let v = alt future.v {
111+
let v = alt copy future.v {
112112
either::left(v) { v }
113113
either::right(f) {
114114
let v = @f();

src/libcore/int-template.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import T = inst::T;
2+
import cmp::{eq, ord};
23

34
export min_value, max_value;
45
export min, max;
@@ -10,6 +11,7 @@ export range;
1011
export compl;
1112
export abs;
1213
export parse_buf, from_str, to_str, to_str_bytes, str;
14+
export ord, eq;
1315

1416
const min_value: T = -1 as T << (inst::bits - 1 as T);
1517
const max_value: T = min_value - 1 as T;
@@ -108,6 +110,18 @@ fn to_str_bytes<U>(n: T, radix: uint, f: fn([u8]/&) -> U) -> U {
108110
#[doc = "Convert to a string"]
109111
fn str(i: T) -> str { ret to_str(i, 10u); }
110112

113+
impl ord of ord for T {
114+
fn lt(&&other: T) -> bool {
115+
ret self < other;
116+
}
117+
}
118+
119+
impl eq of eq for T {
120+
fn eq(&&other: T) -> bool {
121+
ret self == other;
122+
}
123+
}
124+
111125

112126
// FIXME: Has alignment issues on windows and 32-bit linux
113127
#[test]

src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ impl of writer for mem_buffer {
613613
// FIXME #2004--use memcpy here?
614614
let mut pos = self.pos, vpos = 0u;
615615
while vpos < vlen && pos < buf_len {
616-
self.buf.set_elt(pos, v[vpos]);
616+
self.buf.set_elt(pos, copy v[vpos]);
617617
pos += 1u;
618618
vpos += 1u;
619619
}

src/libcore/rand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl extensions for rng {
218218
}
219219

220220
#[doc = "Shuffle a mutable vec in place"]
221-
fn shuffle_mut<T>(&values: [mut T]) {
221+
fn shuffle_mut<T>(&&values: [mut T]) {
222222
let mut i = values.len();
223223
while i >= 2u {
224224
// invariant: elements with index >= i have been locked in place.

0 commit comments

Comments
 (0)