Skip to content

Commit 99facbb

Browse files
committed
---
yaml --- r: 129901 b: refs/heads/try c: 3ee047a h: refs/heads/master i: 129899: 79cce0f v: v3
1 parent 80e4dc5 commit 99facbb

File tree

243 files changed

+4464
-2666
lines changed

Some content is hidden

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

243 files changed

+4464
-2666
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: 0bdac78da87605f6f7f6e7924872617226b19c85
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 602592675ce86aeca465c4ac748cee2bff291443
5-
refs/heads/try: ef13555ad1df9d296d0316b511c92ddb47af6743
5+
refs/heads/try: 3ee047ae1ffab454270bc1859b3beef3556ef8f9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/doc/guide.md

Lines changed: 22 additions & 38 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
@@ -1814,10 +1813,9 @@ Try it out:
18141813

18151814
```{notrust,ignore}
18161815
$ cargo run
1817-
Compiling guessing_game v0.1.0 (file:/home/you/projects/guessing_game)
1816+
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.
@@ -1957,18 +1955,12 @@ fn main() {
19571955
}
19581956
```
19591957

1960-
... and then recompile:
1958+
Try running our new program a few times:
19611959

19621960
```{notrust,ignore}
1963-
$ cargo build
1964-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
1965-
$
1966-
```
1967-
1968-
Excellent! Try running our new program a few times:
1969-
1970-
```{notrust,ignore}
1971-
$ ./target/guessing_game
1961+
$ cargo run
1962+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
1963+
Running `target/guessing_game`
19721964
Guess the number!
19731965
The secret number is: 7
19741966
Please input your guess.
@@ -2019,9 +2011,9 @@ fn main() {
20192011
And trying it out:
20202012

20212013
```{notrust,ignore}
2022-
$ cargo build
2023-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2024-
$ ./target/guessing_game
2014+
$ cargo run
2015+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
2016+
Running `target/guessing_game`
20252017
Guess the number!
20262018
The secret number is: 57
20272019
Please input your guess.
@@ -2290,15 +2282,14 @@ We use a `match` to either give us the `uint` inside of the `Option`, or we
22902282
print an error message and return. Let's give this a shot:
22912283

22922284
```{notrust,ignore}
2293-
$ cargo build
2294-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2295-
$ ./target/guessing_game
2285+
$ cargo run
2286+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
2287+
Running `target/guessing_game`
22962288
Guess the number!
22972289
The secret number is: 17
22982290
Please input your guess.
22992291
5
23002292
Please input a number!
2301-
$
23022293
```
23032294

23042295
Uh, what? But we did!
@@ -2356,16 +2347,15 @@ fn cmp(a: uint, b: uint) -> Ordering {
23562347
Let's try it!
23572348

23582349
```{notrust,ignore}
2359-
$ cargo build
2360-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2361-
$ ./target/guessing_game
2350+
$ cargo run
2351+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
2352+
Running `target/guessing_game`
23622353
Guess the number!
23632354
The secret number is: 58
23642355
Please input your guess.
23652356
76
23662357
You guessed: 76
23672358
Too big!
2368-
$
23692359
```
23702360

23712361
Nice! You can see I even added spaces before my guess, and it still figured
@@ -2434,9 +2424,9 @@ And try it out. But wait, didn't we just add an infinite loop? Yup. Remember
24342424
that `return`? If we give a non-number answer, we'll `return` and quit. Observe:
24352425

24362426
```{notrust,ignore}
2437-
$ cargo build
2438-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2439-
$ ./target/guessing_game
2427+
$ cargo run
2428+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
2429+
Running `target/guessing_game`
24402430
Guess the number!
24412431
The secret number is: 59
24422432
Please input your guess.
@@ -2454,7 +2444,6 @@ You win!
24542444
Please input your guess.
24552445
quit
24562446
Please input a number!
2457-
$
24582447
```
24592448

24602449
Ha! `quit` actually quits. As does any other non-number input. Well, this is
@@ -2566,10 +2555,10 @@ fn cmp(a: uint, b: uint) -> Ordering {
25662555

25672556
Now we should be good! Let's try:
25682557

2569-
```{rust,ignore}
2570-
$ cargo build
2571-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2572-
$ ./target/guessing_game
2558+
```{notrust,ignore}
2559+
$ cargo run
2560+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
2561+
Running `target/guessing_game`
25732562
Guess the number!
25742563
The secret number is: 61
25752564
Please input your guess.
@@ -2771,7 +2760,6 @@ $ cargo run
27712760
Compiling modules v0.0.1 (file:///home/you/projects/modules)
27722761
Running `target/modules`
27732762
Hello, world!
2774-
$
27752763
```
27762764

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

28172804
This doesn't _quite_ work yet. Try it:
28182805

@@ -2923,7 +2910,6 @@ This should all compile as usual:
29232910
```{notrust,ignore}
29242911
$ cargo build
29252912
Compiling modules v0.0.1 (file:///home/you/projects/modules)
2926-
$
29272913
```
29282914

29292915
We've seen how the `::` operator can be used to call into modules, but when
@@ -3097,7 +3083,6 @@ $ cargo run
30973083
Compiling testing v0.0.1 (file:///home/you/projects/testing)
30983084
Running `target/testing`
30993085
Hello, world!
3100-
$
31013086
```
31023087

31033088
Great. Rust's infrastructure supports tests in two sorts of places, and they're
@@ -3250,7 +3235,6 @@ running 1 test
32503235
test foo ... ok
32513236
32523237
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
3253-
$
32543238
```
32553239

32563240
Nice! Our test passes, as we expected. Let's get rid of that warning for our `main`

branches/try/src/doc/rust.md

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

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

899898
An _`extern crate` declaration_ specifies a dependency on an external crate.
@@ -913,11 +912,9 @@ Four examples of `extern crate` declarations:
913912
~~~~ {.ignore}
914913
extern crate pcre;
915914
916-
extern crate std; // equivalent to: extern crate std = "std";
915+
extern crate std; // equivalent to: extern crate std as std;
917916
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
917+
extern crate "std" as ruststd; // linking to 'std' under another name
921918
~~~~
922919

923920
##### Use declarations

branches/try/src/liballoc/heap.rs

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

15+
use core::ptr::RawPtr;
1516
#[cfg(not(test))] use core::raw;
1617
#[cfg(not(test))] use util;
1718

@@ -69,6 +70,11 @@ pub unsafe fn reallocate_inplace(ptr: *mut u8, size: uint, align: uint,
6970
/// the value returned by `usable_size` for the requested size.
7071
#[inline]
7172
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+
}
7278
imp::deallocate(ptr, size, align)
7379
}
7480

branches/try/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/try/src/libcollections/dlist.rs

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

branches/try/src/libcollections/hash/mod.rs

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

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

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

branches/try/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 = (&[1u8], &[0u8, 0], &[0u8]);
499-
let w = (&[1u8, 0, 0, 0], &[], &[]);
498+
let v: (&[u8], &[u8], &[u8]) = (&[1u8], &[0u8, 0], &[0u8]);
499+
let w: (&[u8], &[u8], &[u8]) = (&[1u8, 0, 0, 0], &[], &[]);
500500

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

branches/try/src/libcollections/ringbuf.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ impl<T> RingBuf<T> {
243243
/// buf.push(5i);
244244
/// buf.push(3);
245245
/// buf.push(4);
246-
/// assert_eq!(buf.iter().collect::<Vec<&int>>().as_slice(), &[&5, &3, &4]);
246+
/// let b: &[_] = &[&5, &3, &4];
247+
/// assert_eq!(buf.iter().collect::<Vec<&int>>().as_slice(), b);
247248
/// ```
248249
pub fn iter<'a>(&'a self) -> Items<'a, T> {
249250
Items{index: 0, rindex: self.nelts, lo: self.lo, elts: self.elts.as_slice()}
@@ -263,7 +264,8 @@ impl<T> RingBuf<T> {
263264
/// for num in buf.mut_iter() {
264265
/// *num = *num - 2;
265266
/// }
266-
/// assert_eq!(buf.mut_iter().collect::<Vec<&mut int>>().as_slice(), &[&mut 3, &mut 1, &mut 2]);
267+
/// let b: &[_] = &[&mut 3, &mut 1, &mut 2];
268+
/// assert_eq!(buf.mut_iter().collect::<Vec<&mut int>>().as_slice(), b);
267269
/// ```
268270
pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
269271
let start_index = raw_index(self.lo, self.elts.len(), 0);
@@ -865,12 +867,18 @@ mod tests {
865867
for i in range(0i, 5) {
866868
d.push_back(i);
867869
}
868-
assert_eq!(d.iter().collect::<Vec<&int>>().as_slice(), &[&0,&1,&2,&3,&4]);
870+
{
871+
let b: &[_] = &[&0,&1,&2,&3,&4];
872+
assert_eq!(d.iter().collect::<Vec<&int>>().as_slice(), b);
873+
}
869874

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

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

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

901913
#[test]

0 commit comments

Comments
 (0)