Skip to content

Commit 2bc7597

Browse files
committed
---
yaml --- r: 51669 b: refs/heads/incoming c: de468c8 h: refs/heads/master i: 51667: b85e6cd v: v3
1 parent fcde0d1 commit 2bc7597

40 files changed

+501
-690
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 7f5d7e1c2e7464916694e55ba4f31bf5b8f9a4f9
9+
refs/heads/incoming: de468c8cd2f55124f98ae67941bc4c11dee92c14
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/doc/rust.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,4 @@ td {
101101
#TOC ul {
102102
list-style: none;
103103
padding-left: 0px;
104-
}
105-
106-
/* Adjust list alignment so rustdoc indexes don't align with blockquotes */
107-
div.index ul {
108-
padding-left: 1em;
109104
}

branches/incoming/doc/rust.md

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,10 +1671,6 @@ vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
16711671
A [_vector_](#vector-types) _expression_ is written by enclosing zero or
16721672
more comma-separated expressions of uniform type in square brackets.
16731673

1674-
In the `[expr ',' ".." expr]` form, the expression after the `".."`
1675-
must be a constant expression that can be evaluated at compile time, such
1676-
as a [literal](#literals) or a [static item](#static-items).
1677-
16781674
~~~~
16791675
[1, 2, 3, 4];
16801676
["a", "b", "c", "d"];
@@ -2160,19 +2156,6 @@ do f |j| {
21602156
}
21612157
~~~~
21622158

2163-
In this example, both calls to the (binary) function `k` are equivalent:
2164-
2165-
~~~~
2166-
# fn k(x:int, f: &fn(int)) { }
2167-
# fn l(i: int) { }
2168-
2169-
k(3, |j| l(j));
2170-
2171-
do k(3) |j| {
2172-
l(j);
2173-
}
2174-
~~~~
2175-
21762159

21772160
### For expressions
21782161

@@ -2201,7 +2184,7 @@ and early boolean-valued returns from the `block` function,
22012184
such that the meaning of `break` and `loop` is preserved in a primitive loop
22022185
when rewritten as a `for` loop controlled by a higher order function.
22032186

2204-
An example of a for loop over the contents of a vector:
2187+
An example a for loop:
22052188

22062189
~~~~
22072190
# type foo = int;
@@ -2215,14 +2198,6 @@ for v.each |e| {
22152198
}
22162199
~~~~
22172200

2218-
An example of a for loop over a series of integers:
2219-
2220-
~~~~
2221-
# fn bar(b:uint) { }
2222-
for uint::range(0, 256) |i| {
2223-
bar(i);
2224-
}
2225-
~~~~
22262201

22272202
### If expressions
22282203

@@ -2499,7 +2474,6 @@ fail_unless!(b != "world");
24992474

25002475
The vector type constructor represents a homogeneous array of values of a given type.
25012476
A vector has a fixed size.
2502-
(Operations like `vec::push` operate solely on owned vectors.)
25032477
A vector type can be annotated with a _definite_ size,
25042478
written with a trailing asterisk and integer literal, such as `[int * 10]`.
25052479
Such a definite-sized vector type is a first-class type, since its size is known statically.
@@ -2510,10 +2484,6 @@ such as `&[T]`, `@[T]` or `~[T]`.
25102484
The kind of a vector type depends on the kind of its element type,
25112485
as with other simple structural types.
25122486

2513-
Expressions producing vectors of definite size cannot be evaluated in a
2514-
context expecting a vector of indefinite size; one must copy the
2515-
definite-sized vector contents into a distinct vector of indefinite size.
2516-
25172487
An example of a vector type and its use:
25182488

25192489
~~~~

branches/incoming/src/compiletest/header.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ fn parse_check_line(line: ~str) -> Option<~str> {
142142
fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> {
143143
do parse_name_value_directive(line, ~"exec-env").map |nv| {
144144
// nv is either FOO or FOO=BAR
145-
let strs = str::splitn_char(*nv, '=', 1u);
145+
let mut strs = ~[];
146+
for str::each_splitn_char(*nv, '=', 1u) |s| { strs.push(s.to_owned()); }
146147
match strs.len() {
147148
1u => (strs[0], ~""),
148149
2u => (strs[0], strs[1]),

branches/incoming/src/compiletest/runtest.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn run_debuginfo_test(config: config, props: TestProps, testfile: &Path) {
267267
// check if each line in props.check_lines appears in the
268268
// output (in order)
269269
let mut i = 0u;
270-
for str::lines_each(ProcRes.stdout) |line| {
270+
for str::each_line(ProcRes.stdout) |line| {
271271
if props.check_lines[i].trim() == line.trim() {
272272
i += 1u;
273273
}
@@ -297,7 +297,7 @@ fn check_error_patterns(props: TestProps,
297297
let mut next_err_idx = 0u;
298298
let mut next_err_pat = props.error_patterns[next_err_idx];
299299
let mut done = false;
300-
for str::lines_each(ProcRes.stderr) |line| {
300+
for str::each_line(ProcRes.stderr) |line| {
301301
if str::contains(line, next_err_pat) {
302302
debug!("found error pattern %s", next_err_pat);
303303
next_err_idx += 1u;
@@ -347,7 +347,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
347347
// filename:line1:col1: line2:col2: *warning:* msg
348348
// where line1:col1: is the starting point, line2:col2:
349349
// is the ending point, and * represents ANSI color codes.
350-
for str::lines_each(ProcRes.stderr) |line| {
350+
for str::each_line(ProcRes.stderr) |line| {
351351
let mut was_expected = false;
352352
for vec::eachi(expected_errors) |i, ee| {
353353
if !found_flags[i] {
@@ -596,8 +596,12 @@ fn split_maybe_args(argstr: Option<~str>) -> ~[~str] {
596596
}
597597

598598
match argstr {
599-
Some(s) => rm_whitespace(str::split_char(s, ' ')),
600-
None => ~[]
599+
Some(s) => {
600+
let mut ss = ~[];
601+
for str::each_split_char(s, ' ') |s| { ss.push(s.to_owned()) }
602+
rm_whitespace(ss)
603+
}
604+
None => ~[]
601605
}
602606
}
603607

branches/incoming/src/libcore/iter.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,7 @@ pub fn build_sized_opt<A,B: Buildable<A>>(size: Option<uint>,
284284

285285
// Functions that combine iteration and building
286286

287-
/// Applies a function to each element of an iterable and returns the results
288-
/// in a sequence built via `BU`. See also `map_to_vec`.
287+
/// Applies a function to each element of an iterable and returns the results.
289288
#[inline(always)]
290289
pub fn map<T,IT: BaseIter<T>,U,BU: Buildable<U>>(v: &IT, f: &fn(&T) -> U)
291290
-> BU {

branches/incoming/src/libcore/num/strconv.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ impl_NumStrConv_Integer!(u16)
130130
impl_NumStrConv_Integer!(u32)
131131
impl_NumStrConv_Integer!(u64)
132132

133+
134+
// Special value strings as [u8] consts.
135+
static inf_buf: [u8*3] = ['i' as u8, 'n' as u8, 'f' as u8];
136+
static positive_inf_buf: [u8*4] = ['+' as u8, 'i' as u8, 'n' as u8, 'f' as u8];
137+
static negative_inf_buf: [u8*4] = ['-' as u8, 'i' as u8, 'n' as u8, 'f' as u8];
138+
static nan_buf: [u8*3] = ['N' as u8, 'a' as u8, 'N' as u8];
139+
133140
/**
134141
* Converts a number to its string representation as a byte vector.
135142
* This is meant to be a common base implementation for all numeric string
@@ -479,15 +486,15 @@ pub fn from_str_bytes_common<T:NumCast+Zero+One+Ord+Copy+Div<T,T>+
479486
}
480487

481488
if special {
482-
if buf == str::inf_buf || buf == str::positive_inf_buf {
489+
if buf == inf_buf || buf == positive_inf_buf {
483490
return NumStrConv::inf();
484-
} else if buf == str::negative_inf_buf {
491+
} else if buf == negative_inf_buf {
485492
if negative {
486493
return NumStrConv::neg_inf();
487494
} else {
488495
return None;
489496
}
490-
} else if buf == str::nan_buf {
497+
} else if buf == nan_buf {
491498
return NumStrConv::NaN();
492499
}
493500
}

branches/incoming/src/libcore/os.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ pub fn env() -> ~[(~str,~str)] {
218218
fn env_convert(input: ~[~str]) -> ~[(~str, ~str)] {
219219
let mut pairs = ~[];
220220
for input.each |p| {
221-
let vs = str::splitn_char(*p, '=', 1);
221+
let mut vs = ~[];
222+
for str::each_splitn_char(*p, '=', 1) |s| { vs.push(s.to_owned()) }
222223
debug!("splitting: len: %u",
223224
vs.len());
224225
fail_unless!(vs.len() == 2);

branches/incoming/src/libcore/path.rs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ impl ToStr for PosixPath {
381381
impl GenericPath for PosixPath {
382382

383383
fn from_str(s: &str) -> PosixPath {
384-
let mut components = str::split_nonempty(s, |c| c == '/');
384+
let mut components = ~[];
385+
for str::each_split_nonempty(s, |c| c == '/') |s| { components.push(s.to_owned()) }
385386
let is_absolute = (s.len() != 0 && s[0] == '/' as u8);
386387
return PosixPath { is_absolute: is_absolute,
387388
components: components }
@@ -504,9 +505,10 @@ impl GenericPath for PosixPath {
504505
fn push_many(&self, cs: &[~str]) -> PosixPath {
505506
let mut v = copy self.components;
506507
for cs.each |e| {
507-
let mut ss = str::split_nonempty(
508-
*e,
509-
|c| windows::is_sep(c as u8));
508+
let mut ss = ~[];
509+
for str::each_split_nonempty(*e, |c| windows::is_sep(c as u8)) |s| {
510+
ss.push(s.to_owned())
511+
}
510512
unsafe { v.push_all_move(ss); }
511513
}
512514
PosixPath { is_absolute: self.is_absolute,
@@ -515,7 +517,10 @@ impl GenericPath for PosixPath {
515517

516518
fn push(&self, s: &str) -> PosixPath {
517519
let mut v = copy self.components;
518-
let mut ss = str::split_nonempty(s, |c| windows::is_sep(c as u8));
520+
let mut ss = ~[];
521+
for str::each_split_nonempty(s, |c| windows::is_sep(c as u8)) |s| {
522+
ss.push(s.to_owned())
523+
}
519524
unsafe { v.push_all_move(ss); }
520525
PosixPath { components: v, ..copy *self }
521526
}
@@ -590,8 +595,10 @@ impl GenericPath for WindowsPath {
590595
}
591596
}
592597

593-
let mut components =
594-
str::split_nonempty(rest, |c| windows::is_sep(c as u8));
598+
let mut components = ~[];
599+
for str::each_split_nonempty(rest, |c| windows::is_sep(c as u8)) |s| {
600+
components.push(s.to_owned())
601+
}
595602
let is_absolute = (rest.len() != 0 && windows::is_sep(rest[0]));
596603
return WindowsPath { host: host,
597604
device: device,
@@ -759,9 +766,10 @@ impl GenericPath for WindowsPath {
759766
fn push_many(&self, cs: &[~str]) -> WindowsPath {
760767
let mut v = copy self.components;
761768
for cs.each |e| {
762-
let mut ss = str::split_nonempty(
763-
*e,
764-
|c| windows::is_sep(c as u8));
769+
let mut ss = ~[];
770+
for str::each_split_nonempty(*e, |c| windows::is_sep(c as u8)) |s| {
771+
ss.push(s.to_owned())
772+
}
765773
unsafe { v.push_all_move(ss); }
766774
}
767775
// tedious, but as-is, we can't use ..self
@@ -775,7 +783,10 @@ impl GenericPath for WindowsPath {
775783

776784
fn push(&self, s: &str) -> WindowsPath {
777785
let mut v = copy self.components;
778-
let mut ss = str::split_nonempty(s, |c| windows::is_sep(c as u8));
786+
let mut ss = ~[];
787+
for str::each_split_nonempty(s, |c| windows::is_sep(c as u8)) |s| {
788+
ss.push(s.to_owned())
789+
}
779790
unsafe { v.push_all_move(ss); }
780791
return WindowsPath { components: v, ..copy *self }
781792
}

branches/incoming/src/libcore/rand.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ impl RngUtil for @Rng {
327327
*/
328328
fn gen_char_from(&self, chars: &str) -> char {
329329
fail_unless!(!chars.is_empty());
330-
self.choose(str::chars(chars))
330+
let mut cs = ~[];
331+
for str::each_char(chars) |c| { cs.push(c) }
332+
self.choose(cs)
331333
}
332334

333335
/// Return a random bool

0 commit comments

Comments
 (0)