Skip to content

Commit 1af4133

Browse files
committed
---
yaml --- r: 128734 b: refs/heads/try c: 06d44aa h: refs/heads/master v: v3
1 parent c47f4d2 commit 1af4133

Some content is hidden

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

76 files changed

+148
-868
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 07d86b46a949a94223da714e35b343243e4ecce4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5-
refs/heads/try: c1eaafe8ab2114dd10d87a4983e1263c844f782f
5+
refs/heads/try: 06d44aaad34a8599e398b5586cdf7d9ab449a7c9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ please do two things:
1616

1717
2. Run the full Rust test suite with the `make check` command. You're
1818
not off the hook even if you just stick to documentation; code
19-
examples in the docs are tested as well! Although for simple
20-
wording or grammar fixes, this is probably unnecessary.
19+
examples in the docs are tested as well!
2120

2221
Pull requests will be treated as "review requests", and we will give
2322
feedback we expect to see corrected on

branches/try/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 https://static.rust-lang.org/dist/rust-nightly.tar.gz
35+
$ curl -O http://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]: https://static.rust-lang.org/dist/rust-nightly.tar.gz
78+
[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz
7979
[tutorial]: http://doc.rust-lang.org/tutorial.html
8080

8181
## Notes

branches/try/mk/main.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,6 @@ endif
139139
RUSTFLAGS_STAGE0 += -C prefer-dynamic
140140
RUSTFLAGS_STAGE1 += -C prefer-dynamic
141141

142-
# Landing pads require a lot of codegen. We can get through bootstrapping faster
143-
# by not emitting them.
144-
RUSTFLAGS_STAGE0 += -Z no-landing-pads
145-
146142
# platform-specific auto-configuration
147143
include $(CFG_SRC_DIR)mk/platform.mk
148144

branches/try/src/doc/guide-pointers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ This part is coming soon.
655655
# Returning Pointers
656656

657657
In many languages with pointers, you'd return a pointer from a function
658-
so as to avoid copying a large data structure. For example:
658+
so as to avoid a copying a large data structure. For example:
659659

660660
```{rust}
661661
struct BigStruct {

branches/try/src/doc/guide.md

Lines changed: 15 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@ Sound good? Let's go!
2727
# Installing Rust
2828

2929
The first step to using Rust is to install it! There are a number of ways to
30-
install Rust, but the easiest is to use the `rustup` script. If you're on
30+
install Rust, but the easiest is to use the the `rustup` script. If you're on
3131
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 https://static.rust-lang.org/rustup.sh | sudo sh
35+
$ curl -s http://www.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](https://static.rust-lang.org/dist/rust-nightly-install.exe).
42+
it](http://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 https://static.rust-lang.org/rustup.sh | sudo sh -s -- --uninstall
49+
$ curl -s http://www.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
@@ -120,7 +120,7 @@ to make a projects directory in my home directory, and keep all my projects
120120
there. Rust does not care where your code lives.
121121

122122
This actually leads to one other concern we should address: this tutorial will
123-
assume that you have basic familiarity with the command line. Rust does not
123+
assume that you have basic familiarity with the command-line. Rust does not
124124
require that you know a whole ton about the command line, but until the
125125
language is in a more finished state, IDE support is spotty. Rust makes no
126126
specific demands on your editing tooling, or where your code lives.
@@ -452,7 +452,7 @@ what you need, so it's not verboten.
452452

453453
Let's get back to bindings. Rust variable bindings have one more aspect that
454454
differs from other languages: bindings are required to be initialized with a
455-
value before you're allowed to use them. If we try...
455+
value before you're allowed to use it. If we try...
456456

457457
```{ignore}
458458
let x;
@@ -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 **iterator**s, later in the Guide.
1344+
We'll talk more about `for` when we cover **vector**s, later in the Guide.
13451345

13461346
## `while`
13471347

@@ -1427,6 +1427,11 @@ 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+
14301435
# Strings
14311436

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

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-
15801515
# Standard Input
15811516

15821517
Getting input from the keyboard is pretty easy, but uses some things
@@ -2155,7 +2090,7 @@ In this case, I happen to prefer the latter, and in the `random()` case, I prefe
21552090
the former. I think the nested `<>`s make the first option especially ugly and
21562091
a bit harder to read.
21572092

2158-
Anyway, with us now converting our input to a number, our code looks like this:
2093+
Anyway, with us now convering our input to a number, our code looks like this:
21592094

21602095
```{rust,ignore}
21612096
use std::io;
@@ -2346,7 +2281,7 @@ change that by adding loops!
23462281

23472282
## Looping
23482283

2349-
As we already discussed, the `loop` keyword gives us an infinite loop. So
2284+
As we already discussed, the `loop` key word gives us an infinite loop. So
23502285
let's add that in:
23512286

23522287
```{rust,no_run}
@@ -4164,7 +4099,7 @@ fn inverse(x: f64) -> Result<f64, String> {
41644099
```
41654100

41664101
We don't want to take the inverse of zero, so we check to make sure that we
4167-
weren't passed zero. If we were, then we return an `Err`, with a message. If
4102+
weren't passed one. If we weren't, then we return an `Err`, with a message. If
41684103
it's okay, we return an `Ok`, with the answer.
41694104

41704105
Why does this matter? Well, remember how `match` does exhaustive matches?

branches/try/src/doc/tutorial.md

Lines changed: 3 additions & 13 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 https://static.rust-lang.org/dist/rust-nightly.tar.gz
117+
$ curl -O http://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]: https://static.rust-lang.org/dist/rust-nightly.tar.gz
135-
[win-exe]: https://static.rust-lang.org/dist/rust-nightly-install.exe
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
136136

137137
## Compiling your first program
138138

@@ -1133,16 +1133,6 @@ let xs = Cons(1, box Cons(2, box Cons(3, box Nil)));
11331133
let ys = xs; // copies `Cons(u32, pointer)` shallowly
11341134
~~~
11351135

1136-
> *Note:* Names like `xs` and `ys` are a naming
1137-
> convention for collection-like data structures
1138-
> (like our `List`). These collections are given
1139-
> names appended with 's' to signify plurality,
1140-
> i.e. that the data structure stores multiple
1141-
> elements. For example, `xs` in this case can
1142-
> be read as "a list of ex-es", where "x" here
1143-
> are elements of type `u32`.
1144-
1145-
11461136
Rust will consider a shallow copy of a type with a destructor like `List` to
11471137
*move ownership* of the value. After a value has been moved, the source
11481138
location cannot be used unless it is reinitialized.

branches/try/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 = "https://static.rust-lang.org/stage0-snapshots"
31+
download_url_base = "http://static.rust-lang.org/stage0-snapshots"
3232
download_dir_base = "dl"
3333
download_unpack_base = os.path.join(download_dir_base, "unpack")
3434

branches/try/src/libcollections/ringbuf.rs

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ impl<T> RingBuf<T> {
139139
/// # Example
140140
///
141141
/// ```rust
142-
/// #![allow(deprecated)]
143-
///
144142
/// use std::collections::RingBuf;
145143
///
146144
/// let mut buf = RingBuf::new();
@@ -149,7 +147,6 @@ impl<T> RingBuf<T> {
149147
/// buf.push(5);
150148
/// assert_eq!(buf.get(1), &4);
151149
/// ```
152-
#[deprecated = "prefer using indexing, e.g., ringbuf[0]"]
153150
pub fn get<'a>(&'a self, i: uint) -> &'a T {
154151
let idx = self.raw_index(i);
155152
match *self.elts.get(idx) {
@@ -172,7 +169,7 @@ impl<T> RingBuf<T> {
172169
/// buf.push(4);
173170
/// buf.push(5);
174171
/// *buf.get_mut(1) = 7;
175-
/// assert_eq!(buf[1], 7);
172+
/// assert_eq!(buf.get(1), &7);
176173
/// ```
177174
pub fn get_mut<'a>(&'a mut self, i: uint) -> &'a mut T {
178175
let idx = self.raw_index(i);
@@ -198,8 +195,8 @@ impl<T> RingBuf<T> {
198195
/// buf.push(4);
199196
/// buf.push(5);
200197
/// buf.swap(0, 2);
201-
/// assert_eq!(buf[0], 5);
202-
/// assert_eq!(buf[2], 3);
198+
/// assert_eq!(buf.get(0), &5);
199+
/// assert_eq!(buf.get(2), &3);
203200
/// ```
204201
pub fn swap(&mut self, i: uint, j: uint) {
205202
assert!(i < self.len());
@@ -479,21 +476,6 @@ impl<S: Writer, A: Hash<S>> Hash<S> for RingBuf<A> {
479476
}
480477
}
481478

482-
impl<A> Index<uint, A> for RingBuf<A> {
483-
#[inline]
484-
fn index<'a>(&'a self, i: &uint) -> &'a A {
485-
self.get(*i)
486-
}
487-
}
488-
489-
// FIXME(#12825) Indexing will always try IndexMut first and that causes issues.
490-
/*impl<A> IndexMut<uint, A> for RingBuf<A> {
491-
#[inline]
492-
fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut A {
493-
self.get_mut(*index)
494-
}
495-
}*/
496-
497479
impl<A> FromIterator<A> for RingBuf<A> {
498480
fn from_iter<T: Iterator<A>>(iterator: T) -> RingBuf<A> {
499481
let (lower, _) = iterator.size_hint();
@@ -671,25 +653,6 @@ mod tests {
671653
}
672654
}
673655

674-
#[test]
675-
fn test_index() {
676-
let mut deq = RingBuf::new();
677-
for i in range(1u, 4) {
678-
deq.push_front(i);
679-
}
680-
assert_eq!(deq[1], 2);
681-
}
682-
683-
#[test]
684-
#[should_fail]
685-
fn test_index_out_of_bounds() {
686-
let mut deq = RingBuf::new();
687-
for i in range(1u, 4) {
688-
deq.push_front(i);
689-
}
690-
deq[3];
691-
}
692-
693656
#[bench]
694657
fn bench_new(b: &mut test::Bencher) {
695658
b.iter(|| {

0 commit comments

Comments
 (0)