Skip to content

Commit 2fa663f

Browse files
committed
---
yaml --- r: 54171 b: refs/heads/dist-snap c: 3d588c5 h: refs/heads/master i: 54169: eccc3da 54167: ed07158 v: v3
1 parent 4e539ec commit 2fa663f

Some content is hidden

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

66 files changed

+1061
-667
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 969e8b76a184ce3083c7854a986baf3f279b5c81
10+
refs/heads/dist-snap: 3d588c528685fa0590ff91f189f0ef44a3815ec2
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/RELEASES.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ Version 0.6 (March 2013)
6262
* Pattern matching over vectors improved and expanded
6363
* Typechecking of closure types has been overhauled to
6464
improve inference and eliminate unsoundness
65-
* Macros leave scope at the end of modules, unless that module is
66-
tagged with #[macro_escape]
6765

6866
* Libraries
6967
* Added big integers to `std::bigint`

branches/dist-snap/doc/rust.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,9 @@ 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;
104109
}

branches/dist-snap/doc/rust.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,10 @@ 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+
16741678
~~~~
16751679
[1, 2, 3, 4];
16761680
["a", "b", "c", "d"];
@@ -2156,6 +2160,19 @@ do f |j| {
21562160
}
21572161
~~~~
21582162

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+
21592176

21602177
### For expressions
21612178

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

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

21892206
~~~~
21902207
# type foo = int;
@@ -2198,6 +2215,14 @@ for v.each |e| {
21982215
}
21992216
~~~~
22002217

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+
~~~~
22012226

22022227
### If expressions
22032228

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

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

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+
24872517
An example of a vector type and its use:
24882518

24892519
~~~~

branches/dist-snap/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/dist-snap/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/dist-snap/src/libcore/cast.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
//! Unsafe casting functions
12+
1113
pub mod rusti {
1214
#[abi = "rust-intrinsic"]
1315
#[link_name = "rusti"]

branches/dist-snap/src/libcore/cell.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
//! A mutable, nullable memory location
12+
1113
use cast::transmute;
1214
use option;
1315
use prelude::*;
1416

15-
/// A dynamic, mutable location.
16-
///
17-
/// Similar to a mutable option type, but friendlier.
17+
/*
18+
A dynamic, mutable location.
19+
20+
Similar to a mutable option type, but friendlier.
21+
*/
1822

1923
pub struct Cell<T> {
2024
mut value: Option<T>

branches/dist-snap/src/libcore/clone.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,20 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
/**
12-
Clonable types are copied with the clone method
11+
/*! The Clone trait for types that cannot be "implicitly copied"
12+
13+
In Rust, some simple types are "implicitly copyable" and when you
14+
assign them or pass them as arguments, the receiver will get a copy,
15+
leaving the original value in place. These types do not require
16+
allocation to copy and do not have finalizers (i.e. they do not
17+
contain owned pointers or implement `Drop`), so the compiler considers
18+
them cheap and safe to copy and automatically implements the `Copy`
19+
trait for them. For other types copies must be made explicitly,
20+
by convention implementing the `Clone` trait and calling the
21+
`clone` method.
22+
1323
*/
24+
1425
pub trait Clone {
1526
fn clone(&self) -> Self;
1627
}

branches/dist-snap/src/libcore/comm.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
/*!
12+
Message passing
13+
*/
14+
1115
use cast;
1216
use either::{Either, Left, Right};
1317
use kinds::Owned;

branches/dist-snap/src/libcore/condition.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
/*! Condition handling */
12+
1113
use prelude::*;
1214
use task;
1315
use task::local_data::{local_data_pop, local_data_set};

branches/dist-snap/src/libcore/core.rc

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,39 @@
1010

1111
/*!
1212

13-
The Rust core library
13+
# The Rust core library
1414

1515
The Rust core library provides runtime features required by the language,
1616
including the task scheduler and memory allocators, as well as library
1717
support for Rust built-in types, platform abstractions, and other commonly
1818
used features.
1919

2020
`core` includes modules corresponding to each of the integer types, each of
21-
the floating point types, the `bool` type, tuples, characters, strings,
22-
vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`), and unsafe
23-
and borrowed pointers (`ptr`). Additionally, `core` provides task management
24-
and creation (`task`), communication primitives (`comm` and `pipes`), platform
25-
abstractions (`os` and `path`), basic I/O abstractions (`io`), common traits
26-
(`cmp`, `num`, `to_str`), and complete bindings to the C standard library
27-
(`libc`).
21+
the floating point types, the `bool` type, tuples, characters, strings
22+
(`str`), vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`),
23+
and unsafe and borrowed pointers (`ptr`). Additionally, `core` provides
24+
pervasive types (`option` and `result`), task creation and communication
25+
primitives (`task`, `comm`), platform abstractions (`os` and `path`), basic
26+
I/O abstractions (`io`), common traits (`kinds`, `ops`, `cmp`, `num`,
27+
`to_str`), and complete bindings to the C standard library (`libc`).
2828

29-
`core` is linked to all crates by default and its contents imported.
30-
Implicitly, all crates behave as if they included the following prologue:
29+
# Core injection and the Rust prelude
30+
31+
`core` is imported at the topmost level of every crate by default, as
32+
if the first line of each crate was
3133

3234
extern mod core;
33-
use core::*;
35+
36+
This means that the contents of core can be accessed from from any context
37+
with the `core::` path prefix, as in `use core::vec`, `use core::task::spawn`,
38+
etc.
39+
40+
Additionally, `core` contains a `prelude` module that reexports many of the
41+
most common core modules, types and traits. The contents of the prelude are
42+
imported inte every *module* by default. Implicitly, all modules behave as if
43+
they contained the following prologue:
44+
45+
use core::prelude::*;
3446

3547
*/
3648

branches/dist-snap/src/libcore/iter.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ 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.
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`.
288289
#[inline(always)]
289290
pub fn map<T,IT: BaseIter<T>,U,BU: Buildable<U>>(v: &IT, f: &fn(&T) -> U)
290291
-> BU {

branches/dist-snap/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/dist-snap/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);

0 commit comments

Comments
 (0)