Skip to content

Commit 5fbde74

Browse files
committed
---
yaml --- r: 129259 b: refs/heads/master c: f4fb3ad h: refs/heads/master i: 129257: e8ba529 129255: a97b4f7 v: v3
1 parent fc1fca7 commit 5fbde74

File tree

302 files changed

+2947
-5840
lines changed

Some content is hidden

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

302 files changed

+2947
-5840
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: 7932b719ec2b65acfa8c3e74aad29346d47ee992
2+
refs/heads/master: f4fb3ad9aa2ad94b0c132b523e7016c2d6cd73ac
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
55
refs/heads/try: 8af051e3f9a2f2b4bf3233bb26abae2a533e736e

trunk/src/doc/guide.md

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,6 @@ Let's try compiling what Cargo gave us:
18011801
```{bash}
18021802
$ cargo build
18031803
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
1804-
$
18051804
```
18061805

18071806
Excellent! Open up your `src/main.rs` again. We'll be writing all of
@@ -1817,7 +1816,6 @@ $ cargo run
18171816
Compiling guessing_game v0.1.0 (file:/home/you/projects/guessing_game)
18181817
Running `target/guessing_game`
18191818
Hello, world!
1820-
$
18211819
```
18221820

18231821
Great! The `run` command comes in handy when you need to rapidly iterate on a project.
@@ -1962,7 +1960,6 @@ fn main() {
19621960
```{notrust,ignore}
19631961
$ cargo build
19641962
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
1965-
$
19661963
```
19671964

19681965
Excellent! Try running our new program a few times:
@@ -2021,7 +2018,7 @@ And trying it out:
20212018
```{notrust,ignore}
20222019
$ cargo build
20232020
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2024-
$ ./target/guessing_game
2021+
$ ./target/guessing_game
20252022
Guess the number!
20262023
The secret number is: 57
20272024
Please input your guess.
@@ -2292,13 +2289,12 @@ print an error message and return. Let's give this a shot:
22922289
```{notrust,ignore}
22932290
$ cargo build
22942291
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2295-
$ ./target/guessing_game
2292+
$ ./target/guessing_game
22962293
Guess the number!
22972294
The secret number is: 17
22982295
Please input your guess.
22992296
5
23002297
Please input a number!
2301-
$
23022298
```
23032299

23042300
Uh, what? But we did!
@@ -2358,14 +2354,13 @@ Let's try it!
23582354
```{notrust,ignore}
23592355
$ cargo build
23602356
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2361-
$ ./target/guessing_game
2357+
$ ./target/guessing_game
23622358
Guess the number!
23632359
The secret number is: 58
23642360
Please input your guess.
2365-
76
2361+
76
23662362
You guessed: 76
23672363
Too big!
2368-
$
23692364
```
23702365

23712366
Nice! You can see I even added spaces before my guess, and it still figured
@@ -2436,7 +2431,7 @@ that `return`? If we give a non-number answer, we'll `return` and quit. Observe:
24362431
```{notrust,ignore}
24372432
$ cargo build
24382433
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2439-
$ ./target/guessing_game
2434+
$ ./target/guessing_game
24402435
Guess the number!
24412436
The secret number is: 59
24422437
Please input your guess.
@@ -2454,7 +2449,6 @@ You win!
24542449
Please input your guess.
24552450
quit
24562451
Please input a number!
2457-
$
24582452
```
24592453

24602454
Ha! `quit` actually quits. As does any other non-number input. Well, this is
@@ -2569,7 +2563,7 @@ Now we should be good! Let's try:
25692563
```{rust,ignore}
25702564
$ cargo build
25712565
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2572-
$ ./target/guessing_game
2566+
$ ./target/guessing_game
25732567
Guess the number!
25742568
The secret number is: 61
25752569
Please input your guess.
@@ -2771,7 +2765,6 @@ $ cargo run
27712765
Compiling modules v0.0.1 (file:///home/you/projects/modules)
27722766
Running `target/modules`
27732767
Hello, world!
2774-
$
27752768
```
27762769

27772770
Nice!
@@ -2923,7 +2916,6 @@ This should all compile as usual:
29232916
```{notrust,ignore}
29242917
$ cargo build
29252918
Compiling modules v0.0.1 (file:///home/you/projects/modules)
2926-
$
29272919
```
29282920

29292921
We've seen how the `::` operator can be used to call into modules, but when
@@ -3097,7 +3089,6 @@ $ cargo run
30973089
Compiling testing v0.0.1 (file:///home/you/projects/testing)
30983090
Running `target/testing`
30993091
Hello, world!
3100-
$
31013092
```
31023093

31033094
Great. Rust's infrastructure supports tests in two sorts of places, and they're
@@ -3250,7 +3241,6 @@ running 1 test
32503241
test foo ... ok
32513242
32523243
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
3253-
$
32543244
```
32553245

32563246
Nice! Our test passes, as we expected. Let's get rid of that warning for our `main`
@@ -3718,18 +3708,18 @@ That's a lot to take in. It's also one of the _most_ important concepts in
37183708
all of Rust. Let's see this syntax in action:
37193709

37203710
```{rust}
3721-
{
3711+
{
37223712
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37233713
37243714
// other code here...
3725-
3715+
37263716
} // privilege 1: when x goes out of scope, this memory is deallocated
37273717
37283718
/// this function borrows an integer. It's given back automatically when the
37293719
/// function returns.
3730-
fn foo(x: &int) -> &int { x }
3720+
fn foo(x: &int) -> &int { x }
37313721
3732-
{
3722+
{
37333723
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37343724
37353725
// privilege 2: you may lend that resource, to as many borrowers as you'd like
@@ -3739,14 +3729,14 @@ fn foo(x: &int) -> &int { x }
37393729
foo(&x); // functions can borrow too!
37403730
37413731
let a = &x; // we can do this alllllll day!
3742-
}
3732+
}
37433733
3744-
{
3734+
{
37453735
let mut x = 5i; // x is the owner of this integer, which is memory on the stack.
37463736
37473737
let y = &mut x; // privilege 3: you may lend that resource to a single borrower,
37483738
// mutably
3749-
}
3739+
}
37503740
```
37513741

37523742
If you are a borrower, you get a few privileges as well, but must also obey a
@@ -4535,7 +4525,7 @@ let one_to_one_hundred = range(0i, 100i).collect();
45354525
```
45364526

45374527
As you can see, we call `collect()` on our iterator. `collect()` takes
4538-
as many values as the iterator will give it, and returns a collection
4528+
as many values as the iterator will give it, and returns a collection
45394529
of the results. So why won't this compile? Rust can't determine what
45404530
type of things you want to collect, and so you need to let it know.
45414531
Here's the version that does compile:
@@ -5508,7 +5498,7 @@ fn main() {
55085498
}
55095499
```
55105500

5511-
Whew! This isn't too terrible. You can see that we still `let x = 5i`,
5501+
Whew! This isn't too terrible. You can see that we still `let x = 5i`,
55125502
but then things get a little bit hairy. Three more bindings get set: a
55135503
static format string, an argument vector, and the aruments. We then
55145504
invoke the `println_args` function with the generated arguments.
@@ -5531,9 +5521,9 @@ There are two circumstances where Rust's safety provisions don't work well.
55315521
The first is when interfacing with C code, and the second is when building
55325522
certain kinds of abstractions.
55335523

5534-
Rust has support for FFI (which you can read about in the [FFI
5535-
Guide](guide-ffi.html)), but can't guarantee that the C code will be safe.
5536-
Therefore, Rust marks such functions with the `unsafe`
5524+
Rust has support for FFI, (which you can read about in the [FFI
5525+
Guide](guide-ffi.html)) but Rust can't guarantee that the C code will be safe,
5526+
like Rust's will. Therefore, Rust marks such functions with the `unsafe`
55375527
keyword, which indicates that the function may not behave properly.
55385528

55395529
Second, if you'd like to create some sort of shared-memory data structure, Rust

trunk/src/liballoc/heap.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
1313
// and `nonnull`
1414

15-
use core::ptr::RawPtr;
1615
#[cfg(not(test))] use core::raw;
1716
#[cfg(not(test))] use util;
1817

@@ -70,11 +69,6 @@ pub unsafe fn reallocate_inplace(ptr: *mut u8, size: uint, align: uint,
7069
/// the value returned by `usable_size` for the requested size.
7170
#[inline]
7271
pub unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) {
73-
// FIXME(14395) This is only required for DST ~[T], it should be removed once
74-
// we fix that representation to not use null pointers.
75-
if ptr.is_null() {
76-
return;
77-
}
7872
imp::deallocate(ptr, size, align)
7973
}
8074

trunk/src/libcollections/bitv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2557,7 +2557,7 @@ mod tests {
25572557
}
25582558

25592559
fn rng() -> rand::IsaacRng {
2560-
let seed: &[_] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
2560+
let seed = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
25612561
rand::SeedableRng::from_seed(seed)
25622562
}
25632563

trunk/src/libcollections/dlist.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,8 +1088,7 @@ mod tests {
10881088
let n = list_from([1i,2,3]);
10891089
spawn(proc() {
10901090
check_links(&n);
1091-
let a: &[_] = &[&1,&2,&3];
1092-
assert_eq!(a, n.iter().collect::<Vec<&int>>().as_slice());
1091+
assert_eq!(&[&1,&2,&3], n.iter().collect::<Vec<&int>>().as_slice());
10931092
});
10941093
}
10951094

trunk/src/libcollections/hash/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,7 @@ mod tests {
346346
assert_eq!(hasher.hash(&'a'), 97);
347347

348348
assert_eq!(hasher.hash(&("a")), 97 + 0xFF);
349-
let cs: &[u8] = &[1u8, 2u8, 3u8];
350-
assert_eq!(hasher.hash(& cs), 9);
349+
assert_eq!(hasher.hash(& &[1u8, 2u8, 3u8]), 9);
351350

352351
unsafe {
353352
let ptr: *const int = mem::transmute(5i);

trunk/src/libcollections/hash/sip.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@ mod tests {
495495
assert!(s != t && t != u);
496496
assert!(hash(&s) != hash(&t) && hash(&s) != hash(&u));
497497

498-
let v: (&[u8], &[u8], &[u8]) = (&[1u8], &[0u8, 0], &[0u8]);
499-
let w: (&[u8], &[u8], &[u8]) = (&[1u8, 0, 0, 0], &[], &[]);
498+
let v = (&[1u8], &[0u8, 0], &[0u8]);
499+
let w = (&[1u8, 0, 0, 0], &[], &[]);
500500

501501
assert!(v != w);
502502
assert!(hash(&v) != hash(&w));

trunk/src/libcollections/ringbuf.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,7 @@ impl<T> RingBuf<T> {
243243
/// buf.push(5i);
244244
/// buf.push(3);
245245
/// buf.push(4);
246-
/// let b: &[_] = &[&5, &3, &4];
247-
/// assert_eq!(buf.iter().collect::<Vec<&int>>().as_slice(), b);
246+
/// assert_eq!(buf.iter().collect::<Vec<&int>>().as_slice(), &[&5, &3, &4]);
248247
/// ```
249248
pub fn iter<'a>(&'a self) -> Items<'a, T> {
250249
Items{index: 0, rindex: self.nelts, lo: self.lo, elts: self.elts.as_slice()}
@@ -264,8 +263,7 @@ impl<T> RingBuf<T> {
264263
/// for num in buf.mut_iter() {
265264
/// *num = *num - 2;
266265
/// }
267-
/// let b: &[_] = &[&mut 3, &mut 1, &mut 2];
268-
/// assert_eq!(buf.mut_iter().collect::<Vec<&mut int>>().as_slice(), b);
266+
/// assert_eq!(buf.mut_iter().collect::<Vec<&mut int>>().as_slice(), &[&mut 3, &mut 1, &mut 2]);
269267
/// ```
270268
pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
271269
let start_index = raw_index(self.lo, self.elts.len(), 0);
@@ -867,18 +865,12 @@ mod tests {
867865
for i in range(0i, 5) {
868866
d.push_back(i);
869867
}
870-
{
871-
let b: &[_] = &[&0,&1,&2,&3,&4];
872-
assert_eq!(d.iter().collect::<Vec<&int>>().as_slice(), b);
873-
}
868+
assert_eq!(d.iter().collect::<Vec<&int>>().as_slice(), &[&0,&1,&2,&3,&4]);
874869

875870
for i in range(6i, 9) {
876871
d.push_front(i);
877872
}
878-
{
879-
let b: &[_] = &[&8,&7,&6,&0,&1,&2,&3,&4];
880-
assert_eq!(d.iter().collect::<Vec<&int>>().as_slice(), b);
881-
}
873+
assert_eq!(d.iter().collect::<Vec<&int>>().as_slice(), &[&8,&7,&6,&0,&1,&2,&3,&4]);
882874

883875
let mut it = d.iter();
884876
let mut len = d.len();
@@ -898,16 +890,12 @@ mod tests {
898890
for i in range(0i, 5) {
899891
d.push_back(i);
900892
}
901-
{
902-
let b: &[_] = &[&4,&3,&2,&1,&0];
903-
assert_eq!(d.iter().rev().collect::<Vec<&int>>().as_slice(), b);
904-
}
893+
assert_eq!(d.iter().rev().collect::<Vec<&int>>().as_slice(), &[&4,&3,&2,&1,&0]);
905894

906895
for i in range(6i, 9) {
907896
d.push_front(i);
908897
}
909-
let b: &[_] = &[&4,&3,&2,&1,&0,&6,&7,&8];
910-
assert_eq!(d.iter().rev().collect::<Vec<&int>>().as_slice(), b);
898+
assert_eq!(d.iter().rev().collect::<Vec<&int>>().as_slice(), &[&4,&3,&2,&1,&0,&6,&7,&8]);
911899
}
912900

913901
#[test]

0 commit comments

Comments
 (0)