Skip to content

Commit ef836e3

Browse files
committed
---
yaml --- r: 132758 b: refs/heads/dist-snap c: 259e806 h: refs/heads/master v: v3
1 parent 50918b8 commit ef836e3

File tree

173 files changed

+3114
-645
lines changed

Some content is hidden

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

173 files changed

+3114
-645
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: c69f7a92345bea876ef2f292d73b88d31cc51e95
9+
refs/heads/dist-snap: 259e806db6f444b5836c72c9ca8e43d52a5e7f8a
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ documentation.
3232

3333
To build from the [tarball] do:
3434

35-
$ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz
35+
$ curl -O https://static.rust-lang.org/dist/rust-nightly.tar.gz
3636
$ tar -xzf rust-nightly.tar.gz
3737
$ cd rust-nightly
3838

@@ -75,7 +75,7 @@ To easily build on windows we can use [MSYS2](http://sourceforge.net/projects/ms
7575
$ make && make install
7676

7777
[repo]: https://github.com/rust-lang/rust
78-
[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz
78+
[tarball]: https://static.rust-lang.org/dist/rust-nightly.tar.gz
7979
[tutorial]: http://doc.rust-lang.org/tutorial.html
8080

8181
## Notes

branches/dist-snap/src/compiletest/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ fn parse_exec_env(line: &str) -> Option<(String, String)> {
233233
parse_name_value_directive(line, "exec-env").map(|nv| {
234234
// nv is either FOO or FOO=BAR
235235
let mut strs: Vec<String> = nv.as_slice()
236-
.splitn('=', 1)
236+
.splitn(1, '=')
237237
.map(|s| s.to_string())
238238
.collect();
239239

branches/dist-snap/src/compiletest/runtest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use std::os;
3030
use std::str;
3131
use std::string::String;
3232
use std::task;
33+
use std::time::Duration;
3334
use test::MetricMap;
3435

3536
pub fn run(config: Config, testfile: String) {
@@ -400,7 +401,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
400401
.expect(format!("failed to exec `{}`", config.adb_path).as_slice());
401402
loop {
402403
//waiting 1 second for gdbserver start
403-
timer::sleep(1000);
404+
timer::sleep(Duration::milliseconds(1000));
404405
let result = task::try(proc() {
405406
tcp::TcpStream::connect("127.0.0.1", 5039).unwrap();
406407
});

branches/dist-snap/src/doc/guide-runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ itself, yet again implying that they are not defined in the standard library.
128128
The full complement of runtime features is defined by the [`Runtime`
129129
trait](std/rt/trait.Runtime.html) and the [`Task`
130130
struct](std/rt/task/struct.Task.html). A `Task` is constant among all runtime
131-
implementations, but each runtime implements has its own implementation of the
131+
implementations, but each runtime has its own implementation of the
132132
`Runtime` trait.
133133

134134
The local `Task` stores the runtime value inside of itself, and then ownership

branches/dist-snap/src/doc/guide-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ per-iteration speed of.
198198

199199
For benchmarks relating to processing/generating data, one can set the
200200
`bytes` field to the number of bytes consumed/produced in each
201-
iteration; this will used to show the throughput of the benchmark.
201+
iteration; this will be used to show the throughput of the benchmark.
202202
This must be the amount used in each iteration, *not* the total
203203
amount.
204204

branches/dist-snap/src/doc/guide-unsafe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ explicitly with, respectively, `value as *const T` and `value as *mut T`).
137137

138138
Going the opposite direction, from `*const` to a reference `&`, is not
139139
safe. A `&T` is always valid, and so, at a minimum, the raw pointer
140-
`*const T` has to be a valid to a valid instance of type `T`. Furthermore,
140+
`*const T` has to point to a valid instance of type `T`. Furthermore,
141141
the resulting pointer must satisfy the aliasing and mutability laws of
142142
references. The compiler assumes these properties are true for any
143143
references, no matter how they are created, and so any conversion from

branches/dist-snap/src/doc/guide.md

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ Linux or a Mac, all you need to do is this (note that you don't need to type
3232
in the `$`s, they just indicate the start of each command):
3333

3434
```{ignore}
35-
$ curl -s http://www.rust-lang.org/rustup.sh | sudo sh
35+
$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh
3636
```
3737

3838
(If you're concerned about `curl | sudo sh`, please keep reading. Disclaimer
3939
below.)
4040

4141
If you're on Windows, please [download this .exe and run
42-
it](http://static.rust-lang.org/dist/rust-nightly-install.exe).
42+
it](https://static.rust-lang.org/dist/rust-nightly-install.exe).
4343

4444
If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
4545
Not every programming language is great for everyone. Just pass an argument to
4646
the script:
4747

4848
```{ignore}
49-
$ curl -s http://www.rust-lang.org/rustup.sh | sudo sh -s -- --uninstall
49+
$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --uninstall
5050
```
5151

5252
If you used the Windows installer, just re-run the `.exe` and it will give you
@@ -666,7 +666,7 @@ This is not the same as this, which won't compile:
666666
```{ignore}
667667
let x = 5i;
668668
669-
let y: int = if x == 5 { 10i; } else { 15i; };
669+
let y: int = if x == 5i { 10i; } else { 15i; };
670670
```
671671

672672
Note the semicolons after the 10 and 15. Rust will give us the following error:
@@ -1341,7 +1341,7 @@ computer science: naming things, cache invalidation, and off-by-one errors."
13411341
The joke, of course, being that the setup says "two hard problems" but then
13421342
lists three things. This happens quite a bit with "C style" `for` loops.
13431343

1344-
We'll talk more about `for` when we cover **vector**s, later in the Guide.
1344+
We'll talk more about `for` when we cover **iterator**s, later in the Guide.
13451345

13461346
## `while`
13471347

@@ -1427,11 +1427,6 @@ for x in range(0i, 10i) {
14271427

14281428
Both `continue` and `break` are valid in both kinds of loops.
14291429

1430-
We have now learned all of the most basic Rust concepts. We're ready to start
1431-
building our guessing game, but we need to know how to do one last thing first:
1432-
get input from the keyboard. You can't have a guessing game without the ability
1433-
to guess!
1434-
14351430
# Strings
14361431

14371432
Strings are an important concept for any programmer to master. Rust's string
@@ -1512,6 +1507,76 @@ low-level details matter, they really matter. Just remember that `String`s
15121507
allocate memory and control their data, while `&str`s are a reference to
15131508
another string, and you'll be all set.
15141509

1510+
# Vectors
1511+
1512+
Like many programming languages, Rust has a list type for when you want a list
1513+
of things. But similar to strings, Rust has different types to represent this
1514+
idea: `Vec<T>` (a 'vector'), `[T, .. N]` (an 'array'), and `&[T]` (a 'slice').
1515+
Whew!
1516+
1517+
Vectors are similar to `String`s: they have a dynamic length, and they
1518+
allocate enough memory to fit. You can create a vector with the `vec!` macro:
1519+
1520+
```{rust}
1521+
let nums = vec![1i, 2i, 3i];
1522+
```
1523+
1524+
Notice that unlike the `println!` macro we've used in the past, we use square
1525+
brackets (`[]`) with `vec!`. Rust allows you to use either in either situation,
1526+
this is just convention.
1527+
1528+
You can create an array with just square brackets:
1529+
1530+
```{rust}
1531+
let nums = [1i, 2i, 3i];
1532+
```
1533+
1534+
So what's the difference? An array has a fixed size, so you can't add or
1535+
subtract elements:
1536+
1537+
```{rust,ignore}
1538+
let mut nums = vec![1i, 2i, 3i];
1539+
nums.push(4i); // works
1540+
1541+
let mut nums = [1i, 2i, 3i];
1542+
nums.push(4i); // error: type `[int, .. 3]` does not implement any method
1543+
// in scope named `push`
1544+
```
1545+
1546+
The `push()` method lets you append a value to the end of the vector. But
1547+
since arrays have fixed sizes, adding an element doesn't make any sense.
1548+
You can see how it has the exact type in the error message: `[int, .. 3]`.
1549+
An array of `int`s, with length 3.
1550+
1551+
Similar to `&str`, a slice is a reference to another array. We can get a
1552+
slice from a vector by using the `as_slice()` method:
1553+
1554+
```{rust}
1555+
let vec = vec![1i, 2i, 3i];
1556+
let slice = vec.as_slice();
1557+
```
1558+
1559+
All three types implement an `iter()` method, which returns an iterator. We'll
1560+
talk more about the details of iterators later, but for now, the `iter()` method
1561+
allows you to write a `for` loop that prints out the contents of a vector, array,
1562+
or slice:
1563+
1564+
```{rust}
1565+
let vec = vec![1i, 2i, 3i];
1566+
1567+
for i in vec.iter() {
1568+
println!("{}", i);
1569+
}
1570+
```
1571+
1572+
This code will print each number in order, on its own line.
1573+
1574+
There's a whole lot more to vectors, but that's enough to get started. We have
1575+
now learned all of the most basic Rust concepts. We're ready to start building
1576+
our guessing game, but we need to know how to do one last thing first: get
1577+
input from the keyboard. You can't have a guessing game without the ability to
1578+
guess!
1579+
15151580
# Standard Input
15161581

15171582
Getting input from the keyboard is pretty easy, but uses some things

branches/dist-snap/src/doc/rust.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,9 @@ A *static item* is a named _constant value_ stored in the global data section of
13561356
Immutable static items are stored in the read-only data section.
13571357
The constant value bound to a static item is, like all constant values, evaluated at compile time.
13581358
Static items have the `static` lifetime, which outlives all other lifetimes in a Rust program.
1359+
Only values stored in the global data section (such as string constants
1360+
and static items) can have the `static` lifetime;
1361+
dynamically constructed values cannot safely be assigned the `static` lifetime.
13591362
Static items are declared with the `static` keyword.
13601363
A static item must have a _constant expression_ giving its definition.
13611364

@@ -3653,7 +3656,10 @@ There are four varieties of pointer in Rust:
36533656
References arise by (automatic) conversion from owning pointers, managed pointers,
36543657
or by applying the borrowing operator `&` to some other value,
36553658
including [lvalues, rvalues or temporaries](#lvalues,-rvalues-and-temporaries).
3656-
References are written `&content`, or in some cases `&'f content` for some lifetime-variable `f`,
3659+
A borrow expression is written `&content`.
3660+
3661+
A reference type is written `&'f type` for some lifetime-variable `f`,
3662+
or just `&type` when the lifetime can be elided;
36573663
for example `&int` means a reference to an integer.
36583664
Copying a reference is a "shallow" operation:
36593665
it involves only copying the pointer itself.

branches/dist-snap/src/doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ If you've fulfilled those prerequisites, something along these lines
114114
should work.
115115

116116
~~~~console
117-
$ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz
117+
$ curl -O https://static.rust-lang.org/dist/rust-nightly.tar.gz
118118
$ tar -xzf rust-nightly.tar.gz
119119
$ cd rust-nightly
120120
$ ./configure
@@ -131,8 +131,8 @@ When complete, `make install` will place several programs into
131131
`/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
132132
API-documentation tool.
133133

134-
[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz
135-
[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe
134+
[tarball]: https://static.rust-lang.org/dist/rust-nightly.tar.gz
135+
[win-exe]: https://static.rust-lang.org/dist/rust-nightly-install.exe
136136

137137
## Compiling your first program
138138

branches/dist-snap/src/etc/snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def scrub(b):
2828
raise Exception("missing env var CFG_SRC_DIR")
2929

3030
snapshotfile = os.path.join(src_dir, "src", "snapshots.txt")
31-
download_url_base = "http://static.rust-lang.org/stage0-snapshots"
31+
download_url_base = "https://static.rust-lang.org/stage0-snapshots"
3232
download_dir_base = "dl"
3333
download_unpack_base = os.path.join(download_dir_base, "unpack")
3434

branches/dist-snap/src/etc/unicode.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,12 @@ def emit_bsearch_range_table(f):
293293
f.write("""
294294
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
295295
use core::cmp::{Equal, Less, Greater};
296-
use core::slice::ImmutableVector;
297-
use core::option::None;
298-
r.bsearch(|&(lo,hi)| {
296+
use core::slice::ImmutableSlice;
297+
r.binary_search(|&(lo,hi)| {
299298
if lo <= c && c <= hi { Equal }
300299
else if hi < c { Less }
301300
else { Greater }
302-
}) != None
301+
}).found().is_some()
303302
}\n
304303
""")
305304

@@ -352,9 +351,10 @@ def emit_conversions_module(f, lowerupper, upperlower):
352351
f.write("pub mod conversions {")
353352
f.write("""
354353
use core::cmp::{Equal, Less, Greater};
355-
use core::slice::ImmutableVector;
354+
use core::slice::ImmutableSlice;
356355
use core::tuple::Tuple2;
357356
use core::option::{Option, Some, None};
357+
use core::slice;
358358
359359
pub fn to_lower(c: char) -> char {
360360
match bsearch_case_table(c, LuLl_table) {
@@ -371,11 +371,14 @@ def emit_conversions_module(f, lowerupper, upperlower):
371371
}
372372
373373
fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<uint> {
374-
table.bsearch(|&(key, _)| {
374+
match table.binary_search(|&(key, _)| {
375375
if c == key { Equal }
376376
else if key < c { Less }
377377
else { Greater }
378-
})
378+
}) {
379+
slice::Found(i) => Some(i),
380+
slice::NotFound(_) => None,
381+
}
379382
}
380383
381384
""")
@@ -387,8 +390,8 @@ def emit_conversions_module(f, lowerupper, upperlower):
387390

388391
def emit_grapheme_module(f, grapheme_table, grapheme_cats):
389392
f.write("""pub mod grapheme {
390-
use core::option::{Some, None};
391-
use core::slice::ImmutableVector;
393+
use core::slice::ImmutableSlice;
394+
use core::slice;
392395
393396
#[allow(non_camel_case_types)]
394397
#[deriving(Clone)]
@@ -400,16 +403,16 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
400403
401404
fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
402405
use core::cmp::{Equal, Less, Greater};
403-
match r.bsearch(|&(lo, hi, _)| {
406+
match r.binary_search(|&(lo, hi, _)| {
404407
if lo <= c && c <= hi { Equal }
405408
else if hi < c { Less }
406409
else { Greater }
407410
}) {
408-
Some(idx) => {
411+
slice::Found(idx) => {
409412
let (_, _, cat) = r[idx];
410413
cat
411414
}
412-
None => GC_Any
415+
slice::NotFound(_) => GC_Any
413416
}
414417
}
415418
@@ -427,20 +430,21 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
427430
def emit_charwidth_module(f, width_table):
428431
f.write("pub mod charwidth {\n")
429432
f.write(" use core::option::{Option, Some, None};\n")
430-
f.write(" use core::slice::ImmutableVector;\n")
433+
f.write(" use core::slice::ImmutableSlice;\n")
434+
f.write(" use core::slice;\n")
431435
f.write("""
432436
fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 {
433437
use core::cmp::{Equal, Less, Greater};
434-
match r.bsearch(|&(lo, hi, _, _)| {
438+
match r.binary_search(|&(lo, hi, _, _)| {
435439
if lo <= c && c <= hi { Equal }
436440
else if hi < c { Less }
437441
else { Greater }
438442
}) {
439-
Some(idx) => {
443+
slice::Found(idx) => {
440444
let (_, _, r_ncjk, r_cjk) = r[idx];
441445
if is_cjk { r_cjk } else { r_ncjk }
442446
}
443-
None => 1
447+
slice::NotFound(_) => 1
444448
}
445449
}
446450
""")
@@ -525,19 +529,19 @@ def comp_pfun(char):
525529

526530
f.write("""
527531
fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
528-
use core::option::{Some, None};
529532
use core::cmp::{Equal, Less, Greater};
530-
use core::slice::ImmutableVector;
531-
match r.bsearch(|&(lo, hi, _)| {
533+
use core::slice::ImmutableSlice;
534+
use core::slice;
535+
match r.binary_search(|&(lo, hi, _)| {
532536
if lo <= c && c <= hi { Equal }
533537
else if hi < c { Less }
534538
else { Greater }
535539
}) {
536-
Some(idx) => {
540+
slice::Found(idx) => {
537541
let (_, _, result) = r[idx];
538542
result
539543
}
540-
None => 0
544+
slice::NotFound(_) => 0
541545
}
542546
}\n
543547
""")

0 commit comments

Comments
 (0)