diff --git a/src/doc/book/getting-started.md b/src/doc/book/getting-started.md index 31ee385a928d6..b0d4c6d6dd242 100644 --- a/src/doc/book/getting-started.md +++ b/src/doc/book/getting-started.md @@ -119,19 +119,7 @@ This will download a script, and start the installation. If it all goes well, you’ll see this appear: ```text -Welcome to Rust. - -This script will download the Rust compiler and its package manager, Cargo, and -install them to /usr/local. You may install elsewhere by running this script -with the --prefix= option. - -The installer will run under ‘sudo’ and may ask you for your password. If you do -not want the script to run ‘sudo’ then pass it the --disable-sudo flag. - -You may uninstall later by running /usr/local/lib/rustlib/uninstall.sh, -or by running this script again with the --uninstall flag. - -Continue? (y/N) +Rust is ready to roll. ``` From here, press `y` for ‘yes’, and then follow the rest of the prompts. diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index bd329949618e5..ba317334cfa0b 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -167,6 +167,49 @@ use vec::{self, Vec}; /// item's ordering relative to any other item, as determined by the `Ord` /// trait, changes while it is in the heap. This is normally only possible /// through `Cell`, `RefCell`, global state, I/O, or unsafe code. +/// +/// # Examples +/// +/// ``` +/// use std::collections::BinaryHeap; +/// +/// // type inference lets us omit an explicit type signature (which +/// // would be `BinaryHeap` in this example). +/// let mut heap = BinaryHeap::new(); +/// +/// // We can use peek to look at the next item in the heap. In this case, +/// // there's no items in there yet so we get None. +/// assert_eq!(heap.peek(), None); +/// +/// // Let's add some scores... +/// heap.push(1); +/// heap.push(5); +/// heap.push(2); +/// +/// // Now peek shows the most important item in the heap. +/// assert_eq!(heap.peek(), Some(&5)); +/// +/// // We can check the length of a heap. +/// assert_eq!(heap.len(), 3); +/// +/// // We can iterate over the items in the heap, although they are returned in +/// // a random order. +/// for x in heap.iter() { +/// println!("{}", x); +/// } +/// +/// // If we instead pop these scores, they should come back in order. +/// assert_eq!(heap.pop(), Some(5)); +/// assert_eq!(heap.pop(), Some(2)); +/// assert_eq!(heap.pop(), Some(1)); +/// assert_eq!(heap.pop(), None); +/// +/// // We can clear the heap of any remaining items. +/// heap.clear(); +/// +/// // The heap should now be empty. +/// assert!(heap.is_empty()) +/// ``` #[stable(feature = "rust1", since = "1.0.0")] pub struct BinaryHeap { data: Vec, @@ -203,6 +246,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); @@ -220,6 +265,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::with_capacity(10); @@ -235,6 +282,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from(vec![1, 2, 3, 4]); @@ -253,6 +302,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); @@ -273,6 +324,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::with_capacity(100); @@ -297,6 +350,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); @@ -318,6 +373,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); @@ -331,6 +388,19 @@ impl BinaryHeap { } /// Discards as much additional capacity as possible. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::collections::BinaryHeap; + /// let mut heap: BinaryHeap = BinaryHeap::with_capacity(100); + /// + /// assert!(heap.capacity() >= 100); + /// heap.shrink_to_fit(); + /// assert!(heap.capacity() == 0); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn shrink_to_fit(&mut self) { self.data.shrink_to_fit(); @@ -341,6 +411,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::from(vec![1, 3]); @@ -364,6 +436,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); @@ -386,6 +460,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// #![feature(binary_heap_extras)] /// @@ -424,6 +500,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// #![feature(binary_heap_extras)] /// @@ -454,6 +532,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from(vec![1, 2, 3, 4, 5, 6, 7]); @@ -474,6 +554,8 @@ impl BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// @@ -571,12 +653,40 @@ impl BinaryHeap { } /// Returns the length of the binary heap. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::collections::BinaryHeap; + /// let heap = BinaryHeap::from(vec![1, 3]); + /// + /// assert_eq!(heap.len(), 2); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn len(&self) -> usize { self.data.len() } /// Checks if the binary heap is empty. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::collections::BinaryHeap; + /// let mut heap = BinaryHeap::new(); + /// + /// assert!(heap.is_empty()); + /// + /// heap.push(3); + /// heap.push(5); + /// heap.push(1); + /// + /// assert!(!heap.is_empty()); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn is_empty(&self) -> bool { self.len() == 0 @@ -585,6 +695,23 @@ impl BinaryHeap { /// Clears the binary heap, returning an iterator over the removed elements. /// /// The elements are removed in arbitrary order. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::collections::BinaryHeap; + /// let mut heap = BinaryHeap::from(vec![1, 3]); + /// + /// assert!(!heap.is_empty()); + /// + /// for x in heap.drain() { + /// println!("{}", x); + /// } + /// + /// assert!(heap.is_empty()); + /// ``` #[inline] #[stable(feature = "drain", since = "1.6.0")] pub fn drain(&mut self) -> Drain { @@ -592,6 +719,21 @@ impl BinaryHeap { } /// Drops all items from the binary heap. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::collections::BinaryHeap; + /// let mut heap = BinaryHeap::from(vec![1, 3]); + /// + /// assert!(!heap.is_empty()); + /// + /// heap.clear(); + /// + /// assert!(heap.is_empty()); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn clear(&mut self) { self.drain(); @@ -809,6 +951,8 @@ impl IntoIterator for BinaryHeap { /// /// # Examples /// + /// Basic usage: + /// /// ``` /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from(vec![1, 2, 3, 4]); diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 8acd0c8f2cf06..823acf68001c7 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -535,6 +535,16 @@ fn slice_index_order_fail(index: usize, end: usize) -> ! { // FIXME implement indexing with inclusive ranges +/// Implements slicing with syntax `&self[begin .. end]`. +/// +/// Returns a slice of self for the index range [`begin`..`end`). +/// +/// This operation is `O(1)`. +/// +/// # Panics +/// +/// Requires that `begin <= end` and `end <= self.len()`, +/// otherwise slicing will panic. #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index> for [T] { type Output = [T]; @@ -554,6 +564,13 @@ impl ops::Index> for [T] { } } } + +/// Implements slicing with syntax `&self[.. end]`. +/// +/// Returns a slice of self from the beginning until but not including +/// the index `end`. +/// +/// Equivalent to `&self[0 .. end]` #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index> for [T] { type Output = [T]; @@ -563,6 +580,12 @@ impl ops::Index> for [T] { self.index(0 .. index.end) } } + +/// Implements slicing with syntax `&self[begin ..]`. +/// +/// Returns a slice of self from and including the index `begin` until the end. +/// +/// Equivalent to `&self[begin .. self.len()]` #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index> for [T] { type Output = [T]; @@ -572,6 +595,12 @@ impl ops::Index> for [T] { self.index(index.start .. self.len()) } } + +/// Implements slicing with syntax `&self[..]`. +/// +/// Returns a slice of the whole slice. This operation can not panic. +/// +/// Equivalent to `&self[0 .. self.len()]` #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index for [T] { type Output = [T]; @@ -608,6 +637,16 @@ impl ops::Index> for [T] { } } +/// Implements mutable slicing with syntax `&mut self[begin .. end]`. +/// +/// Returns a slice of self for the index range [`begin`..`end`). +/// +/// This operation is `O(1)`. +/// +/// # Panics +/// +/// Requires that `begin <= end` and `end <= self.len()`, +/// otherwise slicing will panic. #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut> for [T] { #[inline] @@ -625,6 +664,13 @@ impl ops::IndexMut> for [T] { } } } + +/// Implements mutable slicing with syntax `&mut self[.. end]`. +/// +/// Returns a slice of self from the beginning until but not including +/// the index `end`. +/// +/// Equivalent to `&mut self[0 .. end]` #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut> for [T] { #[inline] @@ -632,6 +678,12 @@ impl ops::IndexMut> for [T] { self.index_mut(0 .. index.end) } } + +/// Implements mutable slicing with syntax `&mut self[begin ..]`. +/// +/// Returns a slice of self from and including the index `begin` until the end. +/// +/// Equivalent to `&mut self[begin .. self.len()]` #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut> for [T] { #[inline] @@ -640,6 +692,12 @@ impl ops::IndexMut> for [T] { self.index_mut(index.start .. len) } } + +/// Implements mutable slicing with syntax `&mut self[..]`. +/// +/// Returns a slice of the whole slice. This operation can not panic. +/// +/// Equivalent to `&mut self[0 .. self.len()]` #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut for [T] { #[inline] diff --git a/src/libcoretest/fmt/builders.rs b/src/libcoretest/fmt/builders.rs index 885ee3f9c3be2..e71e61bda5efd 100644 --- a/src/libcoretest/fmt/builders.rs +++ b/src/libcoretest/fmt/builders.rs @@ -53,7 +53,7 @@ mod debug_struct { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_struct("Foo") .field("bar", &true) - .field("baz", &format_args!("{}/{}", 10i32, 20i32)) + .field("baz", &format_args!("{}/{}", 10, 20)) .finish() } } @@ -75,7 +75,7 @@ mod debug_struct { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_struct("Foo") .field("bar", &true) - .field("baz", &format_args!("{}/{}", 10i32, 20i32)) + .field("baz", &format_args!("{}/{}", 10, 20)) .finish() } } @@ -150,7 +150,7 @@ mod debug_tuple { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_tuple("Foo") .field(&true) - .field(&format_args!("{}/{}", 10i32, 20i32)) + .field(&format_args!("{}/{}", 10, 20)) .finish() } } @@ -172,7 +172,7 @@ mod debug_tuple { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_tuple("Foo") .field(&true) - .field(&format_args!("{}/{}", 10i32, 20i32)) + .field(&format_args!("{}/{}", 10, 20)) .finish() } } @@ -247,7 +247,7 @@ mod debug_map { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_map() .entry(&"bar", &true) - .entry(&10i32, &format_args!("{}/{}", 10i32, 20i32)) + .entry(&10, &format_args!("{}/{}", 10, 20)) .finish() } } @@ -269,7 +269,7 @@ mod debug_map { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_map() .entry(&"bar", &true) - .entry(&10i32, &format_args!("{}/{}", 10i32, 20i32)) + .entry(&10, &format_args!("{}/{}", 10, 20)) .finish() } } @@ -348,7 +348,7 @@ mod debug_set { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_set() .entry(&true) - .entry(&format_args!("{}/{}", 10i32, 20i32)) + .entry(&format_args!("{}/{}", 10, 20)) .finish() } } @@ -370,7 +370,7 @@ mod debug_set { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_set() .entry(&true) - .entry(&format_args!("{}/{}", 10i32, 20i32)) + .entry(&format_args!("{}/{}", 10, 20)) .finish() } } @@ -445,7 +445,7 @@ mod debug_list { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_list() .entry(&true) - .entry(&format_args!("{}/{}", 10i32, 20i32)) + .entry(&format_args!("{}/{}", 10, 20)) .finish() } } @@ -467,7 +467,7 @@ mod debug_list { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_list() .entry(&true) - .entry(&format_args!("{}/{}", 10i32, 20i32)) + .entry(&format_args!("{}/{}", 10, 20)) .finish() } } diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index acdced6492816..6c0cb03b5f775 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -677,7 +677,7 @@ fn test_rev() { #[test] fn test_cloned() { - let xs = [2u8, 4, 6, 8]; + let xs = [2, 4, 6, 8]; let mut it = xs.iter().cloned(); assert_eq!(it.len(), 4); @@ -861,8 +861,8 @@ fn test_range() { assert_eq!((-10..-1).size_hint(), (9, Some(9))); assert_eq!((-1..-10).size_hint(), (0, Some(0))); - assert_eq!((-70..58i8).size_hint(), (128, Some(128))); - assert_eq!((-128..127i8).size_hint(), (255, Some(255))); + assert_eq!((-70..58).size_hint(), (128, Some(128))); + assert_eq!((-128..127).size_hint(), (255, Some(255))); assert_eq!((-2..isize::MAX).size_hint(), (isize::MAX as usize + 2, Some(isize::MAX as usize + 2))); } @@ -1013,7 +1013,7 @@ fn bench_max_by_key2(b: &mut Bencher) { array.iter().enumerate().max_by_key(|&(_, item)| item).unwrap().0 } - let mut data = vec![0i32; 1638]; + let mut data = vec![0; 1638]; data[514] = 9999; b.iter(|| max_index_iter(&data)); diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs index afcf836ad10f5..8d791283ab87e 100644 --- a/src/libcoretest/num/int_macros.rs +++ b/src/libcoretest/num/int_macros.rs @@ -208,11 +208,11 @@ mod tests { fn test_pow() { let mut r = 2 as $T; - assert_eq!(r.pow(2u32), 4 as $T); - assert_eq!(r.pow(0u32), 1 as $T); + assert_eq!(r.pow(2), 4 as $T); + assert_eq!(r.pow(0), 1 as $T); r = -2 as $T; - assert_eq!(r.pow(2u32), 4 as $T); - assert_eq!(r.pow(3u32), -8 as $T); + assert_eq!(r.pow(2), 4 as $T); + assert_eq!(r.pow(3), -8 as $T); } } diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs index fba56db32bb4c..11c1bd667fb36 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -99,8 +99,8 @@ mod tests { #[test] fn test_leading_plus() { - assert_eq!("+127".parse::().ok(), Some(127u8)); - assert_eq!("+9223372036854775807".parse::().ok(), Some(9223372036854775807i64)); + assert_eq!("+127".parse::().ok(), Some(127)); + assert_eq!("+9223372036854775807".parse::().ok(), Some(9223372036854775807)); } #[test] diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs index 3e564cf197061..51b0655f680f6 100644 --- a/src/libcoretest/option.rs +++ b/src/libcoretest/option.rs @@ -251,7 +251,7 @@ fn test_collect() { #[test] fn test_cloned() { - let val = 1u32; + let val = 1; let val_ref = &val; let opt_none: Option<&'static u32> = None; let opt_ref = Some(&val); @@ -263,10 +263,10 @@ fn test_cloned() { // Immutable ref works assert_eq!(opt_ref.clone(), Some(&val)); - assert_eq!(opt_ref.cloned(), Some(1u32)); + assert_eq!(opt_ref.cloned(), Some(1)); // Double Immutable ref works assert_eq!(opt_ref_ref.clone(), Some(&val_ref)); assert_eq!(opt_ref_ref.clone().cloned(), Some(&val)); - assert_eq!(opt_ref_ref.cloned().cloned(), Some(1u32)); + assert_eq!(opt_ref_ref.cloned().cloned(), Some(1)); } diff --git a/src/librustc_front/hir.rs b/src/librustc_front/hir.rs index ece62364376fc..cc7c0f7865ea5 100644 --- a/src/librustc_front/hir.rs +++ b/src/librustc_front/hir.rs @@ -737,7 +737,7 @@ pub enum Expr_ { ExprBinary(BinOp, P, P), /// A unary operation (For example: `!x`, `*x`) ExprUnary(UnOp, P), - /// A literal (For example: `1u8`, `"foo"`) + /// A literal (For example: `1`, `"foo"`) ExprLit(P), /// A cast (`foo as f64`) ExprCast(P, P), @@ -804,7 +804,7 @@ pub enum Expr_ { /// A vector literal constructed from one repeated element. /// - /// For example, `[1u8; 5]`. The first expression is the element + /// For example, `[1; 5]`. The first expression is the element /// to be repeated; the second is the number of times to repeat it. ExprRepeat(P, P), } diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index cfe76206b0290..f376b42fbf968 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -379,7 +379,7 @@ impl Test { fn main() { let x = Test; - let v = &[0i32]; + let v = &[0]; x.method::(v); // error: only one type parameter is expected! } @@ -398,7 +398,7 @@ impl Test { fn main() { let x = Test; - let v = &[0i32]; + let v = &[0]; x.method::(v); // OK, we're good! } @@ -901,7 +901,7 @@ Example of erroneous code: ```compile_fail enum Foo { FirstValue(i32) }; -let u = Foo::FirstValue { value: 0i32 }; // error: Foo::FirstValue +let u = Foo::FirstValue { value: 0 }; // error: Foo::FirstValue // isn't a structure! // or even simpler, if the name doesn't refer to a structure at all. let t = u32 { value: 4 }; // error: `u32` does not name a structure. diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index cf4f4bdf291bc..d979aa264af81 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -22,7 +22,7 @@ use sys::os_str::{Buf, Slice}; use sys_common::{AsInner, IntoInner, FromInner}; /// A type that can represent owned, mutable platform-native strings, but is -/// cheaply interconvertable with Rust strings. +/// cheaply inter-convertible with Rust strings. /// /// The need for this type arises from the fact that: /// @@ -272,7 +272,7 @@ impl OsStr { unsafe { mem::transmute(inner) } } - /// Yields a `&str` slice if the `OsStr` is valid unicode. + /// Yields a `&str` slice if the `OsStr` is valid Unicode. /// /// This conversion may entail doing a check for UTF-8 validity. #[stable(feature = "rust1", since = "1.0.0")] @@ -301,7 +301,7 @@ impl OsStr { /// On Unix systems, this is a no-op. /// /// On Windows systems, this returns `None` unless the `OsStr` is - /// valid unicode, in which case it produces UTF-8-encoded + /// valid Unicode, in which case it produces UTF-8-encoded /// data. This may entail checking validity. #[unstable(feature = "convert", reason = "recently added", issue = "27704")] #[rustc_deprecated(reason = "RFC was closed, hides subtle Windows semantics", diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index a8bea2da83349..f7621b0131ad4 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -927,7 +927,7 @@ pub enum ExprKind { Binary(BinOp, P, P), /// A unary operation (For example: `!x`, `*x`) Unary(UnOp, P), - /// A literal (For example: `1u8`, `"foo"`) + /// A literal (For example: `1`, `"foo"`) Lit(P), /// A cast (`foo as f64`) Cast(P, P), @@ -1016,7 +1016,7 @@ pub enum ExprKind { /// An array literal constructed from one repeated element. /// - /// For example, `[1u8; 5]`. The first expression is the element + /// For example, `[1; 5]`. The first expression is the element /// to be repeated; the second is the number of times to repeat it. Repeat(P, P), @@ -1288,7 +1288,7 @@ pub enum LitKind { Byte(u8), /// A character literal (`'a'`) Char(char), - /// An integer literal (`1u8`) + /// An integer literal (`1`) Int(u64, LitIntType), /// A float literal (`1f64` or `1E10f64`) Float(InternedString, FloatTy), diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs index 4272f281edb44..dd8abedef7dec 100644 --- a/src/libsyntax/errors/emitter.rs +++ b/src/libsyntax/errors/emitter.rs @@ -663,7 +663,7 @@ fn stderr_isatty() -> bool { type DWORD = u32; type BOOL = i32; type HANDLE = *mut u8; - const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD; + const STD_ERROR_HANDLE: DWORD = -12 as DWORD; extern "system" { fn GetStdHandle(which: DWORD) -> HANDLE; fn GetConsoleMode(hConsoleHandle: HANDLE, diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index cbbd5289a5a2d..c1d922ea665b1 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -168,8 +168,8 @@ pub fn mk_printer<'a>(out: Box, linewidth: usize) -> Printer<'a> { let n: usize = 3 * linewidth; debug!("mk_printer {}", linewidth); let token = vec![Token::Eof; n]; - let size = vec![0_isize; n]; - let scan_stack = vec![0_usize; n]; + let size = vec![0; n]; + let scan_stack = vec![0; n]; Printer { out: out, buf_len: n, diff --git a/src/libterm/win.rs b/src/libterm/win.rs index d36b182710b97..79e07c4dc60b0 100644 --- a/src/libterm/win.rs +++ b/src/libterm/win.rs @@ -108,7 +108,7 @@ impl WinConsole { // terminal! Admittedly, this is fragile, since stderr could be // redirected to a different console. This is good enough for // rustc though. See #13400. - let out = GetStdHandle(-11i32 as DWORD); + let out = GetStdHandle(-11 as DWORD); SetConsoleTextAttribute(out, accum); } } @@ -120,7 +120,7 @@ impl WinConsole { let bg; unsafe { let mut buffer_info = ::std::mem::uninitialized(); - if GetConsoleScreenBufferInfo(GetStdHandle(-11i32 as DWORD), &mut buffer_info) != 0 { + if GetConsoleScreenBufferInfo(GetStdHandle(-11 as DWORD), &mut buffer_info) != 0 { fg = bits_to_color(buffer_info.wAttributes); bg = bits_to_color(buffer_info.wAttributes >> 4); } else {