Skip to content

Commit d365d3a

Browse files
committed
---
yaml --- r: 56218 b: refs/heads/auto c: 24fb719 h: refs/heads/master v: v3
1 parent 9a95d99 commit d365d3a

File tree

6 files changed

+75
-17
lines changed

6 files changed

+75
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 19cc352302838dd379c0d4a335a093fbfd0df64b
17+
refs/heads/auto: 24fb719b8c0cf5c508799f50fefdf3d7a8cf0ed7
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libcore/io.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub trait ReaderUtil {
176176
fn read_bytes(&self, len: uint) -> ~[u8];
177177

178178
/**
179-
* Reads up until a specific byte is seen or EOF.
179+
* Reads up until a specific character or EOF.
180180
*
181181
* The `include` parameter specifies if the character should be included
182182
* in the returned string.
@@ -185,7 +185,7 @@ pub trait ReaderUtil {
185185
*
186186
* None right now.
187187
*/
188-
fn read_until(&self, c: u8, include: bool) -> ~str;
188+
fn read_until(&self, c: char, include: bool) -> ~str;
189189

190190
/**
191191
* Reads up until the first '\n' or EOF.
@@ -577,7 +577,7 @@ impl<T:Reader> ReaderUtil for T {
577577
bytes
578578
}
579579

580-
fn read_until(&self, c: u8, include: bool) -> ~str {
580+
fn read_until(&self, c: char, include: bool) -> ~str {
581581
let mut bytes = ~[];
582582
loop {
583583
let ch = self.read_byte();
@@ -593,7 +593,7 @@ impl<T:Reader> ReaderUtil for T {
593593
}
594594

595595
fn read_line(&self) -> ~str {
596-
self.read_until('\n' as u8, false)
596+
self.read_until('\n', false)
597597
}
598598

599599
fn read_chars(&self, n: uint) -> ~[char] {
@@ -667,7 +667,7 @@ impl<T:Reader> ReaderUtil for T {
667667
}
668668

669669
fn read_c_str(&self) -> ~str {
670-
self.read_until(0u8, false)
670+
self.read_until(0 as char, false)
671671
}
672672

673673
fn read_whole_stream(&self) -> ~[u8] {
@@ -693,7 +693,7 @@ impl<T:Reader> ReaderUtil for T {
693693
// include the \n, so that we can distinguish an entirely empty
694694
// line read after "...\n", and the trailing empty line in
695695
// "...\n\n".
696-
let mut line = self.read_until('\n' as u8, true);
696+
let mut line = self.read_until('\n', true);
697697

698698
// blank line at the end of the reader is ignored
699699
if self.eof() && line.is_empty() { break; }

branches/auto/src/libcore/str.rs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use clone::Clone;
2424
use cmp::{TotalOrd, Ordering, Less, Equal, Greater};
2525
use libc;
2626
use option::{None, Option, Some};
27+
use iterator::Iterator;
2728
use ptr;
2829
use str;
2930
use u8;
@@ -2358,6 +2359,10 @@ pub trait StrSlice<'self> {
23582359
fn any(&self, it: &fn(char) -> bool) -> bool;
23592360
fn contains<'a>(&self, needle: &'a str) -> bool;
23602361
fn contains_char(&self, needle: char) -> bool;
2362+
#[cfg(stage1)]
2363+
#[cfg(stage2)]
2364+
#[cfg(stage3)]
2365+
fn char_iter(&self) -> StrCharIterator<'self>;
23612366
fn each(&self, it: &fn(u8) -> bool);
23622367
fn eachi(&self, it: &fn(uint, u8) -> bool);
23632368
fn each_reverse(&self, it: &fn(u8) -> bool);
@@ -2419,6 +2424,18 @@ impl<'self> StrSlice<'self> for &'self str {
24192424
fn contains_char(&self, needle: char) -> bool {
24202425
contains_char(*self, needle)
24212426
}
2427+
2428+
#[cfg(stage1)]
2429+
#[cfg(stage2)]
2430+
#[cfg(stage3)]
2431+
#[inline]
2432+
fn char_iter(&self) -> StrCharIterator<'self> {
2433+
StrCharIterator {
2434+
index: 0,
2435+
string: *self
2436+
}
2437+
}
2438+
24222439
/// Iterate over the bytes in a string
24232440
#[inline]
24242441
fn each(&self, it: &fn(u8) -> bool) { each(*self, it) }
@@ -2609,6 +2626,30 @@ impl Clone for ~str {
26092626
}
26102627
}
26112628
2629+
#[cfg(stage1)]
2630+
#[cfg(stage2)]
2631+
#[cfg(stage3)]
2632+
pub struct StrCharIterator<'self> {
2633+
priv index: uint,
2634+
priv string: &'self str,
2635+
}
2636+
2637+
#[cfg(stage1)]
2638+
#[cfg(stage2)]
2639+
#[cfg(stage3)]
2640+
impl<'self> Iterator<char> for StrCharIterator<'self> {
2641+
#[inline]
2642+
fn next(&mut self) -> Option<char> {
2643+
if self.index < self.string.len() {
2644+
let CharRange {ch, next} = char_range_at(self.string, self.index);
2645+
self.index = next;
2646+
Some(ch)
2647+
} else {
2648+
None
2649+
}
2650+
}
2651+
}
2652+
26122653
#[cfg(test)]
26132654
mod tests {
26142655
use char;
@@ -3901,4 +3942,19 @@ mod tests {
39013942
assert!(char_range_at_reverse("abc", 0).next == 0);
39023943
}
39033944
3945+
#[test]
3946+
fn test_iterator() {
3947+
use iterator::*;
3948+
let s = ~"ศไทย中华Việt Nam";
3949+
let v = ~['ศ','ไ','ท','ย','中','华','V','i','ệ','t',' ','N','a','m'];
3950+
3951+
let mut pos = 0;
3952+
let mut it = s.char_iter();
3953+
3954+
for it.advance |c| {
3955+
assert_eq!(c, v[pos]);
3956+
pos += 1;
3957+
}
3958+
assert_eq!(pos, v.len());
3959+
}
39043960
}

branches/auto/src/libcore/task/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,9 @@ pub fn spawn_unlinked(f: ~fn()) {
466466
467467
pub fn spawn_supervised(f: ~fn()) {
468468
/*!
469-
* Creates a child task unlinked from the current one. If either this
470-
* task or the child task fails, the other will not be killed.
469+
* Creates a child task supervised by the current one. If the child
470+
* task fails, the parent will not be killed, but if the parent fails,
471+
* the child will be killed.
471472
*/
472473
473474
task().supervised().spawn(f)

branches/auto/src/libstd/workcache.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -30,11 +30,12 @@ use core::to_bytes;
3030

3131
/**
3232
*
33-
* This is a loose clone of the fbuild build system, made a touch more
34-
* generic (not wired to special cases on files) and much less metaprogram-y
35-
* due to rust's comparative weakness there, relative to python.
33+
* This is a loose clone of the [fbuild build system](https://github.com/felix-lang/fbuild),
34+
* made a touch more generic (not wired to special cases on files) and much
35+
* less metaprogram-y due to rust's comparative weakness there, relative to
36+
* python.
3637
*
37-
* It's based around _imperative bulids_ that happen to have some function
38+
* It's based around _imperative builds_ that happen to have some function
3839
* calls cached. That is, it's _just_ a mechanism for describing cached
3940
* functions. This makes it much simpler and smaller than a "build system"
4041
* that produces an IR and evaluates it. The evaluation order is normal
@@ -54,7 +55,7 @@ use core::to_bytes;
5455
* Works are conceptually single units, but we store them most of the time
5556
* in maps of the form (type,name) => value. These are WorkMaps.
5657
*
57-
* A cached function divides the works it's interested up into inputs and
58+
* A cached function divides the works it's interested in into inputs and
5859
* outputs, and subdivides those into declared (input) works and
5960
* discovered (input and output) works.
6061
*

branches/auto/src/rt/rust_exchange_alloc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ rust_get_exchange_count_ptr() {
4848
void
4949
rust_check_exchange_count_on_exit() {
5050
if (exchange_count != 0) {
51-
printf("exchange heap not empty on on exit");
52-
printf("%d dangling allocations", (int)exchange_count);
51+
printf("exchange heap not empty on exit\n");
52+
printf("%d dangling allocations\n", (int)exchange_count);
5353
abort();
5454
}
5555
}

0 commit comments

Comments
 (0)