Skip to content

Commit 2eaeb4c

Browse files
committed
---
yaml --- r: 188158 b: refs/heads/try c: 718b591 h: refs/heads/master v: v3
1 parent 0e314bc commit 2eaeb4c

Some content is hidden

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

58 files changed

+1414
-526
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: 38e97b99a6b133cb4c621c68e75b28abc6c617c1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
5-
refs/heads/try: c04c9632f6239c223485e3c2c5a580f0d2f909e7
5+
refs/heads/try: 718b591f33ab23adb0beca8fffceeb9b89a603e2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/intro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,10 @@ numbers[1] is 3
510510
numbers[0] is 2
511511
```
512512
513-
Each time, we can get a slithtly different output because the threads
514-
are not quaranteed to run in any set order. If you get the same order
515-
every time it is because each of these threads are very small and
516-
complete too fast for their indeterminate behavior to surface.
513+
Each time, we can get a slightly different output because the threads are not
514+
guaranteed to run in any set order. If you get the same order every time it is
515+
because each of these threads are very small and complete too fast for their
516+
indeterminate behavior to surface.
517517
518518
The important part here is that the Rust compiler was able to use ownership to
519519
give us assurance _at compile time_ that we weren't doing something incorrect

branches/try/src/doc/trpl/guessing-game.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,11 @@ In this case, we say `x` is a `u32` explicitly, so Rust is able to properly
422422
tell `random()` what to generate. In a similar fashion, both of these work:
423423
424424
```{rust,ignore}
425-
let input_num = "5".parse::<u32>(); // input_num: Option<u32>
426-
let input_num: Result<u32, _> = "5".parse(); // input_num: Result<u32, <u32 as FromStr>::Err>
425+
let input_num_option = "5".parse::<u32>().ok(); // input_num: Option<u32>
426+
let input_num_result: Result<u32, _> = "5".parse(); // input_num: Result<u32, <u32 as FromStr>::Err>
427427
```
428428
429-
Here we're converting the `Result` returned by `parse` to an `Option` by using
429+
Above, we're converting the `Result` returned by `parse` to an `Option` by using
430430
the `ok` method as well. Anyway, with us now converting our input to a number,
431431
our code looks like this:
432432
@@ -470,14 +470,14 @@ Let's try it out!
470470
```bash
471471
$ cargo build
472472
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
473-
src/main.rs:22:15: 22:24 error: mismatched types: expected `u32` but found `core::option::Option<u32>` (expected u32 but found enum core::option::Option)
474-
src/main.rs:22 match cmp(input_num, secret_number) {
473+
src/main.rs:21:15: 21:24 error: mismatched types: expected `u32`, found `core::result::Result<u32, core::num::ParseIntError>` (expected u32, found enum `core::result::Result`) [E0308]
474+
src/main.rs:21 match cmp(input_num, secret_number) {
475475
^~~~~~~~~
476476
error: aborting due to previous error
477477
```
478478
479-
Oh yeah! Our `input_num` has the type `Option<u32>`, rather than `u32`. We
480-
need to unwrap the Option. If you remember from before, `match` is a great way
479+
Oh yeah! Our `input_num` has the type `Result<u32, <some error>>`, rather than `u32`. We
480+
need to unwrap the Result. If you remember from before, `match` is a great way
481481
to do that. Try this code:
482482
483483
```{rust,no_run}
@@ -500,7 +500,7 @@ fn main() {
500500
let input_num: Result<u32, _> = input.parse();
501501

502502
let num = match input_num {
503-
Ok(num) => num,
503+
Ok(n) => n,
504504
Err(_) => {
505505
println!("Please input a number!");
506506
return;
@@ -524,7 +524,7 @@ fn cmp(a: u32, b: u32) -> Ordering {
524524
}
525525
```
526526
527-
We use a `match` to either give us the `u32` inside of the `Option`, or else
527+
We use a `match` to either give us the `u32` inside of the `Result`, or else
528528
print an error message and return. Let's give this a shot:
529529
530530
```bash

branches/try/src/liballoc/arc.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,11 @@ impl<T> Arc<T> {
201201
impl<T> Arc<T> {
202202
#[inline]
203203
fn inner(&self) -> &ArcInner<T> {
204-
// This unsafety is ok because while this arc is alive we're guaranteed that the inner
205-
// pointer is valid. Furthermore, we know that the `ArcInner` structure itself is `Sync`
206-
// because the inner data is `Sync` as well, so we're ok loaning out an immutable pointer
207-
// to these contents.
204+
// This unsafety is ok because while this arc is alive we're guaranteed
205+
// that the inner pointer is valid. Furthermore, we know that the
206+
// `ArcInner` structure itself is `Sync` because the inner data is
207+
// `Sync` as well, so we're ok loaning out an immutable pointer to these
208+
// contents.
208209
unsafe { &**self._ptr }
209210
}
210211
}
@@ -236,13 +237,15 @@ impl<T> Clone for Arc<T> {
236237
/// ```
237238
#[inline]
238239
fn clone(&self) -> Arc<T> {
239-
// Using a relaxed ordering is alright here, as knowledge of the original reference
240-
// prevents other threads from erroneously deleting the object.
240+
// Using a relaxed ordering is alright here, as knowledge of the
241+
// original reference prevents other threads from erroneously deleting
242+
// the object.
241243
//
242-
// As explained in the [Boost documentation][1], Increasing the reference counter can
243-
// always be done with memory_order_relaxed: New references to an object can only be formed
244-
// from an existing reference, and passing an existing reference from one thread to another
245-
// must already provide any required synchronization.
244+
// As explained in the [Boost documentation][1], Increasing the
245+
// reference counter can always be done with memory_order_relaxed: New
246+
// references to an object can only be formed from an existing
247+
// reference, and passing an existing reference from one thread to
248+
// another must already provide any required synchronization.
246249
//
247250
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
248251
self.inner().strong.fetch_add(1, Relaxed);

branches/try/src/libcore/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
//! distribution.
4040
//!
4141
//! * `rust_begin_unwind` - This function takes three arguments, a
42-
//! `fmt::Arguments`, a `&str`, and a `uint`. These three arguments dictate
42+
//! `fmt::Arguments`, a `&str`, and a `usize`. These three arguments dictate
4343
//! the panic message, the file at which panic was invoked, and the line.
4444
//! It is up to consumers of this core library to define this panic
4545
//! function; it is only required to never return.
@@ -88,14 +88,12 @@ mod int_macros;
8888
#[macro_use]
8989
mod uint_macros;
9090

91-
#[path = "num/int.rs"] pub mod int;
9291
#[path = "num/isize.rs"] pub mod isize;
9392
#[path = "num/i8.rs"] pub mod i8;
9493
#[path = "num/i16.rs"] pub mod i16;
9594
#[path = "num/i32.rs"] pub mod i32;
9695
#[path = "num/i64.rs"] pub mod i64;
9796

98-
#[path = "num/uint.rs"] pub mod uint;
9997
#[path = "num/usize.rs"] pub mod usize;
10098
#[path = "num/u8.rs"] pub mod u8;
10199
#[path = "num/u16.rs"] pub mod u16;

branches/try/src/libcore/num/int.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

branches/try/src/libcore/num/uint.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

branches/try/src/libcoretest/iter.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use core::iter::*;
1212
use core::iter::order::*;
1313
use core::iter::MinMaxResult::*;
1414
use core::num::SignedInt;
15-
use core::uint;
15+
use core::usize;
1616
use core::cmp;
1717

1818
use test::Bencher;
@@ -292,7 +292,7 @@ fn test_unfoldr() {
292292
fn test_cycle() {
293293
let cycle_len = 3;
294294
let it = count(0, 1).take(cycle_len).cycle();
295-
assert_eq!(it.size_hint(), (uint::MAX, None));
295+
assert_eq!(it.size_hint(), (usize::MAX, None));
296296
for (i, x) in it.take(100).enumerate() {
297297
assert_eq!(i % cycle_len, x);
298298
}
@@ -365,19 +365,19 @@ fn test_iterator_size_hint() {
365365
let v2 = &[10, 11, 12];
366366
let vi = v.iter();
367367

368-
assert_eq!(c.size_hint(), (uint::MAX, None));
368+
assert_eq!(c.size_hint(), (usize::MAX, None));
369369
assert_eq!(vi.clone().size_hint(), (10, Some(10)));
370370

371371
assert_eq!(c.clone().take(5).size_hint(), (5, Some(5)));
372372
assert_eq!(c.clone().skip(5).size_hint().1, None);
373373
assert_eq!(c.clone().take_while(|_| false).size_hint(), (0, None));
374374
assert_eq!(c.clone().skip_while(|_| false).size_hint(), (0, None));
375-
assert_eq!(c.clone().enumerate().size_hint(), (uint::MAX, None));
376-
assert_eq!(c.clone().chain(vi.clone().cloned()).size_hint(), (uint::MAX, None));
375+
assert_eq!(c.clone().enumerate().size_hint(), (usize::MAX, None));
376+
assert_eq!(c.clone().chain(vi.clone().cloned()).size_hint(), (usize::MAX, None));
377377
assert_eq!(c.clone().zip(vi.clone()).size_hint(), (10, Some(10)));
378378
assert_eq!(c.clone().scan(0, |_,_| Some(0)).size_hint(), (0, None));
379379
assert_eq!(c.clone().filter(|_| false).size_hint(), (0, None));
380-
assert_eq!(c.clone().map(|_| 0).size_hint(), (uint::MAX, None));
380+
assert_eq!(c.clone().map(|_| 0).size_hint(), (usize::MAX, None));
381381
assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, None));
382382

383383
assert_eq!(vi.clone().take(5).size_hint(), (5, Some(5)));
@@ -753,7 +753,7 @@ fn test_range() {
753753

754754
assert_eq!((0..100).size_hint(), (100, Some(100)));
755755
// this test is only meaningful when sizeof uint < sizeof u64
756-
assert_eq!((uint::MAX - 1..uint::MAX).size_hint(), (1, Some(1)));
756+
assert_eq!((usize::MAX - 1..usize::MAX).size_hint(), (1, Some(1)));
757757
assert_eq!((-10..-1).size_hint(), (9, Some(9)));
758758
assert_eq!((-1..-10).size_hint(), (0, Some(0)));
759759
}

branches/try/src/libcoretest/num/int.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

branches/try/src/libcoretest/num/int_macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ macro_rules! int_module { ($T:ty, $T_i:ident) => (
1212
#[cfg(test)]
1313
mod tests {
1414
use core::$T_i::*;
15-
use core::int;
15+
use core::isize;
1616
use core::num::{FromStrRadix, Int, SignedInt};
1717
use core::ops::{Shl, Shr, Not, BitXor, BitAnd, BitOr};
1818
use num;
@@ -153,7 +153,7 @@ mod tests {
153153
fn test_signed_checked_div() {
154154
assert!(10.checked_div(2) == Some(5));
155155
assert!(5.checked_div(0) == None);
156-
assert!(int::MIN.checked_div(-1) == None);
156+
assert!(isize::MIN.checked_div(-1) == None);
157157
}
158158

159159
#[test]

branches/try/src/libcoretest/num/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ mod i8;
2121
mod i16;
2222
mod i32;
2323
mod i64;
24-
mod int;
2524

2625
#[macro_use]
2726
mod uint_macros;
@@ -30,7 +29,6 @@ mod u8;
3029
mod u16;
3130
mod u32;
3231
mod u64;
33-
mod uint;
3432

3533
/// Helper function for testing numeric operations
3634
pub fn test_num<T>(ten: T, two: T) where

branches/try/src/libcoretest/num/uint.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

branches/try/src/libgetopts/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ fn test_split_within() {
963963
"little lamb".to_string(),
964964
"Little lamb".to_string()
965965
]);
966-
t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::MAX,
966+
t("\nMary had a little lamb\nLittle lamb\n", ::std::usize::MAX,
967967
&["Mary had a little lamb\nLittle lamb".to_string()]);
968968
}
969969

branches/try/src/liblibc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,6 @@ pub mod types {
11151115
pub mod posix88 {
11161116
pub type off_t = i64;
11171117
pub type dev_t = u32;
1118-
pub type ino_t = u32;
11191118
pub type pid_t = i32;
11201119
pub type uid_t = u32;
11211120
pub type gid_t = u32;

branches/try/src/librand/rand_impls.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
1313
use core::prelude::*;
1414
use core::char;
15-
use core::int;
16-
use core::uint;
15+
use core::isize;
16+
use core::usize;
1717

1818
use {Rand,Rng};
1919

20-
impl Rand for int {
20+
impl Rand for isize {
2121
#[inline]
22-
fn rand<R: Rng>(rng: &mut R) -> int {
23-
if int::BITS == 32 {
24-
rng.gen::<i32>() as int
22+
fn rand<R: Rng>(rng: &mut R) -> isize {
23+
if isize::BITS == 32 {
24+
rng.gen::<i32>() as isize
2525
} else {
26-
rng.gen::<i64>() as int
26+
rng.gen::<i64>() as isize
2727
}
2828
}
2929
}
@@ -56,13 +56,13 @@ impl Rand for i64 {
5656
}
5757
}
5858

59-
impl Rand for uint {
59+
impl Rand for usize {
6060
#[inline]
61-
fn rand<R: Rng>(rng: &mut R) -> uint {
62-
if uint::BITS == 32 {
63-
rng.gen::<u32>() as uint
61+
fn rand<R: Rng>(rng: &mut R) -> usize {
62+
if usize::BITS == 32 {
63+
rng.gen::<u32>() as usize
6464
} else {
65-
rng.gen::<u64>() as uint
65+
rng.gen::<u64>() as usize
6666
}
6767
}
6868
}

0 commit comments

Comments
 (0)