Skip to content

Commit e24a7ec

Browse files
committed
---
yaml --- r: 129275 b: refs/heads/auto c: 3ae1059 h: refs/heads/master i: 129273: 3dc9688 129271: acd63ab v: v3
1 parent c712f2b commit e24a7ec

File tree

302 files changed

+5830
-2947
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

+5830
-2947
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: f4fb3ad9aa2ad94b0c132b523e7016c2d6cd73ac
16+
refs/heads/auto: 3ae10596320666ff7ff0bd39a5920184d9b22c95
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: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,7 @@ And trying it out:
20182018
```{notrust,ignore}
20192019
$ cargo build
20202020
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2021-
$ ./target/guessing_game
2021+
$ ./target/guessing_game
20222022
Guess the number!
20232023
The secret number is: 57
20242024
Please input your guess.
@@ -2289,7 +2289,7 @@ print an error message and return. Let's give this a shot:
22892289
```{notrust,ignore}
22902290
$ cargo build
22912291
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2292-
$ ./target/guessing_game
2292+
$ ./target/guessing_game
22932293
Guess the number!
22942294
The secret number is: 17
22952295
Please input your guess.
@@ -2354,11 +2354,11 @@ Let's try it!
23542354
```{notrust,ignore}
23552355
$ cargo build
23562356
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2357-
$ ./target/guessing_game
2357+
$ ./target/guessing_game
23582358
Guess the number!
23592359
The secret number is: 58
23602360
Please input your guess.
2361-
76
2361+
76
23622362
You guessed: 76
23632363
Too big!
23642364
```
@@ -2431,7 +2431,7 @@ that `return`? If we give a non-number answer, we'll `return` and quit. Observe:
24312431
```{notrust,ignore}
24322432
$ cargo build
24332433
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2434-
$ ./target/guessing_game
2434+
$ ./target/guessing_game
24352435
Guess the number!
24362436
The secret number is: 59
24372437
Please input your guess.
@@ -2563,7 +2563,7 @@ Now we should be good! Let's try:
25632563
```{rust,ignore}
25642564
$ cargo build
25652565
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2566-
$ ./target/guessing_game
2566+
$ ./target/guessing_game
25672567
Guess the number!
25682568
The secret number is: 61
25692569
Please input your guess.
@@ -3708,18 +3708,18 @@ That's a lot to take in. It's also one of the _most_ important concepts in
37083708
all of Rust. Let's see this syntax in action:
37093709

37103710
```{rust}
3711-
{
3711+
{
37123712
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37133713
37143714
// other code here...
3715-
3715+
37163716
} // privilege 1: when x goes out of scope, this memory is deallocated
37173717
37183718
/// this function borrows an integer. It's given back automatically when the
37193719
/// function returns.
3720-
fn foo(x: &int) -> &int { x }
3720+
fn foo(x: &int) -> &int { x }
37213721
3722-
{
3722+
{
37233723
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37243724
37253725
// privilege 2: you may lend that resource, to as many borrowers as you'd like
@@ -3729,14 +3729,14 @@ fn foo(x: &int) -> &int { x }
37293729
foo(&x); // functions can borrow too!
37303730
37313731
let a = &x; // we can do this alllllll day!
3732-
}
3732+
}
37333733
3734-
{
3734+
{
37353735
let mut x = 5i; // x is the owner of this integer, which is memory on the stack.
37363736
37373737
let y = &mut x; // privilege 3: you may lend that resource to a single borrower,
37383738
// mutably
3739-
}
3739+
}
37403740
```
37413741

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

45274527
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
4528+
as many values as the iterator will give it, and returns a collection
45294529
of the results. So why won't this compile? Rust can't determine what
45304530
type of things you want to collect, and so you need to let it know.
45314531
Here's the version that does compile:
@@ -5498,7 +5498,7 @@ fn main() {
54985498
}
54995499
```
55005500

5501-
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`,
55025502
but then things get a little bit hairy. Three more bindings get set: a
55035503
static format string, an argument vector, and the aruments. We then
55045504
invoke the `println_args` function with the generated arguments.
@@ -5521,9 +5521,9 @@ There are two circumstances where Rust's safety provisions don't work well.
55215521
The first is when interfacing with C code, and the second is when building
55225522
certain kinds of abstractions.
55235523

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`
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`
55275527
keyword, which indicates that the function may not behave properly.
55285528

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

branches/auto/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/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: 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/auto/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/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 = (&[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/auto/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)