Skip to content

Commit a2b512e

Browse files
committed
---
yaml --- r: 129595 b: refs/heads/auto c: 4aff964 h: refs/heads/master i: 129593: 45d07c3 129591: ced7b7c v: v3
1 parent 113d26d commit a2b512e

File tree

373 files changed

+3262
-5942
lines changed

Some content is hidden

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

373 files changed

+3262
-5942
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 5550edef46ba7893b90d210913e3b37ffd77cae4
16+
refs/heads/auto: 4aff964463b90ae8a27d68ae7d85b6ba721d0779
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/guide.md

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,7 @@ 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+
$
18041805
```
18051806

18061807
Excellent! Open up your `src/main.rs` again. We'll be writing all of
@@ -1816,6 +1817,7 @@ $ cargo run
18161817
Compiling guessing_game v0.1.0 (file:/home/you/projects/guessing_game)
18171818
Running `target/guessing_game`
18181819
Hello, world!
1820+
$
18191821
```
18201822

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

19651968
Excellent! Try running our new program a few times:
@@ -2018,7 +2021,7 @@ And trying it out:
20182021
```{notrust,ignore}
20192022
$ cargo build
20202023
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2021-
$ ./target/guessing_game
2024+
$ ./target/guessing_game
20222025
Guess the number!
20232026
The secret number is: 57
20242027
Please input your guess.
@@ -2289,12 +2292,13 @@ print an error message and return. Let's give this a shot:
22892292
```{notrust,ignore}
22902293
$ cargo build
22912294
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2292-
$ ./target/guessing_game
2295+
$ ./target/guessing_game
22932296
Guess the number!
22942297
The secret number is: 17
22952298
Please input your guess.
22962299
5
22972300
Please input a number!
2301+
$
22982302
```
22992303

23002304
Uh, what? But we did!
@@ -2354,13 +2358,14 @@ Let's try it!
23542358
```{notrust,ignore}
23552359
$ cargo build
23562360
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2357-
$ ./target/guessing_game
2361+
$ ./target/guessing_game
23582362
Guess the number!
23592363
The secret number is: 58
23602364
Please input your guess.
2361-
76
2365+
76
23622366
You guessed: 76
23632367
Too big!
2368+
$
23642369
```
23652370

23662371
Nice! You can see I even added spaces before my guess, and it still figured
@@ -2431,7 +2436,7 @@ that `return`? If we give a non-number answer, we'll `return` and quit. Observe:
24312436
```{notrust,ignore}
24322437
$ cargo build
24332438
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2434-
$ ./target/guessing_game
2439+
$ ./target/guessing_game
24352440
Guess the number!
24362441
The secret number is: 59
24372442
Please input your guess.
@@ -2449,6 +2454,7 @@ You win!
24492454
Please input your guess.
24502455
quit
24512456
Please input a number!
2457+
$
24522458
```
24532459

24542460
Ha! `quit` actually quits. As does any other non-number input. Well, this is
@@ -2563,7 +2569,7 @@ Now we should be good! Let's try:
25632569
```{rust,ignore}
25642570
$ cargo build
25652571
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2566-
$ ./target/guessing_game
2572+
$ ./target/guessing_game
25672573
Guess the number!
25682574
The secret number is: 61
25692575
Please input your guess.
@@ -2765,6 +2771,7 @@ $ cargo run
27652771
Compiling modules v0.0.1 (file:///home/you/projects/modules)
27662772
Running `target/modules`
27672773
Hello, world!
2774+
$
27682775
```
27692776

27702777
Nice!
@@ -2804,8 +2811,7 @@ be named, by convention.
28042811
Next, we added an `extern crate modules` to the top of our `src/main.rs`. This,
28052812
as you can guess, lets Rust know that our crate relies on another, external
28062813
crate. We also had to modify our call to `print_hello`: now that it's in
2807-
another crate, we need to first specify the crate, then the module inside of it,
2808-
then the function name.
2814+
another crate, we need to specify that crate first.
28092815

28102816
This doesn't _quite_ work yet. Try it:
28112817

@@ -2916,6 +2922,7 @@ This should all compile as usual:
29162922
```{notrust,ignore}
29172923
$ cargo build
29182924
Compiling modules v0.0.1 (file:///home/you/projects/modules)
2925+
$
29192926
```
29202927

29212928
We've seen how the `::` operator can be used to call into modules, but when
@@ -3089,6 +3096,7 @@ $ cargo run
30893096
Compiling testing v0.0.1 (file:///home/you/projects/testing)
30903097
Running `target/testing`
30913098
Hello, world!
3099+
$
30923100
```
30933101

30943102
Great. Rust's infrastructure supports tests in two sorts of places, and they're
@@ -3241,6 +3249,7 @@ running 1 test
32413249
test foo ... ok
32423250
32433251
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
3252+
$
32443253
```
32453254

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

37103719
```{rust}
3711-
{
3720+
{
37123721
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37133722
37143723
// other code here...
3715-
3724+
37163725
} // privilege 1: when x goes out of scope, this memory is deallocated
37173726
37183727
/// this function borrows an integer. It's given back automatically when the
37193728
/// function returns.
3720-
fn foo(x: &int) -> &int { x }
3729+
fn foo(x: &int) -> &int { x }
37213730
3722-
{
3731+
{
37233732
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37243733
37253734
// privilege 2: you may lend that resource, to as many borrowers as you'd like
@@ -3729,14 +3738,14 @@ fn foo(x: &int) -> &int { x }
37293738
foo(&x); // functions can borrow too!
37303739
37313740
let a = &x; // we can do this alllllll day!
3732-
}
3741+
}
37333742
3734-
{
3743+
{
37353744
let mut x = 5i; // x is the owner of this integer, which is memory on the stack.
37363745
37373746
let y = &mut x; // privilege 3: you may lend that resource to a single borrower,
37383747
// mutably
3739-
}
3748+
}
37403749
```
37413750

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

45274536
As you can see, we call `collect()` on our iterator. `collect()` takes
4528-
as many values as the iterator will give it, and returns a collection
4537+
as many values as the iterator will give it, and returns a collection
45294538
of the results. So why won't this compile? Rust can't determine what
45304539
type of things you want to collect, and so you need to let it know.
45314540
Here's the version that does compile:
@@ -5498,7 +5507,7 @@ fn main() {
54985507
}
54995508
```
55005509

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

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

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

branches/auto/src/doc/rust.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,9 @@ There are several kinds of view item:
891891
##### Extern crate declarations
892892

893893
~~~~ {.ebnf .gram}
894-
extern_crate_decl : "extern" "crate" crate_name
895-
crate_name: ident | ( string_lit as ident )
894+
extern_crate_decl : "extern" "crate" ident [ '(' link_attrs ')' ] ? [ '=' string_lit ] ? ;
895+
link_attrs : link_attr [ ',' link_attrs ] + ;
896+
link_attr : ident '=' literal ;
896897
~~~~
897898

898899
An _`extern crate` declaration_ specifies a dependency on an external crate.
@@ -912,9 +913,11 @@ Four examples of `extern crate` declarations:
912913
~~~~ {.ignore}
913914
extern crate pcre;
914915
915-
extern crate std; // equivalent to: extern crate std as std;
916+
extern crate std; // equivalent to: extern crate std = "std";
916917
917-
extern crate "std" as ruststd; // linking to 'std' under another name
918+
extern crate ruststd = "std"; // linking to 'std' under another name
919+
920+
extern crate foo = "some/where/rust-foo#foo:1.0"; // a full crate ID for external tools
918921
~~~~
919922

920923
##### Use declarations

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

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

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

branches/auto/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);

branches/auto/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));

branches/auto/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)