Skip to content

Commit 0e314bc

Browse files
author
Leonids Maslovs
committed
---
yaml --- r: 188157 b: refs/heads/try c: c04c963 h: refs/heads/master i: 188155: 9105296 v: v3
1 parent 77399cd commit 0e314bc

Some content is hidden

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

59 files changed

+527
-1415
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: 16efd0ecbfd1b8ecad6c2fce8211bbefa0e1f562
5+
refs/heads/try: c04c9632f6239c223485e3c2c5a580f0d2f909e7
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 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.
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.
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_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>
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>
427427
```
428428
429-
Above, we're converting the `Result` returned by `parse` to an `Option` by using
429+
Here 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: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) {
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) {
475475
^~~~~~~~~
476476
error: aborting due to previous error
477477
```
478478
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
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
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(n) => n,
503+
Ok(num) => num,
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 `Result`, or else
527+
We use a `match` to either give us the `u32` inside of the `Option`, 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: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,10 @@ 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
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.
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.
209208
unsafe { &**self._ptr }
210209
}
211210
}
@@ -237,15 +236,13 @@ impl<T> Clone for Arc<T> {
237236
/// ```
238237
#[inline]
239238
fn clone(&self) -> Arc<T> {
240-
// Using a relaxed ordering is alright here, as knowledge of the
241-
// original reference prevents other threads from erroneously deleting
242-
// the object.
239+
// Using a relaxed ordering is alright here, as knowledge of the original reference
240+
// prevents other threads from erroneously deleting the object.
243241
//
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.
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.
249246
//
250247
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
251248
self.inner().strong.fetch_add(1, Relaxed);

branches/try/src/libcollections/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@
364364
//! * `o` - precedes the argument with a "0o"
365365
//! * '0' - This is used to indicate for integer formats that the padding should
366366
//! both be done with a `0` character as well as be sign-aware. A format
367-
//! like `{:08d}` would yield `00000001` for the integer `1`, while the
367+
//! like `{:08}` would yield `00000001` for the integer `1`, while the
368368
//! same format would yield `-0000001` for the integer `-1`. Notice that
369369
//! the negative version has one fewer zero than the positive version.
370370
//!

branches/try/src/libcore/lib.rs

Lines changed: 3 additions & 1 deletion
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 `usize`. These three arguments dictate
42+
//! `fmt::Arguments`, a `&str`, and a `uint`. 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,12 +88,14 @@ mod int_macros;
8888
#[macro_use]
8989
mod uint_macros;
9090

91+
#[path = "num/int.rs"] pub mod int;
9192
#[path = "num/isize.rs"] pub mod isize;
9293
#[path = "num/i8.rs"] pub mod i8;
9394
#[path = "num/i16.rs"] pub mod i16;
9495
#[path = "num/i32.rs"] pub mod i32;
9596
#[path = "num/i64.rs"] pub mod i64;
9697

98+
#[path = "num/uint.rs"] pub mod uint;
9799
#[path = "num/usize.rs"] pub mod usize;
98100
#[path = "num/u8.rs"] pub mod u8;
99101
#[path = "num/u16.rs"] pub mod u16;

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Deprecated: replaced by `isize`.
12+
//!
13+
//! The rollout of the new type will gradually take place over the
14+
//! alpha cycle along with the development of clearer conventions
15+
//! around integer types.
16+
17+
#![unstable(feature = "core")]
18+
#![deprecated(since = "1.0.0", reason = "replaced by isize")]
19+
20+
#[cfg(target_pointer_width = "32")] int_module! { int, 32 }
21+
#[cfg(target_pointer_width = "64")] int_module! { int, 64 }

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Deprecated: replaced by `usize`.
12+
//!
13+
//! The rollout of the new type will gradually take place over the
14+
//! alpha cycle along with the development of clearer conventions
15+
//! around integer types.
16+
17+
#![unstable(feature = "core")]
18+
#![deprecated(since = "1.0.0", reason = "replaced by usize")]
19+
20+
uint_module! { uint, int, ::int::BITS }

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::usize;
15+
use core::uint;
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(), (usize::MAX, None));
295+
assert_eq!(it.size_hint(), (uint::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(), (usize::MAX, None));
368+
assert_eq!(c.size_hint(), (uint::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(), (usize::MAX, None));
376-
assert_eq!(c.clone().chain(vi.clone().cloned()).size_hint(), (usize::MAX, 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));
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(), (usize::MAX, None));
380+
assert_eq!(c.clone().map(|_| 0).size_hint(), (uint::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!((usize::MAX - 1..usize::MAX).size_hint(), (1, Some(1)));
756+
assert_eq!((uint::MAX - 1..uint::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
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
int_module!(int, int);

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::isize;
15+
use core::int;
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!(isize::MIN.checked_div(-1) == None);
156+
assert!(int::MIN.checked_div(-1) == None);
157157
}
158158

159159
#[test]

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

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

2526
#[macro_use]
2627
mod uint_macros;
@@ -29,6 +30,7 @@ mod u8;
2930
mod u16;
3031
mod u32;
3132
mod u64;
33+
mod uint;
3234

3335
/// Helper function for testing numeric operations
3436
pub fn test_num<T>(ten: T, two: T) where
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
uint_module!(uint, uint);

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::usize::MAX,
966+
t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::MAX,
967967
&["Mary had a little lamb\nLittle lamb".to_string()]);
968968
}
969969

branches/try/src/liblibc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@ 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;
11181119
pub type pid_t = i32;
11191120
pub type uid_t = u32;
11201121
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::isize;
16-
use core::usize;
15+
use core::int;
16+
use core::uint;
1717

1818
use {Rand,Rng};
1919

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

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

0 commit comments

Comments
 (0)