Skip to content

Commit b0d2c6a

Browse files
committed
Rollup merge of rust-lang#22294 - nikomatsakis:integer-audit, r=huonw
cc rust-lang#22240
2 parents d660739 + 6171c35 commit b0d2c6a

File tree

5 files changed

+110
-110
lines changed

5 files changed

+110
-110
lines changed

src/libcore/finally.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<T, F> Finally<T> for F where F: FnMut() -> T {
7272
/// ```
7373
/// use std::finally::try_finally;
7474
///
75-
/// struct State<'a> { buffer: &'a mut [u8], len: uint }
75+
/// struct State<'a> { buffer: &'a mut [u8], len: usize }
7676
/// # let mut buf = [];
7777
/// let mut state = State { buffer: &mut buf, len: 0 };
7878
/// try_finally(

src/libcore/ops.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
//!
3838
//! #[derive(Debug)]
3939
//! struct Point {
40-
//! x: int,
41-
//! y: int
40+
//! x: i32,
41+
//! y: i32
4242
//! }
4343
//!
4444
//! impl Add for Point {
@@ -206,7 +206,7 @@ macro_rules! add_impl {
206206
)*)
207207
}
208208

209-
add_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
209+
add_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
210210

211211
/// The `Sub` trait is used to specify the functionality of `-`.
212212
///
@@ -259,7 +259,7 @@ macro_rules! sub_impl {
259259
)*)
260260
}
261261

262-
sub_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
262+
sub_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
263263

264264
/// The `Mul` trait is used to specify the functionality of `*`.
265265
///
@@ -312,7 +312,7 @@ macro_rules! mul_impl {
312312
)*)
313313
}
314314

315-
mul_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
315+
mul_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
316316

317317
/// The `Div` trait is used to specify the functionality of `/`.
318318
///
@@ -365,7 +365,7 @@ macro_rules! div_impl {
365365
)*)
366366
}
367367

368-
div_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
368+
div_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
369369

370370
/// The `Rem` trait is used to specify the functionality of `%`.
371371
///
@@ -435,7 +435,7 @@ macro_rules! rem_float_impl {
435435
}
436436
}
437437

438-
rem_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 }
438+
rem_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
439439
rem_float_impl! { f32, fmodf }
440440
rem_float_impl! { f64, fmod }
441441

@@ -506,9 +506,9 @@ macro_rules! neg_uint_impl {
506506
}
507507
}
508508

509-
neg_impl! { int i8 i16 i32 i64 f32 f64 }
509+
neg_impl! { isize i8 i16 i32 i64 f32 f64 }
510510

511-
neg_uint_impl! { uint, int }
511+
neg_uint_impl! { usize, isize }
512512
neg_uint_impl! { u8, i8 }
513513
neg_uint_impl! { u16, i16 }
514514
neg_uint_impl! { u32, i32 }
@@ -566,7 +566,7 @@ macro_rules! not_impl {
566566
)*)
567567
}
568568

569-
not_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
569+
not_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
570570

571571
/// The `BitAnd` trait is used to specify the functionality of `&`.
572572
///
@@ -619,7 +619,7 @@ macro_rules! bitand_impl {
619619
)*)
620620
}
621621

622-
bitand_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
622+
bitand_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
623623

624624
/// The `BitOr` trait is used to specify the functionality of `|`.
625625
///
@@ -672,7 +672,7 @@ macro_rules! bitor_impl {
672672
)*)
673673
}
674674

675-
bitor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
675+
bitor_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
676676

677677
/// The `BitXor` trait is used to specify the functionality of `^`.
678678
///
@@ -725,7 +725,7 @@ macro_rules! bitxor_impl {
725725
)*)
726726
}
727727

728-
bitxor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
728+
bitxor_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
729729

730730
/// The `Shl` trait is used to specify the functionality of `<<`.
731731
///

src/libcore/option.rs

+28-28
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@
6060
//! the optional owned box, `Option<Box<T>>`.
6161
//!
6262
//! The following example uses `Option` to create an optional box of
63-
//! `int`. Notice that in order to use the inner `int` value first the
63+
//! `i32`. Notice that in order to use the inner `i32` value first the
6464
//! `check_optional` function needs to use pattern matching to
6565
//! determine whether the box has a value (i.e. it is `Some(...)`) or
6666
//! not (`None`).
6767
//!
6868
//! ```
69-
//! let optional: Option<Box<int>> = None;
69+
//! let optional: Option<Box<i32>> = None;
7070
//! check_optional(&optional);
7171
//!
72-
//! let optional: Option<Box<int>> = Some(Box::new(9000));
72+
//! let optional: Option<Box<i32>> = Some(Box::new(9000));
7373
//! check_optional(&optional);
7474
//!
75-
//! fn check_optional(optional: &Option<Box<int>>) {
75+
//! fn check_optional(optional: &Option<Box<i32>>) {
7676
//! match *optional {
7777
//! Some(ref p) => println!("have value {}", p),
7878
//! None => println!("have no value")
@@ -108,7 +108,7 @@
108108
//! Initialize a result to `None` before a loop:
109109
//!
110110
//! ```
111-
//! enum Kingdom { Plant(uint, &'static str), Animal(uint, &'static str) }
111+
//! enum Kingdom { Plant(u32, &'static str), Animal(u32, &'static str) }
112112
//!
113113
//! // A list of data to search through.
114114
//! let all_the_big_things = [
@@ -188,10 +188,10 @@ impl<T> Option<T> {
188188
/// # Example
189189
///
190190
/// ```
191-
/// let x: Option<uint> = Some(2);
191+
/// let x: Option<u32> = Some(2);
192192
/// assert_eq!(x.is_some(), true);
193193
///
194-
/// let x: Option<uint> = None;
194+
/// let x: Option<u32> = None;
195195
/// assert_eq!(x.is_some(), false);
196196
/// ```
197197
#[inline]
@@ -208,10 +208,10 @@ impl<T> Option<T> {
208208
/// # Example
209209
///
210210
/// ```
211-
/// let x: Option<uint> = Some(2);
211+
/// let x: Option<u32> = Some(2);
212212
/// assert_eq!(x.is_none(), false);
213213
///
214-
/// let x: Option<uint> = None;
214+
/// let x: Option<u32> = None;
215215
/// assert_eq!(x.is_none(), true);
216216
/// ```
217217
#[inline]
@@ -228,7 +228,7 @@ impl<T> Option<T> {
228228
///
229229
/// # Example
230230
///
231-
/// Convert an `Option<String>` into an `Option<int>`, preserving the original.
231+
/// Convert an `Option<String>` into an `Option<usize>`, preserving the original.
232232
/// The `map` method takes the `self` argument by value, consuming the original,
233233
/// so this technique uses `as_ref` to first take an `Option` to a reference
234234
/// to the value inside the original.
@@ -237,7 +237,7 @@ impl<T> Option<T> {
237237
/// let num_as_str: Option<String> = Some("10".to_string());
238238
/// // First, cast `Option<String>` to `Option<&String>` with `as_ref`,
239239
/// // then consume *that* with `map`, leaving `num_as_str` on the stack.
240-
/// let num_as_int: Option<uint> = num_as_str.as_ref().map(|n| n.len());
240+
/// let num_as_int: Option<usize> = num_as_str.as_ref().map(|n| n.len());
241241
/// println!("still can print num_as_str: {:?}", num_as_str);
242242
/// ```
243243
#[inline]
@@ -406,12 +406,12 @@ impl<T> Option<T> {
406406
///
407407
/// # Example
408408
///
409-
/// Convert an `Option<String>` into an `Option<uint>`, consuming the original:
409+
/// Convert an `Option<String>` into an `Option<usize>`, consuming the original:
410410
///
411411
/// ```
412412
/// let num_as_str: Option<String> = Some("10".to_string());
413413
/// // `Option::map` takes self *by value*, consuming `num_as_str`
414-
/// let num_as_int: Option<uint> = num_as_str.map(|n| n.len());
414+
/// let num_as_int: Option<usize> = num_as_str.map(|n| n.len());
415415
/// ```
416416
#[inline]
417417
#[stable(feature = "rust1", since = "1.0.0")]
@@ -518,7 +518,7 @@ impl<T> Option<T> {
518518
/// let x = Some(4);
519519
/// assert_eq!(x.iter().next(), Some(&4));
520520
///
521-
/// let x: Option<uint> = None;
521+
/// let x: Option<u32> = None;
522522
/// assert_eq!(x.iter().next(), None);
523523
/// ```
524524
#[inline]
@@ -539,7 +539,7 @@ impl<T> Option<T> {
539539
/// }
540540
/// assert_eq!(x, Some(42));
541541
///
542-
/// let mut x: Option<uint> = None;
542+
/// let mut x: Option<u32> = None;
543543
/// assert_eq!(x.iter_mut().next(), None);
544544
/// ```
545545
#[inline]
@@ -581,15 +581,15 @@ impl<T> Option<T> {
581581
/// let y: Option<&str> = None;
582582
/// assert_eq!(x.and(y), None);
583583
///
584-
/// let x: Option<uint> = None;
584+
/// let x: Option<u32> = None;
585585
/// let y = Some("foo");
586586
/// assert_eq!(x.and(y), None);
587587
///
588588
/// let x = Some(2);
589589
/// let y = Some("foo");
590590
/// assert_eq!(x.and(y), Some("foo"));
591591
///
592-
/// let x: Option<uint> = None;
592+
/// let x: Option<u32> = None;
593593
/// let y: Option<&str> = None;
594594
/// assert_eq!(x.and(y), None);
595595
/// ```
@@ -608,8 +608,8 @@ impl<T> Option<T> {
608608
/// # Example
609609
///
610610
/// ```
611-
/// fn sq(x: uint) -> Option<uint> { Some(x * x) }
612-
/// fn nope(_: uint) -> Option<uint> { None }
611+
/// fn sq(x: u32) -> Option<u32> { Some(x * x) }
612+
/// fn nope(_: u32) -> Option<u32> { None }
613613
///
614614
/// assert_eq!(Some(2).and_then(sq).and_then(sq), Some(16));
615615
/// assert_eq!(Some(2).and_then(sq).and_then(nope), None);
@@ -642,7 +642,7 @@ impl<T> Option<T> {
642642
/// let y = Some(100);
643643
/// assert_eq!(x.or(y), Some(2));
644644
///
645-
/// let x: Option<uint> = None;
645+
/// let x: Option<u32> = None;
646646
/// let y = None;
647647
/// assert_eq!(x.or(y), None);
648648
/// ```
@@ -690,7 +690,7 @@ impl<T> Option<T> {
690690
/// x.take();
691691
/// assert_eq!(x, None);
692692
///
693-
/// let mut x: Option<uint> = None;
693+
/// let mut x: Option<u32> = None;
694694
/// x.take();
695695
/// assert_eq!(x, None);
696696
/// ```
@@ -789,7 +789,7 @@ impl<A> Iterator for Item<A> {
789789
}
790790

791791
#[inline]
792-
fn size_hint(&self) -> (uint, Option<uint>) {
792+
fn size_hint(&self) -> (usize, Option<usize>) {
793793
match self.opt {
794794
Some(_) => (1, Some(1)),
795795
None => (0, Some(0)),
@@ -817,7 +817,7 @@ impl<'a, A> Iterator for Iter<'a, A> {
817817
#[inline]
818818
fn next(&mut self) -> Option<&'a A> { self.inner.next() }
819819
#[inline]
820-
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
820+
fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
821821
}
822822

823823
#[stable(feature = "rust1", since = "1.0.0")]
@@ -847,7 +847,7 @@ impl<'a, A> Iterator for IterMut<'a, A> {
847847
#[inline]
848848
fn next(&mut self) -> Option<&'a mut A> { self.inner.next() }
849849
#[inline]
850-
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
850+
fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
851851
}
852852

853853
#[stable(feature = "rust1", since = "1.0.0")]
@@ -870,7 +870,7 @@ impl<A> Iterator for IntoIter<A> {
870870
#[inline]
871871
fn next(&mut self) -> Option<A> { self.inner.next() }
872872
#[inline]
873-
fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
873+
fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() }
874874
}
875875

876876
#[stable(feature = "rust1", since = "1.0.0")]
@@ -896,11 +896,11 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
896896
/// checking for overflow:
897897
///
898898
/// ```rust
899-
/// use std::uint;
899+
/// use std::u16;
900900
///
901901
/// let v = vec!(1, 2);
902-
/// let res: Option<Vec<uint>> = v.iter().map(|&x: &uint|
903-
/// if x == uint::MAX { None }
902+
/// let res: Option<Vec<u16>> = v.iter().map(|&x: &u16|
903+
/// if x == u16::MAX { None }
904904
/// else { Some(x + 1) }
905905
/// ).collect();
906906
/// assert!(res == Some(vec!(2, 3)));

0 commit comments

Comments
 (0)