Skip to content

Commit 49f2546

Browse files
committed
---
yaml --- r: 128732 b: refs/heads/try c: 04233a1 h: refs/heads/master v: v3
1 parent 0bad11c commit 49f2546

File tree

22 files changed

+71
-394
lines changed

22 files changed

+71
-394
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: e8204a84c7f365533c217b4882bbe0cbce5a34e3
5+
refs/heads/try: 04233a1675272d4a21440943f1441b586cdf0afd
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

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/src/doc/guide.md

Lines changed: 9 additions & 74 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 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
@@ -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

branches/try/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 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

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(|| {

branches/try/src/libcollections/slice.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -301,28 +301,6 @@ pub trait ImmutableCloneableVector<T> {
301301

302302
/// Create an iterator that yields every possible permutation of the
303303
/// vector in succession.
304-
///
305-
/// # Example
306-
///
307-
/// ```rust
308-
/// let v = [1i, 2, 3];
309-
/// let mut perms = v.permutations();
310-
///
311-
/// for p in perms {
312-
/// println!("{}", p);
313-
/// }
314-
/// ```
315-
///
316-
/// # Example 2: iterating through permutations one by one.
317-
///
318-
/// ```rust
319-
/// let v = [1i, 2, 3];
320-
/// let mut perms = v.permutations();
321-
///
322-
/// assert_eq!(Some(vec![1i, 2, 3]), perms.next());
323-
/// assert_eq!(Some(vec![1i, 3, 2]), perms.next());
324-
/// assert_eq!(Some(vec![3i, 1, 2]), perms.next());
325-
/// ```
326304
fn permutations(self) -> Permutations<T>;
327305
}
328306

@@ -343,7 +321,6 @@ impl<'a,T:Clone> ImmutableCloneableVector<T> for &'a [T] {
343321
(lefts, rights)
344322
}
345323

346-
/// Returns an iterator over all permutations of a vector.
347324
fn permutations(self) -> Permutations<T> {
348325
Permutations{
349326
swaps: ElementSwaps::new(self.len()),
@@ -590,16 +567,6 @@ pub trait MutableVectorAllocating<'a, T> {
590567
* * src - A mutable vector of `T`
591568
* * start - The index into `src` to start copying from
592569
* * end - The index into `src` to stop copying from
593-
*
594-
* # Example
595-
*
596-
* ```rust
597-
* let mut a = [1i, 2, 3, 4, 5];
598-
* let b = vec![6i, 7, 8];
599-
* let num_moved = a.move_from(b, 0, 3);
600-
* assert_eq!(num_moved, 3);
601-
* assert!(a == [6i, 7, 8, 4, 5]);
602-
* ```
603570
*/
604571
fn move_from(self, src: Vec<T>, start: uint, end: uint) -> uint;
605572
}

0 commit comments

Comments
 (0)