Skip to content

Commit 5eaa4d1

Browse files
committed
Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls
2 parents 5e7b666 + 6972eb4 commit 5eaa4d1

File tree

137 files changed

+1283
-1217
lines changed

Some content is hidden

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

137 files changed

+1283
-1217
lines changed

mk/target.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
4848
| $$(TLIB$(1)_T_$(2)_H_$(3))/
4949
@$$(call E, compile_and_link: $$@)
5050
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
51-
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@
51+
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
5252
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
5353

5454
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)): \
@@ -58,7 +58,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)): \
5858
| $$(TLIB$(1)_T_$(2)_H_$(3))/
5959
@$$(call E, compile_and_link: $$@)
6060
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@))
61-
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@
61+
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
6262
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@))
6363

6464
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
@@ -69,7 +69,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
6969
| $$(TLIB$(1)_T_$(2)_H_$(3))/
7070
@$$(call E, compile_and_link: $$@)
7171
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
72-
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) -o $$@ $$< && touch $$@
72+
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) --out-dir $$(@D) $$< && touch $$@
7373
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
7474

7575
# Only build the compiler for host triples
@@ -90,7 +90,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
9090
| $$(TLIB$(1)_T_$(2)_H_$(3))/
9191
@$$(call E, compile_and_link: $$@)
9292
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
93-
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
93+
$$(STAGE$(1)_T_$(2)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
9494
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
9595

9696
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \

mk/tools.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)): \
4949
| $$(TLIB$(1)_T_$(4)_H_$(3))/
5050
@$$(call E, compile_and_link: $$@)
5151
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTPKG_GLOB_$(4)),$$(notdir $$@))
52-
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@
52+
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
5353
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTPKG_GLOB_$(4)),$$(notdir $$@))
5454

5555
$$(TBIN$(1)_T_$(4)_H_$(3))/rustpkg$$(X_$(4)): \
@@ -67,7 +67,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)): \
6767
| $$(TLIB$(1)_T_$(4)_H_$(3))/
6868
@$$(call E, compile_and_link: $$@)
6969
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTDOC_GLOB_$(4)),$$(notdir $$@))
70-
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
70+
$$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
7171
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTDOC_GLOB_$(4)),$$(notdir $$@))
7272

7373
$$(TBIN$(1)_T_$(4)_H_$(3))/rustdoc$$(X_$(4)): \
@@ -85,7 +85,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTI_$(4)): \
8585
| $$(TLIB$(1)_T_$(4)_H_$(3))/
8686
@$$(call E, compile_and_link: $$@)
8787
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTI_GLOB_$(4)),$$(notdir $$@))
88-
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
88+
$$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
8989
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTI_GLOB_$(4)),$$(notdir $$@))
9090

9191
$$(TBIN$(1)_T_$(4)_H_$(3))/rusti$$(X_$(4)): \
@@ -106,7 +106,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)): \
106106
| $$(TLIB$(1)_T_$(4)_H_$(3))/
107107
@$$(call E, compile_and_link: $$@)
108108
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@))
109-
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
109+
$$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
110110
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@))
111111

112112
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)): \

src/compiletest/compiletest.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#[crate_type = "bin"];
1212

1313
#[allow(non_camel_case_types)];
14-
#[allow(unrecognized_lint)]; // NOTE: remove after snapshot
1514
#[deny(warnings)];
1615

1716
extern mod extra;
@@ -131,7 +130,7 @@ pub fn parse_config(args: ~[~str]) -> config {
131130
ratchet_noise_percent:
132131
getopts::opt_maybe_str(matches,
133132
"ratchet-noise-percent").map(|s|
134-
f64::from_str(*s).get()),
133+
f64::from_str(*s).unwrap()),
135134
runtool: getopts::opt_maybe_str(matches, "runtool"),
136135
rustcflags: getopts::opt_maybe_str(matches, "rustcflags"),
137136
jit: getopts::opt_present(matches, "jit"),
@@ -267,7 +266,7 @@ pub fn is_test(config: &config, testfile: &Path) -> bool {
267266
_ => ~[~".rc", ~".rs"]
268267
};
269268
let invalid_prefixes = ~[~".", ~"#", ~"~"];
270-
let name = testfile.filename().get();
269+
let name = testfile.filename().unwrap();
271270

272271
let mut valid = false;
273272

@@ -300,7 +299,7 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
300299
fn shorten(path: &Path) -> ~str {
301300
let filename = path.filename();
302301
let dir = path.pop().filename();
303-
fmt!("%s/%s", dir.get_or_default(~""), filename.get_or_default(~""))
302+
fmt!("%s/%s", dir.unwrap_or_default(~""), filename.unwrap_or_default(~""))
304303
}
305304

306305
test::DynTestName(fmt!("[%s] %s",

src/compiletest/runtest.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
145145
let rounds =
146146
match props.pp_exact { Some(_) => 1, None => 2 };
147147

148-
let mut srcs = ~[io::read_whole_file_str(testfile).get()];
148+
let mut srcs = ~[io::read_whole_file_str(testfile).unwrap()];
149149

150150
let mut round = 0;
151151
while round < rounds {
@@ -166,7 +166,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
166166
match props.pp_exact {
167167
Some(ref file) => {
168168
let filepath = testfile.dir_path().push_rel(file);
169-
io::read_whole_file_str(&filepath).get()
169+
io::read_whole_file_str(&filepath).unwrap()
170170
}
171171
None => { srcs[srcs.len() - 2u].clone() }
172172
};
@@ -448,7 +448,7 @@ fn scan_until_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
448448
if opt.is_none() {
449449
return false;
450450
}
451-
*idx = opt.get();
451+
*idx = opt.unwrap();
452452
return true;
453453
}
454454

@@ -709,7 +709,7 @@ fn aux_output_dir_name(config: &config, testfile: &Path) -> Path {
709709
}
710710

711711
fn output_testname(testfile: &Path) -> Path {
712-
Path(testfile.filestem().get())
712+
Path(testfile.filestem().unwrap())
713713
}
714714

715715
fn output_base_name(config: &config, testfile: &Path) -> Path {
@@ -878,7 +878,7 @@ fn append_suffix_to_stem(p: &Path, suffix: &str) -> Path {
878878
if suffix.len() == 0 {
879879
(*p).clone()
880880
} else {
881-
let stem = p.filestem().get();
881+
let stem = p.filestem().unwrap();
882882
p.with_filestem(stem + "-" + suffix)
883883
}
884884
}
@@ -938,7 +938,7 @@ fn disassemble_extract(config: &config, _props: &TestProps,
938938

939939

940940
fn count_extracted_lines(p: &Path) -> uint {
941-
let x = io::read_whole_file_str(&p.with_filetype("ll")).get();
941+
let x = io::read_whole_file_str(&p.with_filetype("ll")).unwrap();
942942
x.line_iter().len_()
943943
}
944944

src/libextra/base64.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -322,24 +322,24 @@ mod test {
322322
323323
#[test]
324324
fn test_from_base64_basic() {
325-
assert_eq!("".from_base64().get(), "".as_bytes().to_owned());
326-
assert_eq!("Zg==".from_base64().get(), "f".as_bytes().to_owned());
327-
assert_eq!("Zm8=".from_base64().get(), "fo".as_bytes().to_owned());
328-
assert_eq!("Zm9v".from_base64().get(), "foo".as_bytes().to_owned());
329-
assert_eq!("Zm9vYg==".from_base64().get(), "foob".as_bytes().to_owned());
330-
assert_eq!("Zm9vYmE=".from_base64().get(), "fooba".as_bytes().to_owned());
331-
assert_eq!("Zm9vYmFy".from_base64().get(), "foobar".as_bytes().to_owned());
325+
assert_eq!("".from_base64().unwrap(), "".as_bytes().to_owned());
326+
assert_eq!("Zg==".from_base64().unwrap(), "f".as_bytes().to_owned());
327+
assert_eq!("Zm8=".from_base64().unwrap(), "fo".as_bytes().to_owned());
328+
assert_eq!("Zm9v".from_base64().unwrap(), "foo".as_bytes().to_owned());
329+
assert_eq!("Zm9vYg==".from_base64().unwrap(), "foob".as_bytes().to_owned());
330+
assert_eq!("Zm9vYmE=".from_base64().unwrap(), "fooba".as_bytes().to_owned());
331+
assert_eq!("Zm9vYmFy".from_base64().unwrap(), "foobar".as_bytes().to_owned());
332332
}
333333
334334
#[test]
335335
fn test_from_base64_newlines() {
336-
assert_eq!("Zm9v\r\nYmFy".from_base64().get(),
336+
assert_eq!("Zm9v\r\nYmFy".from_base64().unwrap(),
337337
"foobar".as_bytes().to_owned());
338338
}
339339
340340
#[test]
341341
fn test_from_base64_urlsafe() {
342-
assert_eq!("-_8".from_base64().get(), "+/8=".from_base64().get());
342+
assert_eq!("-_8".from_base64().unwrap(), "+/8=".from_base64().unwrap());
343343
}
344344
345345
#[test]
@@ -364,7 +364,7 @@ mod test {
364364
push(random());
365365
}
366366
};
367-
assert_eq!(v.to_base64(STANDARD).from_base64().get(), v);
367+
assert_eq!(v.to_base64(STANDARD).from_base64().unwrap(), v);
368368
}
369369
}
370370

src/libextra/bitv.rs

+22-48
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use std::cmp;
1515
use std::iterator::RandomAccessIterator;
16-
use std::iterator::{Invert, Enumerate};
16+
use std::iterator::{Invert, Enumerate, Repeat, Map, Zip};
1717
use std::num;
1818
use std::ops;
1919
use std::uint;
@@ -206,14 +206,13 @@ impl BigBitv {
206206
#[inline]
207207
pub fn equals(&self, b: &BigBitv, nbits: uint) -> bool {
208208
let len = b.storage.len();
209-
do uint::iterate(0, len) |i| {
209+
for i in range(0, len) {
210210
let mask = big_mask(nbits, i);
211211
if mask & self.storage[i] != mask & b.storage[i] {
212-
false
213-
} else {
214-
true
212+
return false;
215213
}
216214
}
215+
true
217216
}
218217
}
219218

@@ -864,13 +863,12 @@ impl BitvSet {
864863
/// w1, w2) where the bit location is the number of bits offset so far,
865864
/// and w1/w2 are the words coming from the two vectors self, other.
866865
fn common_iter<'a>(&'a self, other: &'a BitvSet)
867-
-> MapE<(uint,&uint),(uint,uint,uint), &'a ~[uint],Enumerate<vec::VecIterator<'a,uint>>> {
868-
let min = num::min(self.bitv.storage.len(),
869-
other.bitv.storage.len());
870-
MapE{iter: self.bitv.storage.slice(0, min).iter().enumerate(),
871-
env: &other.bitv.storage,
872-
f: |(i, &w): (uint, &uint), o_store| (i * uint::bits, w, o_store[i])
873-
}
866+
-> Map<'static, ((uint, &'a uint), &'a ~[uint]), (uint, uint, uint),
867+
Zip<Enumerate<vec::VecIterator<'a, uint>>, Repeat<&'a ~[uint]>>> {
868+
let min = num::min(self.bitv.storage.len(), other.bitv.storage.len());
869+
self.bitv.storage.slice(0, min).iter().enumerate()
870+
.zip(Repeat::new(&other.bitv.storage))
871+
.transform(|((i, &w), o_store)| (i * uint::bits, w, o_store[i]))
874872
}
875873

876874
/// Visits each word in self or other that extends beyond the other. This
@@ -881,45 +879,21 @@ impl BitvSet {
881879
/// is true if the word comes from 'self', and false if it comes from
882880
/// 'other'.
883881
fn outlier_iter<'a>(&'a self, other: &'a BitvSet)
884-
-> MapE<(uint, &uint),(bool, uint, uint), uint, Enumerate<vec::VecIterator<'a, uint>>> {
885-
let len1 = self.bitv.storage.len();
886-
let len2 = other.bitv.storage.len();
887-
let min = num::min(len1, len2);
888-
889-
if min < len1 {
890-
MapE{iter: self.bitv.storage.slice(min, len1).iter().enumerate(),
891-
env: min,
892-
f: |(i, &w): (uint, &uint), min| (true, (i + min) * uint::bits, w)
893-
}
882+
-> Map<'static, ((uint, &'a uint), uint), (bool, uint, uint),
883+
Zip<Enumerate<vec::VecIterator<'a, uint>>, Repeat<uint>>> {
884+
let slen = self.bitv.storage.len();
885+
let olen = other.bitv.storage.len();
886+
887+
if olen < slen {
888+
self.bitv.storage.slice_from(olen).iter().enumerate()
889+
.zip(Repeat::new(olen))
890+
.transform(|((i, &w), min)| (true, (i + min) * uint::bits, w))
894891
} else {
895-
MapE{iter: other.bitv.storage.slice(min, len2).iter().enumerate(),
896-
env: min,
897-
f: |(i, &w): (uint, &uint), min| (false, (i + min) * uint::bits, w)
898-
}
899-
}
900-
}
901-
}
902-
903-
/// Like iterator::Map with explicit env capture
904-
struct MapE<A, B, Env, I> {
905-
priv env: Env,
906-
priv f: &'static fn(A, Env) -> B,
907-
priv iter: I,
908-
}
909-
910-
impl<'self, A, B, Env: Clone, I: Iterator<A>> Iterator<B> for MapE<A, B, Env, I> {
911-
#[inline]
912-
fn next(&mut self) -> Option<B> {
913-
match self.iter.next() {
914-
Some(elt) => Some((self.f)(elt, self.env.clone())),
915-
None => None
892+
other.bitv.storage.slice_from(slen).iter().enumerate()
893+
.zip(Repeat::new(slen))
894+
.transform(|((i, &w), min)| (false, (i + min) * uint::bits, w))
916895
}
917896
}
918-
919-
#[inline]
920-
fn size_hint(&self) -> (uint, Option<uint>) {
921-
self.iter.size_hint()
922-
}
923897
}
924898

925899
pub struct BitvSetIterator<'self> {

0 commit comments

Comments
 (0)