Skip to content

Commit 46c69ee

Browse files
committed
---
yaml --- r: 126446 b: refs/heads/master c: d320235 h: refs/heads/master v: v3
1 parent d5db779 commit 46c69ee

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

+368
-600
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 8fe73f1166c0d3765cabb26680b82175ec4429cd
2+
refs/heads/master: d3202354f5fe3860c429adc4bab6e6dc88ee83bc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
55
refs/heads/try: cd2003ffd8dd976342f9e8fc1429ae93d6780e81

trunk/mk/platform.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabi :=
377377
# mipsel-linux configuration
378378
CC_mipsel-linux=mipsel-linux-gcc
379379
CXX_mipsel-linux=mipsel-linux-g++
380-
CPP_mipsel-linux=mipsel-linux-gcc
380+
CPP_mipsel-linux=mipsel-linux-gcc
381381
AR_mipsel-linux=mipsel-linux-ar
382382
CFG_LIB_NAME_mipsel-linux=lib$(1).so
383383
CFG_STATIC_LIB_NAME_mipsel-linux=lib$(1).a
@@ -641,7 +641,7 @@ define CFG_MAKE_TOOLCHAIN
641641
CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1))
642642
CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1))
643643
AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
644-
RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(CC_$(1))) \
644+
RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(CXX_$(1))) \
645645
-C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
646646

647647
RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))

trunk/src/doc/guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3295,7 +3295,7 @@ fn times_four(x: int) -> int { x * 4 }
32953295
#[cfg(test)]
32963296
mod test {
32973297
use super::add_three;
3298-
use super::times_four;
3298+
use super::add_four;
32993299
33003300
#[test]
33013301
fn test_add_three() {
@@ -3344,7 +3344,7 @@ about yet, and that's these lines:
33443344

33453345
```{rust,ignore}
33463346
use super::add_three;
3347-
use super::times_four;
3347+
use super::add_four;
33483348
```
33493349

33503350
Because we've made a nested module, we can import functions from the parent

trunk/src/etc/ctags.rust

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
--regex-Rust=/^[ \t]*(pub[ \t]+)?mod[ \t]+([a-zA-Z0-9_]+)/\2/m,modules,module names/
88
--regex-Rust=/^[ \t]*(pub[ \t]+)?static[ \t]+([a-zA-Z0-9_]+)/\2/c,consts,static constants/
99
--regex-Rust=/^[ \t]*(pub[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\2/t,traits,traits/
10-
--regex-Rust=/^[ \t]*(pub[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([a-zA-Z0-9_:]+)[ \t]*(<[^>]*>)?[ \t]+(for)[ \t]+)?([a-zA-Z0-9_]+)/\4 \6 \7/i,impls,trait implementations/
10+
--regex-Rust=/^[ \t]*(pub[ \t]+)?impl([ \t\n]+<.*>)?[ \t]+([a-zA-Z0-9_]+)/\3/i,impls,trait implementations/
1111
--regex-Rust=/^[ \t]*macro_rules![ \t]+([a-zA-Z0-9_]+)/\1/d,macros,macro definitions/

trunk/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266

267267
<define-regex id="common_escape" extended="true">
268268
'|"|
269-
\\|n|r|t|0|
269+
\\|n|r|t|
270270
x\%{hex_digit}{2}|
271271
u\%{hex_digit}{4}|
272272
U\%{hex_digit}{8}

trunk/src/etc/get-snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def unpack_snapshot(triple, dl_path):
5353
dl_path = sys.argv[2]
5454
else:
5555
# There are no 64-bit Windows snapshots yet, so we'll use 32-bit ones instead, for now
56-
snap_triple = triple if triple != "x86_64-w64-mingw32" else "i686-w64-mingw32"
56+
snap_triple = triple if triple != "x86_64-w64-mingw32" else "i686-pc-mingw32"
5757
snap = determine_curr_snapshot(snap_triple)
5858
dl = os.path.join(download_dir_base, snap)
5959
url = download_url_base + "/" + snap

trunk/src/libcollections/str.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ mod tests {
14571457
109
14581458
];
14591459
assert_eq!("".as_bytes(), &[]);
1460-
assert_eq!("abc".as_bytes(), b"abc");
1460+
assert_eq!("abc".as_bytes(), &['a' as u8, 'b' as u8, 'c' as u8]);
14611461
assert_eq!("ศไทย中华Việt Nam".as_bytes(), v.as_slice());
14621462
}
14631463

@@ -1475,11 +1475,11 @@ mod tests {
14751475
fn test_as_ptr() {
14761476
let buf = "hello".as_ptr();
14771477
unsafe {
1478-
assert_eq!(*buf.offset(0), b'h');
1479-
assert_eq!(*buf.offset(1), b'e');
1480-
assert_eq!(*buf.offset(2), b'l');
1481-
assert_eq!(*buf.offset(3), b'l');
1482-
assert_eq!(*buf.offset(4), b'o');
1478+
assert_eq!(*buf.offset(0), 'h' as u8);
1479+
assert_eq!(*buf.offset(1), 'e' as u8);
1480+
assert_eq!(*buf.offset(2), 'l' as u8);
1481+
assert_eq!(*buf.offset(3), 'l' as u8);
1482+
assert_eq!(*buf.offset(4), 'o' as u8);
14831483
}
14841484
}
14851485

trunk/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ mod tests {
10401040
fn test_push_bytes() {
10411041
let mut s = String::from_str("ABC");
10421042
unsafe {
1043-
s.push_bytes([b'D']);
1043+
s.push_bytes([ 'D' as u8 ]);
10441044
}
10451045
assert_eq!(s.as_slice(), "ABCD");
10461046
}

trunk/src/libcore/fmt/float.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
198198
// Decide what sign to put in front
199199
match sign {
200200
SignNeg | SignAll if neg => {
201-
buf[end] = b'-';
201+
buf[end] = '-' as u8;
202202
end += 1;
203203
}
204204
SignAll => {
205-
buf[end] = b'+';
205+
buf[end] = '+' as u8;
206206
end += 1;
207207
}
208208
_ => ()
@@ -218,7 +218,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
218218
// Now emit the fractional part, if any
219219
deccum = num.fract();
220220
if deccum != _0 || (limit_digits && exact && digit_count > 0) {
221-
buf[end] = b'.';
221+
buf[end] = '.' as u8;
222222
end += 1;
223223
let mut dig = 0u;
224224

@@ -269,8 +269,8 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
269269
// If reached left end of number, have to
270270
// insert additional digit:
271271
if i < 0
272-
|| buf[i as uint] == b'-'
273-
|| buf[i as uint] == b'+' {
272+
|| buf[i as uint] == '-' as u8
273+
|| buf[i as uint] == '+' as u8 {
274274
for j in range(i as uint + 1, end).rev() {
275275
buf[j + 1] = buf[j];
276276
}
@@ -280,7 +280,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
280280
}
281281

282282
// Skip the '.'
283-
if buf[i as uint] == b'.' { i -= 1; continue; }
283+
if buf[i as uint] == '.' as u8 { i -= 1; continue; }
284284

285285
// Either increment the digit,
286286
// or set to 0 if max and carry the 1.
@@ -306,14 +306,14 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
306306
let mut i = buf_max_i;
307307

308308
// discover trailing zeros of fractional part
309-
while i > start_fractional_digits && buf[i] == b'0' {
309+
while i > start_fractional_digits && buf[i] == '0' as u8 {
310310
i -= 1;
311311
}
312312

313313
// Only attempt to truncate digits if buf has fractional digits
314314
if i >= start_fractional_digits {
315315
// If buf ends with '.', cut that too.
316-
if buf[i] == b'.' { i -= 1 }
316+
if buf[i] == '.' as u8 { i -= 1 }
317317

318318
// only resize buf if we actually remove digits
319319
if i < buf_max_i {
@@ -323,7 +323,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
323323
} // If exact and trailing '.', just cut that
324324
else {
325325
let max_i = end - 1;
326-
if buf[max_i] == b'.' {
326+
if buf[max_i] == '.' as u8 {
327327
end = max_i;
328328
}
329329
}

trunk/src/libcore/fmt/num.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ macro_rules! radix {
104104
}
105105
}
106106

107-
radix!(Binary, 2, "0b", x @ 0 .. 2 => b'0' + x)
108-
radix!(Octal, 8, "0o", x @ 0 .. 7 => b'0' + x)
109-
radix!(Decimal, 10, "", x @ 0 .. 9 => b'0' + x)
110-
radix!(LowerHex, 16, "0x", x @ 0 .. 9 => b'0' + x,
111-
x @ 10 ..15 => b'a' + (x - 10))
112-
radix!(UpperHex, 16, "0x", x @ 0 .. 9 => b'0' + x,
113-
x @ 10 ..15 => b'A' + (x - 10))
107+
radix!(Binary, 2, "0b", x @ 0 .. 2 => '0' as u8 + x)
108+
radix!(Octal, 8, "0o", x @ 0 .. 7 => '0' as u8 + x)
109+
radix!(Decimal, 10, "", x @ 0 .. 9 => '0' as u8 + x)
110+
radix!(LowerHex, 16, "0x", x @ 0 .. 9 => '0' as u8 + x,
111+
x @ 10 ..15 => 'a' as u8 + (x - 10))
112+
radix!(UpperHex, 16, "0x", x @ 0 .. 9 => '0' as u8 + x,
113+
x @ 10 ..15 => 'A' as u8 + (x - 10))
114114

115115
/// A radix with in the range of `2..36`.
116116
#[deriving(Clone, PartialEq)]
@@ -129,8 +129,8 @@ impl GenericRadix for Radix {
129129
fn base(&self) -> u8 { self.base }
130130
fn digit(&self, x: u8) -> u8 {
131131
match x {
132-
x @ 0 ..9 => b'0' + x,
133-
x if x < self.base() => b'a' + (x - 10),
132+
x @ 0 ..9 => '0' as u8 + x,
133+
x if x < self.base() => 'a' as u8 + (x - 10),
134134
x => fail!("number not in the range 0..{}: {}", self.base() - 1, x),
135135
}
136136
}

trunk/src/libcore/iter.rs

Lines changed: 62 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,13 @@ pub trait Iterator<A> {
481481
/// ```
482482
#[inline]
483483
fn nth(&mut self, mut n: uint) -> Option<A> {
484-
for x in *self {
485-
if n == 0 { return Some(x) }
484+
loop {
485+
match self.next() {
486+
Some(x) => if n == 0 { return Some(x) },
487+
None => return None
488+
}
486489
n -= 1;
487490
}
488-
None
489491
}
490492

491493
/// Loops through the entire iterator, returning the last element of the
@@ -516,8 +518,11 @@ pub trait Iterator<A> {
516518
#[inline]
517519
fn fold<B>(&mut self, init: B, f: |B, A| -> B) -> B {
518520
let mut accum = init;
519-
for x in *self {
520-
accum = f(accum, x);
521+
loop {
522+
match self.next() {
523+
Some(x) => { accum = f(accum, x); }
524+
None => { break; }
525+
}
521526
}
522527
accum
523528
}
@@ -715,10 +720,21 @@ pub trait ExactSize<A> : DoubleEndedIterator<A> {
715720
/// If no element matches, None is returned.
716721
#[inline]
717722
fn rposition(&mut self, predicate: |A| -> bool) -> Option<uint> {
718-
let len = self.len();
719-
for i in range(0, len).rev() {
720-
if predicate(self.next_back().expect("rposition: incorrect ExactSize")) {
721-
return Some(i);
723+
let (lower, upper) = self.size_hint();
724+
assert!(upper == Some(lower));
725+
let mut i = lower;
726+
loop {
727+
match self.next_back() {
728+
None => break,
729+
Some(x) => {
730+
i = match i.checked_sub(&1) {
731+
Some(x) => x,
732+
None => fail!("rposition: incorrect ExactSize")
733+
};
734+
if predicate(x) {
735+
return Some(i)
736+
}
737+
}
722738
}
723739
}
724740
None
@@ -728,7 +744,7 @@ pub trait ExactSize<A> : DoubleEndedIterator<A> {
728744
/// Return the exact length of the iterator.
729745
fn len(&self) -> uint {
730746
let (lower, upper) = self.size_hint();
731-
assert_eq!(upper, Some(lower));
747+
assert!(upper == Some(lower));
732748
lower
733749
}
734750
}
@@ -1314,12 +1330,18 @@ impl<'a, A, T: Iterator<A>> Iterator<A> for Filter<'a, A, T> {
13141330
impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Filter<'a, A, T> {
13151331
#[inline]
13161332
fn next_back(&mut self) -> Option<A> {
1317-
for x in self.iter.by_ref().rev() {
1318-
if (self.predicate)(&x) {
1319-
return Some(x);
1333+
loop {
1334+
match self.iter.next_back() {
1335+
None => return None,
1336+
Some(x) => {
1337+
if (self.predicate)(&x) {
1338+
return Some(x);
1339+
} else {
1340+
continue
1341+
}
1342+
}
13201343
}
13211344
}
1322-
None
13231345
}
13241346
}
13251347

@@ -1353,13 +1375,17 @@ impl<'a, A, B, T: DoubleEndedIterator<A>> DoubleEndedIterator<B>
13531375
for FilterMap<'a, A, B, T> {
13541376
#[inline]
13551377
fn next_back(&mut self) -> Option<B> {
1356-
for x in self.iter.by_ref().rev() {
1357-
match (self.f)(x) {
1358-
Some(y) => return Some(y),
1359-
None => ()
1378+
loop {
1379+
match self.iter.next_back() {
1380+
None => return None,
1381+
Some(x) => {
1382+
match (self.f)(x) {
1383+
Some(y) => return Some(y),
1384+
None => ()
1385+
}
1386+
}
13601387
}
13611388
}
1362-
None
13631389
}
13641390
}
13651391

@@ -1481,13 +1507,25 @@ pub struct SkipWhile<'a, A, T> {
14811507
impl<'a, A, T: Iterator<A>> Iterator<A> for SkipWhile<'a, A, T> {
14821508
#[inline]
14831509
fn next(&mut self) -> Option<A> {
1484-
for x in self.iter {
1485-
if self.flag || !(self.predicate)(&x) {
1486-
self.flag = true;
1487-
return Some(x);
1510+
let mut next = self.iter.next();
1511+
if self.flag {
1512+
next
1513+
} else {
1514+
loop {
1515+
match next {
1516+
Some(x) => {
1517+
if (self.predicate)(&x) {
1518+
next = self.iter.next();
1519+
continue
1520+
} else {
1521+
self.flag = true;
1522+
return Some(x)
1523+
}
1524+
}
1525+
None => return None
1526+
}
14881527
}
14891528
}
1490-
None
14911529
}
14921530

14931531
#[inline]

trunk/src/libcore/kinds.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub mod marker {
125125
///
126126
/// The type system would currently infer that the value of
127127
/// the type parameter `T` is irrelevant, and hence a `S<int>` is
128-
/// a subtype of `S<Box<int>>` (or, for that matter, `S<U>` for
128+
/// a subtype of `S<~[int]>` (or, for that matter, `S<U>` for
129129
/// any `U`). But this is incorrect because `get()` converts the
130130
/// `*()` into a `*T` and reads from it. Therefore, we should include the
131131
/// a marker field `CovariantType<T>` to inform the type checker that
@@ -166,7 +166,7 @@ pub mod marker {
166166
///
167167
/// The type system would currently infer that the value of
168168
/// the type parameter `T` is irrelevant, and hence a `S<int>` is
169-
/// a subtype of `S<Box<int>>` (or, for that matter, `S<U>` for
169+
/// a subtype of `S<~[int]>` (or, for that matter, `S<U>` for
170170
/// any `U`). But this is incorrect because `get()` converts the
171171
/// `*()` into a `fn(T)` and then passes a value of type `T` to it.
172172
///

trunk/src/libcore/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ impl<'a> StrSlice<'a> for &'a str {
17551755
fn lines_any(&self) -> AnyLines<'a> {
17561756
self.lines().map(|line| {
17571757
let l = line.len();
1758-
if l > 0 && line.as_bytes()[l - 1] == b'\r' { line.slice(0, l - 1) }
1758+
if l > 0 && line.as_bytes()[l - 1] == '\r' as u8 { line.slice(0, l - 1) }
17591759
else { line }
17601760
})
17611761
}

0 commit comments

Comments
 (0)