Skip to content

Commit cfdc92f

Browse files
committed
---
yaml --- r: 65446 b: refs/heads/master c: ea633b4 h: refs/heads/master v: v3
1 parent fa847c1 commit cfdc92f

File tree

678 files changed

+2478
-3920
lines changed

Some content is hidden

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

678 files changed

+2478
-3920
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: aef1e10eba812b8144b0a4ac8d9b6e690c6e5ca7
2+
refs/heads/master: ea633b42aeadf807a10036a87bf2903123250152
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/doc/rust.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ num_lit : nonzero_dec [ dec_digit | '_' ] * num_suffix ?
301301
num_suffix : int_suffix | float_suffix ;
302302
303303
int_suffix : 'u' int_suffix_size ?
304-
| 'i' int_suffix_size ? ;
304+
| 'i' int_suffix_size ;
305305
int_suffix_size : [ '8' | '1' '6' | '3' '2' | '6' '4' ] ;
306306
307-
float_suffix : [ exponent | '.' dec_lit exponent ? ] ? float_suffix_ty ? ;
307+
float_suffix : [ exponent | '.' dec_lit exponent ? ] float_suffix_ty ? ;
308308
float_suffix_ty : 'f' [ '3' '2' | '6' '4' ] ;
309309
exponent : ['E' | 'e'] ['-' | '+' ] ? dec_lit ;
310310
dec_lit : [ dec_digit | '_' ] + ;
@@ -1840,7 +1840,6 @@ is bounds-checked at run-time. When the check fails, it will put the
18401840
task in a _failing state_.
18411841

18421842
~~~~
1843-
# use std::task;
18441843
# do task::spawn_unlinked {
18451844
18461845
([1, 2, 3, 4])[0];
@@ -2033,8 +2032,7 @@ as
20332032
=
20342033
~~~~
20352034

2036-
Operators at the same precedence level are evaluated left-to-right. [Unary operators](#unary-operator-expressions)
2037-
have the same precedence level and it is stronger than any of the binary operators'.
2035+
Operators at the same precedence level are evaluated left-to-right.
20382036

20392037
### Grouped expressions
20402038

@@ -2170,7 +2168,7 @@ fn ten_times(f: &fn(int)) {
21702168
}
21712169
}
21722170
2173-
ten_times(|j| println(fmt!("hello, %d", j)));
2171+
ten_times(|j| io::println(fmt!("hello, %d", j)));
21742172
21752173
~~~~
21762174

@@ -2191,7 +2189,7 @@ An example:
21912189
let mut i = 0;
21922190
21932191
while i < 10 {
2194-
println("hello\n");
2192+
io::println("hello\n");
21952193
i = i + 1;
21962194
}
21972195
~~~~
@@ -2337,7 +2335,6 @@ for v.each |e| {
23372335
An example of a for loop over a series of integers:
23382336

23392337
~~~~
2340-
# use std::uint;
23412338
# fn bar(b:uint) { }
23422339
for uint::range(0, 256) |i| {
23432340
bar(i);
@@ -2801,7 +2798,6 @@ the vtable pointer for the `T` implementation of `R`, and the pointer value of `
28012798
An example of an object type:
28022799

28032800
~~~~~~~~
2804-
# use std::int;
28052801
trait Printable {
28062802
fn to_str(&self) -> ~str;
28072803
}
@@ -2811,7 +2807,7 @@ impl Printable for int {
28112807
}
28122808
28132809
fn print(a: @Printable) {
2814-
println(a.to_str());
2810+
io::println(a.to_str());
28152811
}
28162812
28172813
fn main() {

trunk/doc/tutorial-ffi.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ A type with the same functionality as owned boxes can be implemented by
149149
wrapping `malloc` and `free`:
150150

151151
~~~~
152-
use std::cast;
153152
use std::libc::{c_void, size_t, malloc, free};
154-
use std::ptr;
155153
use std::unstable::intrinsics;
156154
use std::util;
157155

trunk/doc/tutorial-tasks.md

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ should interleave the output in vaguely random order.
120120
~~~
121121
# use std::io::print;
122122
# use std::task::spawn;
123-
# use std::int;
124123
125124
for int::range(0, 20) |child_task_number| {
126125
do spawn {
@@ -237,7 +236,6 @@ Instead we can use a `SharedChan`, a type that allows a single
237236
~~~
238237
# use std::task::spawn;
239238
# use std::comm::{stream, SharedChan};
240-
# use std::uint;
241239
242240
let (port, chan) = stream();
243241
let chan = SharedChan::new(chan);
@@ -271,7 +269,6 @@ might look like the example below.
271269
~~~
272270
# use std::task::spawn;
273271
# use std::comm::stream;
274-
# use std::vec;
275272
276273
// Create a vector of ports, one for each child task
277274
let ports = do vec::from_fn(3) |init_val| {
@@ -313,8 +310,6 @@ the future needs to be mutable so that it can save the result for next time `get
313310
Here is another example showing how futures allow you to background computations. The workload will
314311
be distributed on the available cores.
315312
~~~
316-
# use std::vec;
317-
# use std::uint;
318313
fn partial_sum(start: uint) -> f64 {
319314
let mut local_sum = 0f64;
320315
for uint::range(start*100000, (start+1)*100000) |num| {
@@ -348,17 +343,14 @@ acts as a reference to the shared data and only this reference is shared and clo
348343
Here is a small example showing how to use ARCs. We wish to run concurrently several computations on
349344
a single large vector of floats. Each task needs the full vector to perform its duty.
350345
~~~
351-
# use std::vec;
352-
# use std::uint;
353-
# use std::rand;
354346
use extra::arc::ARC;
355347
356348
fn pnorm(nums: &~[float], p: uint) -> float {
357349
(vec::foldl(0.0, *nums, |a,b| a+(*b).pow(p as float) )).pow(1f / (p as float))
358350
}
359351
360352
fn main() {
361-
let numbers = vec::from_fn(1000000, |_| rand::random::<float>());
353+
let numbers=vec::from_fn(1000000, |_| rand::random::<float>());
362354
println(fmt!("Inf-norm = %?", numbers.max()));
363355
364356
let numbers_arc = ARC(numbers);
@@ -381,16 +373,12 @@ at the power given as argument and takes the inverse power of this value). The A
381373
created by the line
382374
~~~
383375
# use extra::arc::ARC;
384-
# use std::vec;
385-
# use std::rand;
386-
# let numbers = vec::from_fn(1000000, |_| rand::random::<float>());
376+
# let numbers=vec::from_fn(1000000, |_| rand::random::<float>());
387377
let numbers_arc=ARC(numbers);
388378
~~~
389379
and a clone of it is sent to each task
390380
~~~
391381
# use extra::arc::ARC;
392-
# use std::vec;
393-
# use std::rand;
394382
# let numbers=vec::from_fn(1000000, |_| rand::random::<float>());
395383
# let numbers_arc = ARC(numbers);
396384
# let (port, chan) = stream();
@@ -401,8 +389,6 @@ copying only the wrapper and not its contents.
401389
Each task recovers the underlying data by
402390
~~~
403391
# use extra::arc::ARC;
404-
# use std::vec;
405-
# use std::rand;
406392
# let numbers=vec::from_fn(1000000, |_| rand::random::<float>());
407393
# let numbers_arc=ARC(numbers);
408394
# let (port, chan) = stream();
@@ -430,7 +416,6 @@ of all tasks are intertwined: if one fails, so do all the others.
430416

431417
~~~
432418
# use std::task::spawn;
433-
# use std::task;
434419
# fn do_some_work() { loop { task::yield() } }
435420
# do task::try {
436421
// Create a child task that fails
@@ -452,7 +437,6 @@ field (representing a successful result) or an `Err` result (representing
452437
termination with an error).
453438

454439
~~~
455-
# use std::task;
456440
# fn some_condition() -> bool { false }
457441
# fn calculate_result() -> int { 0 }
458442
let result: Result<int, ()> = do task::try {
@@ -495,7 +479,6 @@ By default, task failure is _bidirectionally linked_, which means that if
495479
either task fails, it kills the other one.
496480

497481
~~~
498-
# use std::task;
499482
# fn sleep_forever() { loop { task::yield() } }
500483
# do task::try {
501484
do spawn {
@@ -518,7 +501,6 @@ before returning. Hence:
518501
~~~
519502
# use std::comm::{stream, Chan, Port};
520503
# use std::task::{spawn, try};
521-
# use std::task;
522504
# fn sleep_forever() { loop { task::yield() } }
523505
# do task::try {
524506
let (receiver, sender): (Port<int>, Chan<int>) = stream();
@@ -546,7 +528,6 @@ Supervised task failure propagates across multiple generations even if
546528
an intermediate generation has already exited:
547529

548530
~~~
549-
# use std::task;
550531
# fn sleep_forever() { loop { task::yield() } }
551532
# fn wait_for_a_while() { for 1000.times { task::yield() } }
552533
# do task::try::<int> {
@@ -565,7 +546,6 @@ Finally, tasks can be configured to not propagate failure to each
565546
other at all, using `task::spawn_unlinked` for _isolated failure_.
566547

567548
~~~
568-
# use std::task;
569549
# fn random() -> uint { 100 }
570550
# fn sleep_for(i: uint) { for i.times { task::yield() } }
571551
# do task::try::<()> {
@@ -594,7 +574,6 @@ Here is the function that implements the child task:
594574

595575
~~~~
596576
# use extra::comm::DuplexStream;
597-
# use std::uint;
598577
fn stringifier(channel: &DuplexStream<~str, uint>) {
599578
let mut value: uint;
600579
loop {
@@ -617,7 +596,6 @@ Here is the code for the parent task:
617596

618597
~~~~
619598
# use std::task::spawn;
620-
# use std::uint;
621599
# use extra::comm::DuplexStream;
622600
# fn stringifier(channel: &DuplexStream<~str, uint>) {
623601
# let mut value: uint;

trunk/doc/tutorial.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,6 @@ types.
502502
> items.
503503
504504
~~~~
505-
# use std::float;
506505
fn angle(vector: (float, float)) -> float {
507506
let pi = float::consts::pi;
508507
match vector {
@@ -557,7 +556,6 @@ while cake_amount > 0 {
557556
`loop` denotes an infinite loop, and is the preferred way of writing `while true`:
558557

559558
~~~~
560-
# use std::int;
561559
let mut x = 5;
562560
loop {
563561
x += x - 3;
@@ -701,7 +699,6 @@ get at their contents. All variant constructors can be used as
701699
patterns, as in this definition of `area`:
702700

703701
~~~~
704-
# use std::float;
705702
# struct Point {x: float, y: float}
706703
# enum Shape { Circle(Point, float), Rectangle(Point, Point) }
707704
fn area(sh: Shape) -> float {
@@ -1832,7 +1829,6 @@ vector consisting of the result of applying `function` to each element
18321829
of `vector`:
18331830

18341831
~~~~
1835-
# use std::vec;
18361832
fn map<T, U>(vector: &[T], function: &fn(v: &T) -> U) -> ~[U] {
18371833
let mut accumulator = ~[];
18381834
for vec::each(vector) |element| {
@@ -2030,7 +2026,6 @@ themselves contain type parameters. A trait for generalized sequence
20302026
types might look like the following:
20312027

20322028
~~~~
2033-
# use std::vec;
20342029
trait Seq<T> {
20352030
fn len(&self) -> uint;
20362031
fn iter(&self, b: &fn(v: &T));

trunk/src/compiletest/compiletest.rc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
#[no_std];
1717

1818
extern mod core(name = "std", vers = "0.7-pre");
19-
extern mod extra(name = "extra", vers = "0.7-pre");
19+
extern mod std(name = "extra", vers = "0.7-pre");
2020

2121
use core::prelude::*;
2222
use core::*;
2323

24-
use extra::getopts;
25-
use extra::test;
24+
use std::getopts;
25+
use std::test;
2626

2727
use core::result::{Ok, Err};
2828

@@ -42,13 +42,6 @@ pub mod runtest;
4242
pub mod common;
4343
pub mod errors;
4444

45-
mod std {
46-
pub use core::cmp;
47-
pub use core::str;
48-
pub use core::sys;
49-
pub use core::unstable;
50-
}
51-
5245
pub fn main() {
5346
let args = os::args();
5447
let config = parse_config(args);

trunk/src/compiletest/errors.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010

1111
use core::prelude::*;
1212

13-
use core::io;
14-
use core::str;
15-
1613
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
1714

1815
// Load any test directives embedded in the file

trunk/src/compiletest/header.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,8 @@
1010

1111
use core::prelude::*;
1212

13-
use common::config;
1413
use common;
15-
16-
use core::io;
17-
use core::os;
18-
use core::str;
14+
use common::config;
1915

2016
pub struct TestProps {
2117
// Lines that should be expected, in order, on standard out
@@ -99,7 +95,7 @@ pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
9995
return false;
10096

10197
fn xfail_target() -> ~str {
102-
~"xfail-" + os::SYSNAME
98+
~"xfail-" + str::to_owned(os::SYSNAME)
10399
}
104100
}
105101
@@ -173,7 +169,7 @@ fn parse_name_directive(line: &str, directive: &str) -> bool {
173169

174170
fn parse_name_value_directive(line: &str,
175171
directive: ~str) -> Option<~str> {
176-
let keycolon = directive + ":";
172+
let keycolon = directive + ~":";
177173
match str::find_str(line, keycolon) {
178174
Some(colon) => {
179175
let value = str::slice(line, colon + str::len(keycolon),

trunk/src/compiletest/procsrv.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,20 @@
1010

1111
use core::prelude::*;
1212

13-
use core::comm;
14-
use core::io;
15-
use core::libc::c_int;
16-
use core::os;
1713
use core::run;
18-
use core::str;
19-
use core::task;
2014

2115
#[cfg(target_os = "win32")]
2216
fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {
2317

2418
let mut env = os::env();
2519

2620
// Make sure we include the aux directory in the path
27-
assert!(prog.ends_with(".exe"));
28-
let aux_path = prog.slice(0u, prog.len() - 4u).to_owned() + ".libaux";
21+
assert!(prog.ends_with(~".exe"));
22+
let aux_path = prog.slice(0u, prog.len() - 4u).to_owned() + ~".libaux";
2923
3024
env = do vec::map(env) |pair| {
3125
let (k,v) = *pair;
32-
if k == ~"PATH" { (~"PATH", v + ";" + lib_path + ";" + aux_path) }
26+
if k == ~"PATH" { (~"PATH", v + ~";" + lib_path + ~";" + aux_path) }
3327
else { (k,v) }
3428
};
3529
if str::ends_with(prog, "rustc.exe") {

0 commit comments

Comments
 (0)