Skip to content

Commit 6ce743a

Browse files
committed
---
yaml --- r: 80393 b: refs/heads/snap-stage3 c: b05dcca h: refs/heads/master i: 80391: 807ae16 v: v3
1 parent dba332f commit 6ce743a

Some content is hidden

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

74 files changed

+1422
-1487
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 3e1803f3af1adc1b2e5595650f6920f40bbedc2e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 555589ef7fda4dae1ee99e5f624f88d6855773a3
4+
refs/heads/snap-stage3: b05dccacaeb5986897aa132e4fd9c07426106f49
55
refs/heads/try: 71bebebc37fbb229877da88dde13c2f35913bd77
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/tutorial-conditions.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn read_int_pairs() -> ~[(int,int)] {
9191
[a, b] => {
9292
9393
// 5. Try parsing both fields as ints.
94-
match (int::from_str(a), int::from_str(b)) {
94+
match (from_str::<int>(a), from_str::<int>(b)) {
9595
9696
// 6. If parsing succeeded for both, push both.
9797
(Some(a), Some(b)) => pairs.push((a,b)),
@@ -124,7 +124,7 @@ for conveying a value of type `T`, represented as `Some(T)`
124124
_or_ the sentinel `None`, to indicate the absence of a `T` value.
125125
For simple APIs, it may be sufficient to encode errors as `Option<T>`,
126126
returning `Some(T)` on success and `None` on error.
127-
In the example program, the call to `int::from_str` returns `Option<int>`
127+
In the example program, the call to `from_str::<int>` returns `Option<int>`
128128
with the understanding that "all parse errors" result in `None`.
129129
The resulting `Option<int>` values are matched against the pattern `(Some(a), Some(b))`
130130
in steps 5 and 6 in the example program,
@@ -161,7 +161,7 @@ This second mechanism for indicating an error is called a `Result`.
161161
The type `std::result::Result<T,E>` is another simple `enum` type with two forms, `Ok(T)` and `Err(E)`.
162162
The `Result` type is not substantially different from the `Option` type in terms of its ergonomics.
163163
Its main advantage is that the error constructor `Err(E)` can convey _more detail_ about the error.
164-
For example, the `int::from_str` API could be reformed
164+
For example, the `from_str` API could be reformed
165165
to return a `Result` carrying an informative description of a parse error,
166166
like this:
167167

@@ -172,7 +172,7 @@ enum IntParseErr {
172172
BadChar(char)
173173
}
174174
175-
fn int::from_str(&str) -> Result<int,IntParseErr> {
175+
fn from_str(&str) -> Result<int,IntParseErr> {
176176
// ...
177177
}
178178
~~~~
@@ -297,8 +297,8 @@ fn read_int_pairs() -> ~[(int,int)] {
297297
let line = fi.read_line();
298298
let fields = line.word_iter().to_owned_vec();
299299
match fields {
300-
[a, b] => pairs.push((int::from_str(a).unwrap(),
301-
int::from_str(b).unwrap())),
300+
[a, b] => pairs.push((from_str::<int>(a).unwrap(),
301+
from_str::<int>(b).unwrap())),
302302
303303
// Explicitly fail on malformed lines.
304304
_ => fail!()
@@ -398,8 +398,8 @@ fn read_int_pairs() -> ~[(int,int)] {
398398
let line = fi.read_line();
399399
let fields = line.word_iter().to_owned_vec();
400400
match fields {
401-
[a, b] => pairs.push((int::from_str(a).unwrap(),
402-
int::from_str(b).unwrap())),
401+
[a, b] => pairs.push((from_str::<int>(a).unwrap(),
402+
from_str::<int>(b).unwrap())),
403403
404404
// On malformed lines, call the condition handler and
405405
// push whatever the condition handler returns.
@@ -475,8 +475,8 @@ fn read_int_pairs() -> ~[(int,int)] {
475475
let line = fi.read_line();
476476
let fields = line.word_iter().to_owned_vec();
477477
match fields {
478-
[a, b] => pairs.push((int::from_str(a).unwrap(),
479-
int::from_str(b).unwrap())),
478+
[a, b] => pairs.push((from_str::<int>(a).unwrap(),
479+
from_str::<int>(b).unwrap())),
480480
_ => pairs.push(malformed_line::cond.raise(line.clone()))
481481
}
482482
}
@@ -553,8 +553,8 @@ fn read_int_pairs() -> ~[(int,int)] {
553553
let line = fi.read_line();
554554
let fields = line.word_iter().to_owned_vec();
555555
match fields {
556-
[a, b] => pairs.push((int::from_str(a).unwrap(),
557-
int::from_str(b).unwrap())),
556+
[a, b] => pairs.push((from_str::<int>(a).unwrap(),
557+
from_str::<int>(b).unwrap())),
558558
559559
// On malformed lines, call the condition handler and
560560
// either ignore the line (if the handler returns `None`)
@@ -649,8 +649,8 @@ fn read_int_pairs() -> ~[(int,int)] {
649649
let line = fi.read_line();
650650
let fields = line.word_iter().to_owned_vec();
651651
match fields {
652-
[a, b] => pairs.push((int::from_str(a).unwrap(),
653-
int::from_str(b).unwrap())),
652+
[a, b] => pairs.push((from_str::<int>(a).unwrap(),
653+
from_str::<int>(b).unwrap())),
654654
655655
// On malformed lines, call the condition handler and
656656
// take action appropriate to the enum value returned.
@@ -776,7 +776,7 @@ fn main() {
776776
// Parse an int; if parsing fails, call the condition handler and
777777
// return whatever it returns.
778778
fn parse_int(x: &str) -> int {
779-
match int::from_str(x) {
779+
match from_str::<int>(x) {
780780
Some(v) => v,
781781
None => malformed_int::cond.raise(x.to_owned())
782782
}
@@ -833,8 +833,8 @@ There are three other things to note in this variant of the example program:
833833
so long as the `raise` occurs within a callee (of any depth) of the logic protected by the `trap` call,
834834
it will invoke the handler.
835835

836-
- This variant insulates callers from a design choice in the `int` library:
837-
the `int::from_str` function was designed to return an `Option<int>`,
836+
- This variant insulates callers from a design choice in the library:
837+
the `from_str` function was designed to return an `Option<int>`,
838838
but this program insulates callers from that choice,
839839
routing all `None` values that arise from parsing integers in this file into the condition.
840840

@@ -873,4 +873,4 @@ To compensate for this risk, correct C++ and Java code must program in an extrem
873873
or else risk introducing silent and very difficult-to-debug errors due to control resuming in a corrupted heap after a caught exception.
874874
These errors are frequently memory-safety errors, which Rust strives to eliminate,
875875
and so Rust unwinding is unrecoverable within a single task:
876-
once unwinding starts, the entire local heap of a task is destroyed and the task is terminated.
876+
once unwinding starts, the entire local heap of a task is destroyed and the task is terminated.

branches/snap-stage3/doc/tutorial-tasks.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ concurrency at this writing:
4747

4848
* [`std::task`] - All code relating to tasks and task scheduling,
4949
* [`std::comm`] - The message passing interface,
50-
* [`extra::comm`] - Additional messaging types based on `std::comm`,
50+
* [`std::pipes`] - The underlying messaging infrastructure,
51+
* [`extra::comm`] - Additional messaging types based on `std::pipes`,
5152
* [`extra::sync`] - More exotic synchronization tools, including locks,
5253
* [`extra::arc`] - The Arc (atomically reference counted) type,
5354
for safely sharing immutable data,
5455
* [`extra::future`] - A type representing values that may be computed concurrently and retrieved at a later time.
5556

5657
[`std::task`]: std/task.html
5758
[`std::comm`]: std/comm.html
59+
[`std::pipes`]: std/pipes.html
5860
[`extra::comm`]: extra/comm.html
5961
[`extra::sync`]: extra/sync.html
6062
[`extra::arc`]: extra/arc.html
@@ -123,7 +125,7 @@ receiving messages. Pipes are low-level communication building-blocks and so
123125
come in a variety of forms, each one appropriate for a different use case. In
124126
what follows, we cover the most commonly used varieties.
125127

126-
The simplest way to create a pipe is to use the `comm::stream`
128+
The simplest way to create a pipe is to use the `pipes::stream`
127129
function to create a `(Port, Chan)` pair. In Rust parlance, a *channel*
128130
is a sending endpoint of a pipe, and a *port* is the receiving
129131
endpoint. Consider the following example of calculating two results

branches/snap-stage3/src/libextra/crypto/md5.rs

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

11-
use std::uint;
11+
use std::iter::range_step;
1212

1313
use cryptoutil::{write_u32_le, read_u32v_le, FixedBuffer, FixedBuffer64, StandardPadding};
1414
use digest::Digest;
@@ -86,46 +86,42 @@ impl Md5State {
8686
read_u32v_le(data, input);
8787

8888
// round 1
89-
do uint::range_step(0, 16, 4) |i| {
89+
for i in range_step(0u, 16, 4) {
9090
a = op_f(a, b, c, d, data[i] + C1[i], 7);
9191
d = op_f(d, a, b, c, data[i + 1] + C1[i + 1], 12);
9292
c = op_f(c, d, a, b, data[i + 2] + C1[i + 2], 17);
9393
b = op_f(b, c, d, a, data[i + 3] + C1[i + 3], 22);
94-
true
95-
};
94+
}
9695

9796
// round 2
9897
let mut t = 1;
99-
do uint::range_step(0, 16, 4) |i| {
98+
for i in range_step(0u, 16, 4) {
10099
a = op_g(a, b, c, d, data[t & 0x0f] + C2[i], 5);
101100
d = op_g(d, a, b, c, data[(t + 5) & 0x0f] + C2[i + 1], 9);
102101
c = op_g(c, d, a, b, data[(t + 10) & 0x0f] + C2[i + 2], 14);
103102
b = op_g(b, c, d, a, data[(t + 15) & 0x0f] + C2[i + 3], 20);
104103
t += 20;
105-
true
106-
};
104+
}
107105

108106
// round 3
109107
t = 5;
110-
do uint::range_step(0, 16, 4) |i| {
108+
for i in range_step(0u, 16, 4) {
111109
a = op_h(a, b, c, d, data[t & 0x0f] + C3[i], 4);
112110
d = op_h(d, a, b, c, data[(t + 3) & 0x0f] + C3[i + 1], 11);
113111
c = op_h(c, d, a, b, data[(t + 6) & 0x0f] + C3[i + 2], 16);
114112
b = op_h(b, c, d, a, data[(t + 9) & 0x0f] + C3[i + 3], 23);
115113
t += 12;
116-
true
117-
};
114+
}
118115

119116
// round 4
120117
t = 0;
121-
do uint::range_step(0, 16, 4) |i| {
118+
for i in range_step(0u, 16, 4) {
122119
a = op_i(a, b, c, d, data[t & 0x0f] + C4[i], 6);
123120
d = op_i(d, a, b, c, data[(t + 7) & 0x0f] + C4[i + 1], 10);
124121
c = op_i(c, d, a, b, data[(t + 14) & 0x0f] + C4[i + 2], 15);
125122
b = op_i(b, c, d, a, data[(t + 21) & 0x0f] + C4[i + 3], 21);
126123
t += 28;
127-
true
128-
};
124+
}
129125

130126
self.s0 += a;
131127
self.s1 += b;

branches/snap-stage3/src/libextra/crypto/sha2.rs

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

11-
use std::uint;
11+
use std::iter::range_step;
1212

1313
use cryptoutil::{write_u64_be, write_u32_be, read_u64v_be, read_u32v_be, add_bytes_to_bits,
1414
add_bytes_to_bits_tuple, FixedBuffer, FixedBuffer128, FixedBuffer64, StandardPadding};
@@ -111,7 +111,7 @@ impl Engine512State {
111111

112112
// Putting the message schedule inside the same loop as the round calculations allows for
113113
// the compiler to generate better code.
114-
do uint::range_step(0, 64, 8) |t| {
114+
for t in range_step(0u, 64, 8) {
115115
schedule_round!(t + 16);
116116
schedule_round!(t + 17);
117117
schedule_round!(t + 18);
@@ -129,10 +129,9 @@ impl Engine512State {
129129
sha2_round!(d, e, f, g, h, a, b, c, K64, t + 5);
130130
sha2_round!(c, d, e, f, g, h, a, b, K64, t + 6);
131131
sha2_round!(b, c, d, e, f, g, h, a, K64, t + 7);
132-
true
133-
};
132+
}
134133

135-
do uint::range_step(64, 80, 8) |t| {
134+
for t in range_step(64u, 80, 8) {
136135
sha2_round!(a, b, c, d, e, f, g, h, K64, t);
137136
sha2_round!(h, a, b, c, d, e, f, g, K64, t + 1);
138137
sha2_round!(g, h, a, b, c, d, e, f, K64, t + 2);
@@ -141,8 +140,7 @@ impl Engine512State {
141140
sha2_round!(d, e, f, g, h, a, b, c, K64, t + 5);
142141
sha2_round!(c, d, e, f, g, h, a, b, K64, t + 6);
143142
sha2_round!(b, c, d, e, f, g, h, a, K64, t + 7);
144-
true
145-
};
143+
}
146144

147145
self.H0 += a;
148146
self.H1 += b;
@@ -527,7 +525,7 @@ impl Engine256State {
527525

528526
// Putting the message schedule inside the same loop as the round calculations allows for
529527
// the compiler to generate better code.
530-
do uint::range_step(0, 48, 8) |t| {
528+
for t in range_step(0u, 48, 8) {
531529
schedule_round!(t + 16);
532530
schedule_round!(t + 17);
533531
schedule_round!(t + 18);
@@ -545,10 +543,9 @@ impl Engine256State {
545543
sha2_round!(d, e, f, g, h, a, b, c, K32, t + 5);
546544
sha2_round!(c, d, e, f, g, h, a, b, K32, t + 6);
547545
sha2_round!(b, c, d, e, f, g, h, a, K32, t + 7);
548-
true
549-
};
546+
}
550547

551-
do uint::range_step(48, 64, 8) |t| {
548+
for t in range_step(48u, 64, 8) {
552549
sha2_round!(a, b, c, d, e, f, g, h, K32, t);
553550
sha2_round!(h, a, b, c, d, e, f, g, K32, t + 1);
554551
sha2_round!(g, h, a, b, c, d, e, f, K32, t + 2);
@@ -557,8 +554,7 @@ impl Engine256State {
557554
sha2_round!(d, e, f, g, h, a, b, c, K32, t + 5);
558555
sha2_round!(c, d, e, f, g, h, a, b, K32, t + 6);
559556
sha2_round!(b, c, d, e, f, g, h, a, K32, t + 7);
560-
true
561-
};
557+
}
562558

563559
self.H0 += a;
564560
self.H1 += b;

branches/snap-stage3/src/libextra/fileinput.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ mod test {
538538

539539
do input_vec_state(filenames) |line, state| {
540540
let nums: ~[&str] = line.split_iter(' ').collect();
541-
let file_num = uint::from_str(nums[0]).unwrap();
542-
let line_num = uint::from_str(nums[1]).unwrap();
541+
let file_num = from_str::<uint>(nums[0]).unwrap();
542+
let line_num = from_str::<uint>(nums[1]).unwrap();
543543
assert_eq!(line_num, state.line_num_file);
544544
assert_eq!(file_num * 3 + line_num, state.line_num);
545545
true

branches/snap-stage3/src/libextra/semver.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use std::io::{ReaderUtil};
1919
use std::io;
2020
use std::option::{Option, Some, None};
2121
use std::to_str::ToStr;
22-
use std::uint;
2322

2423
#[deriving(Clone, Eq)]
2524
pub enum Identifier {
@@ -140,7 +139,7 @@ fn take_nonempty_prefix(rdr: @io::Reader,
140139

141140
fn take_num(rdr: @io::Reader, ch: char) -> (uint, char) {
142141
let (s, ch) = take_nonempty_prefix(rdr, ch, char::is_digit);
143-
match uint::from_str(s) {
142+
match from_str::<uint>(s) {
144143
None => { bad_parse::cond.raise(()); (0, ch) },
145144
Some(i) => (i, ch)
146145
}
@@ -149,7 +148,7 @@ fn take_num(rdr: @io::Reader, ch: char) -> (uint, char) {
149148
fn take_ident(rdr: @io::Reader, ch: char) -> (Identifier, char) {
150149
let (s,ch) = take_nonempty_prefix(rdr, ch, char::is_alphanumeric);
151150
if s.iter().all(char::is_digit) {
152-
match uint::from_str(s) {
151+
match from_str::<uint>(s) {
153152
None => { bad_parse::cond.raise(()); (Numeric(0), ch) },
154153
Some(i) => (Numeric(i), ch)
155154
}

branches/snap-stage3/src/libextra/test.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use std::task;
3737
use std::to_str::ToStr;
3838
use std::f64;
3939
use std::os;
40-
use std::uint;
4140

4241

4342
// The name of a test. By convention this follows the rules for rust
@@ -253,7 +252,7 @@ pub fn parse_opts(args: &[~str]) -> OptRes {
253252
let ratchet_metrics = ratchet_metrics.map_move(|s| Path(s));
254253

255254
let ratchet_noise_percent = getopts::opt_maybe_str(&matches, "ratchet-noise-percent");
256-
let ratchet_noise_percent = ratchet_noise_percent.map_move(|s| f64::from_str(s).unwrap());
255+
let ratchet_noise_percent = ratchet_noise_percent.map_move(|s| from_str::<f64>(s).unwrap());
257256

258257
let save_metrics = getopts::opt_maybe_str(&matches, "save-metrics");
259258
let save_metrics = save_metrics.map_move(|s| Path(s));
@@ -281,7 +280,7 @@ pub fn opt_shard(maybestr: Option<~str>) -> Option<(uint,uint)> {
281280
None => None,
282281
Some(s) => {
283282
match s.split_iter('.').to_owned_vec() {
284-
[a, b] => match (uint::from_str(a), uint::from_str(b)) {
283+
[a, b] => match (from_str::<uint>(a), from_str::<uint>(b)) {
285284
(Some(a), Some(b)) => Some((a,b)),
286285
_ => None
287286
},

branches/snap-stage3/src/librust/rust.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ static COMMANDS: &'static [Command<'static>] = &'static [
8484
usage_full: UsgStr(
8585
"The test command is an shortcut for the command line \n\
8686
\"rustc --test <filename> -o <filestem>test~ && \
87-
./<filestem>test~\"\n\nUsage:\trust test <filename>"
87+
./<filestem>test~ [<arguments>...]\"\
88+
\n\nUsage:\trust test <filename> [<arguments>...]"
8889
)
8990
},
9091
Command {
@@ -155,12 +156,12 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
155156

156157
fn cmd_test(args: &[~str]) -> ValidUsage {
157158
match args {
158-
[ref filename] => {
159+
[ref filename, ..prog_args] => {
159160
let p = Path(*filename);
160161
let test_exec = p.filestem().unwrap() + "test~";
161162
invoke("rustc", &[~"--test", filename.to_owned(),
162163
~"-o", test_exec.to_owned()], rustc::main_args);
163-
let exit_code = run::process_status(~"./" + test_exec, []);
164+
let exit_code = run::process_status(~"./" + test_exec, prog_args);
164165
Valid(exit_code)
165166
}
166167
_ => Invalid

branches/snap-stage3/src/librustc/lib/llvm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,9 @@ pub mod llvm {
21172117
LineNo: c_uint)
21182118
-> ValueRef;
21192119

2120+
#[fast_ffi]
2121+
pub fn LLVMDICompositeTypeSetTypeArray(CompositeType: ValueRef, TypeArray: ValueRef);
2122+
21202123
#[fast_ffi]
21212124
pub fn LLVMIsAArgument(value_ref: ValueRef) -> ValueRef;
21222125

0 commit comments

Comments
 (0)