Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/master' into remove-str-…
Browse files Browse the repository at this point in the history
…trailing-nulls
  • Loading branch information
erickt committed Aug 6, 2013
2 parents 5e7b666 + 6972eb4 commit 5eaa4d1
Show file tree
Hide file tree
Showing 137 changed files with 1,283 additions and 1,217 deletions.
8 changes: 4 additions & 4 deletions mk/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
| $$(TLIB$(1)_T_$(2)_H_$(3))/
@$$(call E, compile_and_link: $$@)
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))

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

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

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

$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
Expand Down
8 changes: 4 additions & 4 deletions mk/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)): \
| $$(TLIB$(1)_T_$(4)_H_$(3))/
@$$(call E, compile_and_link: $$@)
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTPKG_GLOB_$(4)),$$(notdir $$@))
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) -o $$@ $$< && touch $$@
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTPKG_GLOB_$(4)),$$(notdir $$@))

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

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

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

$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)): \
Expand Down
7 changes: 3 additions & 4 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#[crate_type = "bin"];

#[allow(non_camel_case_types)];
#[allow(unrecognized_lint)]; // NOTE: remove after snapshot
#[deny(warnings)];

extern mod extra;
Expand Down Expand Up @@ -131,7 +130,7 @@ pub fn parse_config(args: ~[~str]) -> config {
ratchet_noise_percent:
getopts::opt_maybe_str(matches,
"ratchet-noise-percent").map(|s|
f64::from_str(*s).get()),
f64::from_str(*s).unwrap()),
runtool: getopts::opt_maybe_str(matches, "runtool"),
rustcflags: getopts::opt_maybe_str(matches, "rustcflags"),
jit: getopts::opt_present(matches, "jit"),
Expand Down Expand Up @@ -267,7 +266,7 @@ pub fn is_test(config: &config, testfile: &Path) -> bool {
_ => ~[~".rc", ~".rs"]
};
let invalid_prefixes = ~[~".", ~"#", ~"~"];
let name = testfile.filename().get();
let name = testfile.filename().unwrap();

let mut valid = false;

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

test::DynTestName(fmt!("[%s] %s",
Expand Down
12 changes: 6 additions & 6 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
let rounds =
match props.pp_exact { Some(_) => 1, None => 2 };

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

let mut round = 0;
while round < rounds {
Expand All @@ -166,7 +166,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) {
match props.pp_exact {
Some(ref file) => {
let filepath = testfile.dir_path().push_rel(file);
io::read_whole_file_str(&filepath).get()
io::read_whole_file_str(&filepath).unwrap()
}
None => { srcs[srcs.len() - 2u].clone() }
};
Expand Down Expand Up @@ -448,7 +448,7 @@ fn scan_until_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
if opt.is_none() {
return false;
}
*idx = opt.get();
*idx = opt.unwrap();
return true;
}

Expand Down Expand Up @@ -709,7 +709,7 @@ fn aux_output_dir_name(config: &config, testfile: &Path) -> Path {
}

fn output_testname(testfile: &Path) -> Path {
Path(testfile.filestem().get())
Path(testfile.filestem().unwrap())
}

fn output_base_name(config: &config, testfile: &Path) -> Path {
Expand Down Expand Up @@ -878,7 +878,7 @@ fn append_suffix_to_stem(p: &Path, suffix: &str) -> Path {
if suffix.len() == 0 {
(*p).clone()
} else {
let stem = p.filestem().get();
let stem = p.filestem().unwrap();
p.with_filestem(stem + "-" + suffix)
}
}
Expand Down Expand Up @@ -938,7 +938,7 @@ fn disassemble_extract(config: &config, _props: &TestProps,


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

Expand Down
20 changes: 10 additions & 10 deletions src/libextra/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,24 +322,24 @@ mod test {
#[test]
fn test_from_base64_basic() {
assert_eq!("".from_base64().get(), "".as_bytes().to_owned());
assert_eq!("Zg==".from_base64().get(), "f".as_bytes().to_owned());
assert_eq!("Zm8=".from_base64().get(), "fo".as_bytes().to_owned());
assert_eq!("Zm9v".from_base64().get(), "foo".as_bytes().to_owned());
assert_eq!("Zm9vYg==".from_base64().get(), "foob".as_bytes().to_owned());
assert_eq!("Zm9vYmE=".from_base64().get(), "fooba".as_bytes().to_owned());
assert_eq!("Zm9vYmFy".from_base64().get(), "foobar".as_bytes().to_owned());
assert_eq!("".from_base64().unwrap(), "".as_bytes().to_owned());
assert_eq!("Zg==".from_base64().unwrap(), "f".as_bytes().to_owned());
assert_eq!("Zm8=".from_base64().unwrap(), "fo".as_bytes().to_owned());
assert_eq!("Zm9v".from_base64().unwrap(), "foo".as_bytes().to_owned());
assert_eq!("Zm9vYg==".from_base64().unwrap(), "foob".as_bytes().to_owned());
assert_eq!("Zm9vYmE=".from_base64().unwrap(), "fooba".as_bytes().to_owned());
assert_eq!("Zm9vYmFy".from_base64().unwrap(), "foobar".as_bytes().to_owned());
}
#[test]
fn test_from_base64_newlines() {
assert_eq!("Zm9v\r\nYmFy".from_base64().get(),
assert_eq!("Zm9v\r\nYmFy".from_base64().unwrap(),
"foobar".as_bytes().to_owned());
}
#[test]
fn test_from_base64_urlsafe() {
assert_eq!("-_8".from_base64().get(), "+/8=".from_base64().get());
assert_eq!("-_8".from_base64().unwrap(), "+/8=".from_base64().unwrap());
}
#[test]
Expand All @@ -364,7 +364,7 @@ mod test {
push(random());
}
};
assert_eq!(v.to_base64(STANDARD).from_base64().get(), v);
assert_eq!(v.to_base64(STANDARD).from_base64().unwrap(), v);
}
}
Expand Down
70 changes: 22 additions & 48 deletions src/libextra/bitv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use std::cmp;
use std::iterator::RandomAccessIterator;
use std::iterator::{Invert, Enumerate};
use std::iterator::{Invert, Enumerate, Repeat, Map, Zip};
use std::num;
use std::ops;
use std::uint;
Expand Down Expand Up @@ -206,14 +206,13 @@ impl BigBitv {
#[inline]
pub fn equals(&self, b: &BigBitv, nbits: uint) -> bool {
let len = b.storage.len();
do uint::iterate(0, len) |i| {
for i in range(0, len) {
let mask = big_mask(nbits, i);
if mask & self.storage[i] != mask & b.storage[i] {
false
} else {
true
return false;
}
}
true
}
}

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

/// Visits each word in self or other that extends beyond the other. This
Expand All @@ -881,45 +879,21 @@ impl BitvSet {
/// is true if the word comes from 'self', and false if it comes from
/// 'other'.
fn outlier_iter<'a>(&'a self, other: &'a BitvSet)
-> MapE<(uint, &uint),(bool, uint, uint), uint, Enumerate<vec::VecIterator<'a, uint>>> {
let len1 = self.bitv.storage.len();
let len2 = other.bitv.storage.len();
let min = num::min(len1, len2);

if min < len1 {
MapE{iter: self.bitv.storage.slice(min, len1).iter().enumerate(),
env: min,
f: |(i, &w): (uint, &uint), min| (true, (i + min) * uint::bits, w)
}
-> Map<'static, ((uint, &'a uint), uint), (bool, uint, uint),
Zip<Enumerate<vec::VecIterator<'a, uint>>, Repeat<uint>>> {
let slen = self.bitv.storage.len();
let olen = other.bitv.storage.len();

if olen < slen {
self.bitv.storage.slice_from(olen).iter().enumerate()
.zip(Repeat::new(olen))
.transform(|((i, &w), min)| (true, (i + min) * uint::bits, w))
} else {
MapE{iter: other.bitv.storage.slice(min, len2).iter().enumerate(),
env: min,
f: |(i, &w): (uint, &uint), min| (false, (i + min) * uint::bits, w)
}
}
}
}

/// Like iterator::Map with explicit env capture
struct MapE<A, B, Env, I> {
priv env: Env,
priv f: &'static fn(A, Env) -> B,
priv iter: I,
}

impl<'self, A, B, Env: Clone, I: Iterator<A>> Iterator<B> for MapE<A, B, Env, I> {
#[inline]
fn next(&mut self) -> Option<B> {
match self.iter.next() {
Some(elt) => Some((self.f)(elt, self.env.clone())),
None => None
other.bitv.storage.slice_from(slen).iter().enumerate()
.zip(Repeat::new(slen))
.transform(|((i, &w), min)| (false, (i + min) * uint::bits, w))
}
}

#[inline]
fn size_hint(&self) -> (uint, Option<uint>) {
self.iter.size_hint()
}
}

pub struct BitvSetIterator<'self> {
Expand Down
Loading

4 comments on commit 5eaa4d1

@bors
Copy link
Contributor

@bors bors commented on 5eaa4d1 Aug 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at erickt@5eaa4d1

@bors
Copy link
Contributor

@bors bors commented on 5eaa4d1 Aug 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging erickt/rust/remove-str-trailing-nulls = 5eaa4d1 into auto

@bors
Copy link
Contributor

@bors bors commented on 5eaa4d1 Aug 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

erickt/rust/remove-str-trailing-nulls = 5eaa4d1 merged ok, testing candidate = 6c6e8531

Please sign in to comment.