From ec4981ece86769c768d61a914093a7a39192522c Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Tue, 27 Jan 2015 03:38:07 +0100 Subject: Thread native name setting, fix #10302 --- src/libstd/sys/unix/thread.rs | 40 ++++++++++++++++++++++++++++++++++++++++ src/libstd/sys/windows/thread.rs | 7 +++++++ src/libstd/thread.rs | 4 ++++ 3 files changed, 51 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index ac51b68795f..3c34e1f9dd4 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -17,6 +17,7 @@ use ptr; use libc::consts::os::posix01::{PTHREAD_CREATE_JOINABLE, PTHREAD_STACK_MIN}; use libc; use thunk::Thunk; +use ffi::CString; use sys_common::stack::RED_ZONE; use sys_common::thread::*; @@ -206,6 +207,29 @@ pub unsafe fn create(stack: uint, p: Thunk) -> rust_thread { native } +#[cfg(any(target_os = "linux", target_os = "android"))] +pub unsafe fn set_name(name: &str) { + // Using prctl() rather than pthread_setname_np(), + // because pthread_setname_np() wasn't added until glibc 2.12 + // PR_SET_NAME since Linux 2.6.9 + let cname = CString::from_slice(name.as_bytes()); + prctl(15i32 /* = PR_SET_NAME */, cname.as_ptr() as u64, 0u64, 0u64, 0u64); +} + +#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] +pub unsafe fn set_name(name: &str) { + // pthread_set_name_np() since almost forever on all BSDs + let cname = CString::from_slice(name.as_bytes()); + pthread_set_name_np(pthread_self(), cname.as_ptr()); +} + +#[cfg(target_os = "macos")] +pub unsafe fn set_name(name: &str) { + // pthread_setname_np() since OS X 10.6 + let cname = CString::from_slice(name.as_bytes()); + pthread_setname_np(cname.as_ptr()); +} + pub unsafe fn join(native: rust_thread) { assert_eq!(pthread_join(native, ptr::null_mut()), 0); } @@ -246,6 +270,15 @@ fn min_stack_size(_: *const libc::pthread_attr_t) -> libc::size_t { PTHREAD_STACK_MIN } +#[cfg(any(target_os = "linux", target_os = "android"))] +extern { + fn prctl(option: libc::c_int, + arg2: libc::c_ulong, + arg3: libc::c_ulong, + arg4: libc::c_ulong, + arg5: libc::c_ulong) -> libc::c_int; +} + #[cfg(any(target_os = "linux"))] extern { pub fn pthread_self() -> libc::pthread_t; @@ -258,11 +291,18 @@ extern { stacksize: *mut libc::size_t) -> libc::c_int; } +#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] +extern { + pub fn pthread_self() -> libc::pthread_t; + fn pthread_set_name_np(tid: libc::pthread_t, name: *const c_char); +} + #[cfg(target_os = "macos")] extern { pub fn pthread_self() -> libc::pthread_t; pub fn pthread_get_stackaddr_np(thread: libc::pthread_t) -> *mut libc::c_void; pub fn pthread_get_stacksize_np(thread: libc::pthread_t) -> libc::size_t; + fn pthread_setname_np(name: *const c_char) -> libc::c_int; } extern { diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index 30707488b30..b6027ea2e7e 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -67,6 +67,13 @@ pub unsafe fn create(stack: uint, p: Thunk) -> rust_thread { return ret; } +pub unsafe fn set_name(name: &str) { + // Windows threads are nameless + // The names in MSVC debugger are obtained using a "magic" exception, + // which requires a use of C++ macros. + // See https://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx +} + pub unsafe fn join(native: rust_thread) { use libc::consts::os::extra::INFINITE; WaitForSingleObject(native, INFINITE); diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index a86b82b8c62..0cab7e69928 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -275,6 +275,10 @@ impl Builder { unsafe { stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top); } + match their_thread.name() { + Some(thename) => unsafe { imp::set_name(thename.as_slice()); }, + None => {} + } thread_info::set( (my_stack_bottom, my_stack_top), unsafe { imp::guard::current() }, -- cgit 1.4.1-3-g733a5 From c155208de42de5761231726e35614b4499b5a137 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Tue, 27 Jan 2015 16:00:26 +0100 Subject: Thread native name setting, fix #10302 --- src/libstd/sys/unix/thread.rs | 4 ++-- src/libstd/sys/windows/thread.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 3c34e1f9dd4..1fba6bedc7c 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -223,9 +223,9 @@ pub unsafe fn set_name(name: &str) { pthread_set_name_np(pthread_self(), cname.as_ptr()); } -#[cfg(target_os = "macos")] +#[cfg(any(target_os = "macos", target_os = "ios"))] pub unsafe fn set_name(name: &str) { - // pthread_setname_np() since OS X 10.6 + // pthread_setname_np() since OS X 10.6 and iOS 3.2 let cname = CString::from_slice(name.as_bytes()); pthread_setname_np(cname.as_ptr()); } diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index b6027ea2e7e..a94adcb3bc7 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -67,10 +67,10 @@ pub unsafe fn create(stack: uint, p: Thunk) -> rust_thread { return ret; } -pub unsafe fn set_name(name: &str) { +pub unsafe fn set_name(_name: &str) { // Windows threads are nameless // The names in MSVC debugger are obtained using a "magic" exception, - // which requires a use of C++ macros. + // which requires a use of MS C++ extensions. // See https://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx } -- cgit 1.4.1-3-g733a5 From 33a3d6d88f76bfae770983ee50e36e23cc4c7655 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Wed, 28 Jan 2015 13:48:27 +0100 Subject: Thread native name setting, fix #10302 --- src/libstd/sys/common/thread_info.rs | 4 ++++ src/libstd/sys/unix/thread.rs | 29 ++++++++++++++--------------- src/libstd/thread.rs | 4 ---- 3 files changed, 18 insertions(+), 19 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/sys/common/thread_info.rs b/src/libstd/sys/common/thread_info.rs index 92b936e74f6..7c9758ca924 100644 --- a/src/libstd/sys/common/thread_info.rs +++ b/src/libstd/sys/common/thread_info.rs @@ -56,6 +56,10 @@ pub fn stack_guard() -> uint { pub fn set(stack_bounds: (uint, uint), stack_guard: uint, thread: Thread) { THREAD_INFO.with(|c| assert!(c.borrow().is_none())); + match thread.name() { + Some(name) => unsafe { ::sys::thread::set_name(name.as_slice()); }, + None => {} + } THREAD_INFO.with(move |c| *c.borrow_mut() = Some(ThreadInfo{ stack_bounds: stack_bounds, stack_guard: stack_guard, diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 1fba6bedc7c..59c2badaf62 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -209,11 +209,19 @@ pub unsafe fn create(stack: uint, p: Thunk) -> rust_thread { #[cfg(any(target_os = "linux", target_os = "android"))] pub unsafe fn set_name(name: &str) { - // Using prctl() rather than pthread_setname_np(), - // because pthread_setname_np() wasn't added until glibc 2.12 - // PR_SET_NAME since Linux 2.6.9 + // pthread_setname_np() since glibc 2.12 + // availability autodetected via weak linkage let cname = CString::from_slice(name.as_bytes()); - prctl(15i32 /* = PR_SET_NAME */, cname.as_ptr() as u64, 0u64, 0u64, 0u64); + type F = unsafe extern "C" fn(libc::pthread_t, *const libc::c_char) -> libc::c_int; + extern { + #[linkage = "extern_weak"] + static pthread_setname_np: *const (); + } + if !pthread_setname_np.is_null() { + unsafe { + mem::transmute::<*const (), F>(pthread_setname_np)(pthread_self(), cname.as_ptr()); + } + } } #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] @@ -270,15 +278,6 @@ fn min_stack_size(_: *const libc::pthread_attr_t) -> libc::size_t { PTHREAD_STACK_MIN } -#[cfg(any(target_os = "linux", target_os = "android"))] -extern { - fn prctl(option: libc::c_int, - arg2: libc::c_ulong, - arg3: libc::c_ulong, - arg4: libc::c_ulong, - arg5: libc::c_ulong) -> libc::c_int; -} - #[cfg(any(target_os = "linux"))] extern { pub fn pthread_self() -> libc::pthread_t; @@ -294,7 +293,7 @@ extern { #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] extern { pub fn pthread_self() -> libc::pthread_t; - fn pthread_set_name_np(tid: libc::pthread_t, name: *const c_char); + fn pthread_set_name_np(tid: libc::pthread_t, name: *const libc::c_char); } #[cfg(target_os = "macos")] @@ -302,7 +301,7 @@ extern { pub fn pthread_self() -> libc::pthread_t; pub fn pthread_get_stackaddr_np(thread: libc::pthread_t) -> *mut libc::c_void; pub fn pthread_get_stacksize_np(thread: libc::pthread_t) -> libc::size_t; - fn pthread_setname_np(name: *const c_char) -> libc::c_int; + fn pthread_setname_np(name: *const libc::c_char) -> libc::c_int; } extern { diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index 0cab7e69928..a86b82b8c62 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -275,10 +275,6 @@ impl Builder { unsafe { stack::record_os_managed_stack_bounds(my_stack_bottom, my_stack_top); } - match their_thread.name() { - Some(thename) => unsafe { imp::set_name(thename.as_slice()); }, - None => {} - } thread_info::set( (my_stack_bottom, my_stack_top), unsafe { imp::guard::current() }, -- cgit 1.4.1-3-g733a5 From 7e67eba180eb2efb09e1487020a9a160335e7926 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Wed, 28 Jan 2015 14:01:14 +0100 Subject: Thread native name setting, fix #10302 --- src/libstd/sys/unix/thread.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 59c2badaf62..d8e281bf5ab 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -296,7 +296,7 @@ extern { fn pthread_set_name_np(tid: libc::pthread_t, name: *const libc::c_char); } -#[cfg(target_os = "macos")] +#[cfg(any(target_os = "macos", target_os = "ios"))] extern { pub fn pthread_self() -> libc::pthread_t; pub fn pthread_get_stackaddr_np(thread: libc::pthread_t) -> *mut libc::c_void; -- cgit 1.4.1-3-g733a5 From 9ee972ca32b1f91eb6880e1bc9c8bb5a4faf1f29 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Wed, 28 Jan 2015 16:52:53 +0100 Subject: Thread native name setting, fix #10302 --- src/libstd/sys/unix/thread.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index d8e281bf5ab..26a450b8599 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -278,7 +278,7 @@ fn min_stack_size(_: *const libc::pthread_attr_t) -> libc::size_t { PTHREAD_STACK_MIN } -#[cfg(any(target_os = "linux"))] +#[cfg(any(target_os = "linux", target_os = "android"))] extern { pub fn pthread_self() -> libc::pthread_t; pub fn pthread_getattr_np(native: libc::pthread_t, -- cgit 1.4.1-3-g733a5 From ca0e83cdeca6c0fc43d8e8017174e6531da4406e Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Thu, 29 Jan 2015 01:56:59 +0100 Subject: Fix wrong use std::io -> old_io --- src/libstd/sys/unix/os.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 5d5cda03f01..dd343baa7c9 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -196,7 +196,7 @@ pub fn load_self() -> Option> { #[cfg(target_os = "dragonfly")] pub fn load_self() -> Option> { - use std::io; + use old_io; match old_io::fs::readlink(&Path::new("/proc/curproc/file")) { Ok(path) => Some(path.into_vec()), -- cgit 1.4.1-3-g733a5 From 26276f475134ca58a9872e175f964e4512f75d1a Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 28 Jan 2015 20:12:00 -0800 Subject: Fix up check to bypass internal buffer We don't care about how much space the allocation has, but the actual usable space in the buffer. --- src/libstd/old_io/buffered.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/old_io/buffered.rs b/src/libstd/old_io/buffered.rs index 1590598c0b8..586cc1477f8 100644 --- a/src/libstd/old_io/buffered.rs +++ b/src/libstd/old_io/buffered.rs @@ -111,7 +111,7 @@ impl Buffer for BufferedReader { impl Reader for BufferedReader { fn read(&mut self, buf: &mut [u8]) -> IoResult { - if self.pos == self.cap && buf.len() >= self.buf.capacity() { + if self.pos == self.cap && buf.len() >= self.buf.len() { return self.inner.read(buf); } let nread = { -- cgit 1.4.1-3-g733a5 From 947f6ca4a1b8a3decc535963addb67864b988277 Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Tue, 27 Jan 2015 23:41:25 +0100 Subject: Feature gate macro_reexport. Fixes #20906 --- src/libstd/lib.rs | 2 +- src/libsyntax/feature_gate.rs | 7 +++++++ src/test/auxiliary/macro_reexport_2.rs | 1 + src/test/auxiliary/macro_reexport_2_no_use.rs | 1 + src/test/compile-fail/macro-reexport-malformed-1.rs | 2 ++ src/test/compile-fail/macro-reexport-malformed-2.rs | 2 ++ src/test/compile-fail/macro-reexport-malformed-3.rs | 2 ++ src/test/compile-fail/macro-reexport-not-locally-visible.rs | 2 ++ 8 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 3a745389e1e..cf93c561091 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -114,7 +114,6 @@ #![feature(old_impl_check)] #![feature(optin_builtin_traits)] #![feature(int_uint)] -#![feature(int_uint)] #![feature(core)] #![feature(libc)] #![feature(alloc)] @@ -123,6 +122,7 @@ #![feature(rand)] #![feature(hash)] #![cfg_attr(test, feature(test))] +#![feature(macro_reexport)] // Don't link to std. We are std. #![no_std] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 6e797844c18..059838ceb64 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -109,6 +109,9 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[ // int and uint are now deprecated ("int_uint", "1.0.0", Active), + // macro reexport needs more discusion and stabilization + ("macro_reexport", Active), + // These are used to test this portion of the compiler, they don't actually // mean anything ("test_accepted_feature", "1.0.0", Accepted), @@ -272,6 +275,10 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { self.gate_feature("plugin", i.span, "compiler plugins are experimental \ and possibly buggy"); + } else if attr::contains_name(&i.attrs[], "macro_reexport") { + self.gate_feature("macro_reexport", i.span, + "macros reexports are experimental \ + and possibly buggy"); } } diff --git a/src/test/auxiliary/macro_reexport_2.rs b/src/test/auxiliary/macro_reexport_2.rs index 15d9f9cc914..3918be88d86 100644 --- a/src/test/auxiliary/macro_reexport_2.rs +++ b/src/test/auxiliary/macro_reexport_2.rs @@ -9,6 +9,7 @@ // except according to those terms. #![crate_type = "dylib"] +#![feature(macro_reexport)] #[macro_reexport(reexported)] #[macro_use] #[no_link] diff --git a/src/test/auxiliary/macro_reexport_2_no_use.rs b/src/test/auxiliary/macro_reexport_2_no_use.rs index 63142b0a699..1d3dc26b0b4 100644 --- a/src/test/auxiliary/macro_reexport_2_no_use.rs +++ b/src/test/auxiliary/macro_reexport_2_no_use.rs @@ -9,6 +9,7 @@ // except according to those terms. #![crate_type = "dylib"] +#![feature(macro_reexport)] #[macro_reexport(reexported)] #[no_link] diff --git a/src/test/compile-fail/macro-reexport-malformed-1.rs b/src/test/compile-fail/macro-reexport-malformed-1.rs index b9f754b2778..6c85cf5c7f5 100644 --- a/src/test/compile-fail/macro-reexport-malformed-1.rs +++ b/src/test/compile-fail/macro-reexport-malformed-1.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(macro_reexport)] + #[macro_reexport] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-malformed-2.rs b/src/test/compile-fail/macro-reexport-malformed-2.rs index 9ced5be8479..1dd0168181f 100644 --- a/src/test/compile-fail/macro-reexport-malformed-2.rs +++ b/src/test/compile-fail/macro-reexport-malformed-2.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(macro_reexport)] + #[macro_reexport="foo"] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-malformed-3.rs b/src/test/compile-fail/macro-reexport-malformed-3.rs index c8bd0a0509c..7ae045f6e4f 100644 --- a/src/test/compile-fail/macro-reexport-malformed-3.rs +++ b/src/test/compile-fail/macro-reexport-malformed-3.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(macro_reexport)] + #[macro_reexport(foo="bar")] //~ ERROR bad macro reexport extern crate std; diff --git a/src/test/compile-fail/macro-reexport-not-locally-visible.rs b/src/test/compile-fail/macro-reexport-not-locally-visible.rs index cf0d79e0fef..6859ccfe3b7 100644 --- a/src/test/compile-fail/macro-reexport-not-locally-visible.rs +++ b/src/test/compile-fail/macro-reexport-not-locally-visible.rs @@ -11,6 +11,8 @@ // aux-build:macro_reexport_1.rs // ignore-stage1 +#![feature(macro_reexport)] + #[macro_reexport(reexported)] #[no_link] extern crate macro_reexport_1; -- cgit 1.4.1-3-g733a5 From 7f64fe4e27555c256cb228feb05d4181a2287125 Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Sun, 25 Jan 2015 22:05:03 +0100 Subject: Remove all `i` suffixes --- src/liballoc/arc.rs | 56 +-- src/liballoc/boxed_test.rs | 2 +- src/liballoc/heap.rs | 2 +- src/liballoc/rc.rs | 66 ++-- src/libcollections/binary_heap.rs | 76 ++--- src/libcollections/btree/map.rs | 2 +- src/libcollections/btree/set.rs | 28 +- src/libcollections/dlist.rs | 76 ++--- src/libcollections/ring_buf.rs | 246 ++++++------- src/libcollections/slice.rs | 380 ++++++++++----------- src/libcollections/string.rs | 10 +- src/libcollections/vec.rs | 88 ++--- src/libcollections/vec_map.rs | 40 +-- src/libcoretest/any.rs | 2 +- src/libcoretest/cell.rs | 22 +- src/libcoretest/clone.rs | 6 +- src/libcoretest/cmp.rs | 40 +-- src/libcoretest/finally.rs | 6 +- src/libcoretest/hash/mod.rs | 6 +- src/libcoretest/iter.rs | 180 +++++----- src/libcoretest/mem.rs | 16 +- src/libcoretest/nonzero.rs | 18 +- src/libcoretest/num/int_macros.rs | 4 +- src/libcoretest/num/mod.rs | 10 +- src/libcoretest/option.rs | 26 +- src/libcoretest/ptr.rs | 8 +- src/libcoretest/result.rs | 18 +- src/libcoretest/slice.rs | 20 +- src/libcoretest/tuple.rs | 8 +- src/liblog/lib.rs | 2 +- src/liblog/macros.rs | 4 +- src/librand/distributions/mod.rs | 50 +-- src/librand/distributions/range.rs | 4 +- src/librand/lib.rs | 6 +- src/librustc/lint/builtin.rs | 2 +- src/librustc_trans/save/span_utils.rs | 2 +- src/librustc_trans/trans/_match.rs | 2 +- src/librustc_trans/trans/foreign.rs | 4 +- src/librustc_trans/trans/tvec.rs | 2 +- src/libserialize/hex.rs | 2 +- src/libserialize/json.rs | 4 +- src/libstd/collections/hash/bench.rs | 20 +- src/libstd/collections/hash/map.rs | 94 ++--- src/libstd/collections/hash/set.rs | 62 ++-- src/libstd/collections/hash/table.rs | 2 +- src/libstd/fmt.rs | 16 +- src/libstd/macros.rs | 6 +- src/libstd/num/mod.rs | 46 +-- src/libstd/old_io/fs.rs | 4 +- src/libstd/old_io/net/tcp.rs | 10 +- src/libstd/old_io/process.rs | 2 +- src/libstd/os.rs | 2 +- src/libstd/rand/mod.rs | 28 +- src/libstd/sync/future.rs | 2 +- src/libstd/sync/mpsc/mod.rs | 46 +-- src/libstd/sync/mpsc/mpsc_queue.rs | 4 +- src/libstd/sync/mpsc/select.rs | 8 +- src/libstd/sync/mpsc/spsc_queue.rs | 16 +- src/libstd/sync/mutex.rs | 8 +- src/libstd/sync/once.rs | 2 +- src/libstd/sync/rwlock.rs | 14 +- src/libstd/sys/unix/process.rs | 2 +- src/libstd/sys/unix/stack_overflow.rs | 6 +- src/libstd/sys/windows/backtrace.rs | 2 +- src/libstd/sys/windows/stack_overflow.rs | 2 +- src/libstd/sys/windows/thread_local.rs | 2 +- src/libstd/tuple.rs | 10 +- src/test/auxiliary/issue-11224.rs | 2 +- src/test/auxiliary/issue-8044.rs | 2 +- src/test/auxiliary/issue-9906.rs | 2 +- src/test/auxiliary/macro_crate_test.rs | 6 +- src/test/bench/core-std.rs | 2 +- src/test/bench/shootout-meteor.rs | 22 +- src/test/bench/shootout-pfib.rs | 4 +- src/test/debuginfo/basic-types-metadata.rs | 2 +- src/test/debuginfo/box.rs | 4 +- src/test/debuginfo/closure-in-generic-function.rs | 4 +- .../debuginfo/destructured-for-loop-variable.rs | 2 +- src/test/debuginfo/destructured-local.rs | 16 +- src/test/debuginfo/function-arg-initialization.rs | 2 +- .../function-prologue-stepping-no-stack-check.rs | 2 +- .../function-prologue-stepping-regular.rs | 2 +- src/test/debuginfo/generic-function.rs | 4 +- src/test/debuginfo/generic-functions-nested.rs | 4 +- .../generic-static-method-on-struct-and-enum.rs | 4 +- src/test/debuginfo/generic-struct-style-enum.rs | 2 +- src/test/debuginfo/generic-struct.rs | 8 +- src/test/debuginfo/lexical-scope-in-for-loop.rs | 6 +- src/test/debuginfo/lexical-scope-in-if.rs | 14 +- src/test/debuginfo/lexical-scope-in-match.rs | 10 +- .../lexical-scope-in-parameterless-closure.rs | 2 +- .../lexical-scope-in-unconditional-loop.rs | 4 +- src/test/debuginfo/lexical-scope-in-while.rs | 4 +- src/test/debuginfo/lexical-scope-with-macro.rs | 10 +- .../lexical-scopes-in-block-expression.rs | 8 +- src/test/debuginfo/limited-debuginfo.rs | 2 +- .../multiple-functions-equal-var-names.rs | 6 +- src/test/debuginfo/multiple-functions.rs | 6 +- .../debuginfo/name-shadowing-and-scope-nesting.rs | 6 +- src/test/debuginfo/shadowed-argument.rs | 4 +- src/test/debuginfo/shadowed-variable.rs | 4 +- src/test/debuginfo/simple-lexical-scope.rs | 2 +- src/test/debuginfo/type-names.rs | 12 +- src/test/debuginfo/vec.rs | 2 +- src/test/pretty/block-disambig.rs | 12 +- src/test/pretty/issue-929.rs | 2 +- src/test/pretty/match-block-expr.rs | 2 +- src/test/pretty/match-naked-expr-medium.rs | 2 +- src/test/pretty/match-naked-expr.rs | 2 +- src/test/pretty/path-type-bounds.rs | 2 +- src/test/pretty/unary-op-disambig.rs | 4 +- src/test/pretty/vec-comments.pp | 24 +- src/test/pretty/vec-comments.rs | 24 +- src/test/run-fail/assert-eq-macro-panic.rs | 2 +- src/test/run-fail/assert-macro-fmt.rs | 2 +- src/test/run-fail/bounds-check-no-overflow.rs | 2 +- src/test/run-fail/divide-by-zero.rs | 4 +- src/test/run-fail/dst-raw-slice.rs | 2 +- src/test/run-fail/explicit-panic-msg.rs | 4 +- src/test/run-fail/expr-if-panic.rs | 2 +- src/test/run-fail/expr-match-panic.rs | 2 +- src/test/run-fail/issue-12920.rs | 2 +- src/test/run-fail/issue-3029.rs | 2 +- src/test/run-fail/mod-zero.rs | 4 +- src/test/run-fail/panic-macro-any.rs | 2 +- src/test/run-fail/panic-macro-fmt.rs | 2 +- src/test/run-fail/panic-task-name-none.rs | 2 +- src/test/run-fail/panic-task-name-owned.rs | 2 +- src/test/run-fail/unwind-interleaved.rs | 4 +- src/test/run-fail/unwind-unique.rs | 2 +- .../create_and_compile.rs | 2 +- src/test/run-make/static-unwinding/main.rs | 2 +- src/test/run-pass-fulldeps/issue-16992.rs | 4 +- .../macro-crate-does-hygiene-work.rs | 4 +- .../quote-unused-sp-no-warning.rs | 2 +- src/test/run-pass/assert-eq-macro-success.rs | 2 +- .../associated-types-binding-in-where-clause.rs | 2 +- src/test/run-pass/associated-types-bound.rs | 42 +-- src/test/run-pass/associated-types-cc.rs | 2 +- .../associated-types-nested-projections.rs | 4 +- .../associated-types-ref-in-struct-literal.rs | 2 +- src/test/run-pass/associated-types-return.rs | 4 +- src/test/run-pass/associated-types-sugar-path.rs | 2 +- src/test/run-pass/auto-instantiate.rs | 4 +- src/test/run-pass/auto-loop.rs | 2 +- src/test/run-pass/auto-ref-sliceable.rs | 2 +- src/test/run-pass/backtrace.rs | 4 +- src/test/run-pass/binary-minus-without-space.rs | 4 +- src/test/run-pass/bitv-perf-test.rs | 2 +- src/test/run-pass/bitwise.rs | 2 +- src/test/run-pass/block-expr-precedence.rs | 10 +- src/test/run-pass/block-iter-1.rs | 4 +- src/test/run-pass/block-iter-2.rs | 2 +- src/test/run-pass/borrow-tuple-fields.rs | 8 +- src/test/run-pass/borrowck-closures-two-imm.rs | 14 +- src/test/run-pass/borrowck-fixed-length-vecs.rs | 2 +- src/test/run-pass/borrowck-freeze-frozen-mut.rs | 2 +- .../run-pass/borrowck-pat-reassign-no-binding.rs | 2 +- .../run-pass/borrowed-ptr-pattern-infallible.rs | 2 +- src/test/run-pass/borrowed-ptr-pattern.rs | 2 +- src/test/run-pass/break.rs | 6 +- src/test/run-pass/bug-7183-generics.rs | 6 +- .../builtin-superkinds-capabilities-transitive.rs | 4 +- .../run-pass/builtin-superkinds-capabilities-xc.rs | 4 +- .../run-pass/builtin-superkinds-capabilities.rs | 4 +- src/test/run-pass/builtin-superkinds-self-type.rs | 4 +- src/test/run-pass/cci_iter_exe.rs | 2 +- src/test/run-pass/class-poly-methods.rs | 2 +- src/test/run-pass/cleanup-rvalue-scopes.rs | 4 +- src/test/run-pass/closure-inference2.rs | 4 +- src/test/run-pass/coerce-match-calls.rs | 4 +- src/test/run-pass/coerce-match.rs | 4 +- src/test/run-pass/complex.rs | 4 +- src/test/run-pass/concat.rs | 4 +- src/test/run-pass/const-binops.rs | 22 +- src/test/run-pass/const-bound.rs | 2 +- src/test/run-pass/const-expr-in-vec-repeat.rs | 2 +- src/test/run-pass/consts-in-patterns.rs | 8 +- src/test/run-pass/deref-lval.rs | 4 +- src/test/run-pass/deref-rc.rs | 2 +- src/test/run-pass/deriving-clone-generic-enum.rs | 2 +- src/test/run-pass/deriving-clone-generic-struct.rs | 2 +- .../deriving-clone-generic-tuple-struct.rs | 2 +- src/test/run-pass/deriving-cmp-generic-enum.rs | 8 +- .../run-pass/deriving-cmp-generic-struct-enum.rs | 12 +- src/test/run-pass/deriving-cmp-generic-struct.rs | 4 +- .../run-pass/deriving-cmp-generic-tuple-struct.rs | 4 +- src/test/run-pass/deriving-rand.rs | 2 +- src/test/run-pass/drop-trait-generic.rs | 2 +- src/test/run-pass/dst-raw.rs | 12 +- src/test/run-pass/dst-struct.rs | 2 +- src/test/run-pass/early-ret-binop-add.rs | 2 +- src/test/run-pass/early-vtbl-resolution.rs | 2 +- src/test/run-pass/else-if.rs | 20 +- .../run-pass/enum-nullable-simplifycfg-misopt.rs | 4 +- src/test/run-pass/enum-vec-initializer.rs | 8 +- src/test/run-pass/explicit-i-suffix.rs | 8 +- src/test/run-pass/expr-block-unique.rs | 2 +- src/test/run-pass/expr-block.rs | 2 +- src/test/run-pass/expr-empty-ret.rs | 2 +- src/test/run-pass/expr-fn.rs | 2 +- src/test/run-pass/expr-if-panic-all.rs | 2 +- src/test/run-pass/expr-if-panic.rs | 10 +- src/test/run-pass/expr-if-unique.rs | 4 +- src/test/run-pass/expr-match-panic-all.rs | 2 +- src/test/run-pass/expr-match-panic.rs | 4 +- src/test/run-pass/expr-match-unique.rs | 4 +- src/test/run-pass/fat-arrow-match.rs | 6 +- src/test/run-pass/fixed_length_copy.rs | 6 +- src/test/run-pass/fn-type-infer.rs | 2 +- src/test/run-pass/for-loop-goofiness.rs | 2 +- .../run-pass/foreach-external-iterators-break.rs | 4 +- ...ach-external-iterators-hashmap-break-restart.rs | 2 +- .../run-pass/foreach-external-iterators-hashmap.rs | 6 +- .../run-pass/foreach-external-iterators-loop.rs | 4 +- .../run-pass/foreach-external-iterators-nested.rs | 8 +- src/test/run-pass/foreach-external-iterators.rs | 4 +- src/test/run-pass/foreign-call-no-runtime.rs | 4 +- src/test/run-pass/generic-alias-unique.rs | 2 +- src/test/run-pass/generic-fn-unique.rs | 2 +- src/test/run-pass/generic-ivec-leak.rs | 2 +- src/test/run-pass/generic-newtype-struct.rs | 2 +- src/test/run-pass/generic-static-methods.rs | 2 +- src/test/run-pass/generic-tag-local.rs | 2 +- src/test/run-pass/generic-tup.rs | 4 +- src/test/run-pass/guards.rs | 8 +- src/test/run-pass/hygiene-dodging-1.rs | 2 +- src/test/run-pass/hygienic-labels-in-let.rs | 20 +- src/test/run-pass/hygienic-labels.rs | 10 +- src/test/run-pass/if-let.rs | 10 +- src/test/run-pass/ifmt.rs | 24 +- src/test/run-pass/ignore-all-the-things.rs | 16 +- src/test/run-pass/import-glob-crate.rs | 2 +- src/test/run-pass/import-in-block.rs | 4 +- src/test/run-pass/import4.rs | 2 +- .../run-pass/inferred-suffix-in-pattern-range.rs | 4 +- src/test/run-pass/init-res-into-things.rs | 12 +- src/test/run-pass/intrinsic-atomics.rs | 2 +- src/test/run-pass/intrinsic-move-val.rs | 2 +- src/test/run-pass/issue-10626.rs | 4 +- src/test/run-pass/issue-10638.rs | 2 +- src/test/run-pass/issue-11205.rs | 44 +-- src/test/run-pass/issue-11225-1.rs | 2 +- src/test/run-pass/issue-11225-2.rs | 2 +- src/test/run-pass/issue-11958.rs | 2 +- src/test/run-pass/issue-1257.rs | 2 +- src/test/run-pass/issue-12582.rs | 8 +- src/test/run-pass/issue-12744.rs | 2 +- src/test/run-pass/issue-12909.rs | 2 +- src/test/run-pass/issue-13027.rs | 84 ++--- src/test/run-pass/issue-13494.rs | 2 +- src/test/run-pass/issue-13867.rs | 26 +- src/test/run-pass/issue-14308.rs | 8 +- src/test/run-pass/issue-1460.rs | 2 +- src/test/run-pass/issue-14865.rs | 4 +- src/test/run-pass/issue-15080.rs | 2 +- src/test/run-pass/issue-15221.rs | 2 +- src/test/run-pass/issue-15571.rs | 10 +- src/test/run-pass/issue-15763.rs | 8 +- src/test/run-pass/issue-15924.rs | 2 +- src/test/run-pass/issue-16648.rs | 4 +- src/test/run-pass/issue-16774.rs | 2 +- src/test/run-pass/issue-17074.rs | 2 +- src/test/run-pass/issue-19244.rs | 4 +- src/test/run-pass/issue-19358.rs | 4 +- src/test/run-pass/issue-19367.rs | 2 +- src/test/run-pass/issue-2216.rs | 4 +- src/test/run-pass/issue-2383.rs | 2 +- src/test/run-pass/issue-2428.rs | 2 +- src/test/run-pass/issue-2633-2.rs | 2 +- src/test/run-pass/issue-2734.rs | 2 +- src/test/run-pass/issue-2735.rs | 2 +- src/test/run-pass/issue-2935.rs | 6 +- src/test/run-pass/issue-3091.rs | 4 +- src/test/run-pass/issue-3211.rs | 4 +- src/test/run-pass/issue-3290.rs | 2 +- src/test/run-pass/issue-333.rs | 2 +- src/test/run-pass/issue-3500.rs | 2 +- src/test/run-pass/issue-3559.rs | 4 +- src/test/run-pass/issue-3878.rs | 2 +- src/test/run-pass/issue-4387.rs | 2 +- src/test/run-pass/issue-4401.rs | 4 +- src/test/run-pass/issue-5708.rs | 2 +- src/test/run-pass/issue-6117.rs | 2 +- src/test/run-pass/issue-6318.rs | 2 +- src/test/run-pass/issue-7178.rs | 2 +- src/test/run-pass/issue-7575.rs | 2 +- src/test/run-pass/issue-7784.rs | 2 +- src/test/run-pass/issue-8044.rs | 2 +- src/test/run-pass/issue-8391.rs | 6 +- src/test/run-pass/issue-8460.rs | 4 +- src/test/run-pass/issue-8498.rs | 6 +- src/test/run-pass/issue-868.rs | 2 +- src/test/run-pass/issue-8827.rs | 2 +- src/test/run-pass/issue-8860.rs | 6 +- src/test/run-pass/issue-9719.rs | 6 +- src/test/run-pass/issue-9906.rs | 2 +- src/test/run-pass/issue-9942.rs | 2 +- src/test/run-pass/keyword-changes-2012-07-31.rs | 4 +- src/test/run-pass/kindck-owned-trait-contains-1.rs | 2 +- src/test/run-pass/labeled-break.rs | 4 +- src/test/run-pass/last-use-in-cap-clause.rs | 2 +- src/test/run-pass/last-use-is-capture.rs | 2 +- src/test/run-pass/lazy-and-or.rs | 2 +- src/test/run-pass/lazy-init.rs | 2 +- src/test/run-pass/let-var-hygiene.rs | 6 +- src/test/run-pass/linear-for-loop.rs | 4 +- src/test/run-pass/liveness-loop-break.rs | 2 +- src/test/run-pass/log-poly.rs | 4 +- src/test/run-pass/long-while.rs | 2 +- src/test/run-pass/loop-diverges.rs | 2 +- src/test/run-pass/loop-label-shadowing.rs | 2 +- .../run-pass/loop-no-reinit-needed-post-bot.rs | 2 +- src/test/run-pass/loop-scope.rs | 4 +- src/test/run-pass/macro-crate-def-only.rs | 2 +- src/test/run-pass/macro-export-inner-module.rs | 2 +- src/test/run-pass/macro-pat.rs | 24 +- src/test/run-pass/macro-stmt.rs | 8 +- src/test/run-pass/macro-with-attrs1.rs | 6 +- src/test/run-pass/macro-with-attrs2.rs | 6 +- src/test/run-pass/match-arm-statics.rs | 10 +- src/test/run-pass/match-bot-2.rs | 2 +- src/test/run-pass/match-naked-record-expr.rs | 2 +- src/test/run-pass/match-naked-record.rs | 2 +- src/test/run-pass/match-pattern-bindings.rs | 6 +- src/test/run-pass/match-pipe-binding.rs | 10 +- src/test/run-pass/match-range.rs | 2 +- src/test/run-pass/match-ref-binding-mut-option.rs | 2 +- src/test/run-pass/match-str.rs | 2 +- src/test/run-pass/match-unique-bind.rs | 2 +- src/test/run-pass/match-vec-alternatives.rs | 26 +- src/test/run-pass/match-vec-rvalue.rs | 2 +- .../method-two-trait-defer-resolution-1.rs | 18 +- .../method-two-trait-defer-resolution-2.rs | 2 +- src/test/run-pass/method-where-clause.rs | 18 +- .../monomorphized-callees-with-ty-params-3314.rs | 8 +- src/test/run-pass/multi-let.rs | 2 +- src/test/run-pass/multiple-trait-bounds.rs | 2 +- src/test/run-pass/mut-in-ident-patterns.rs | 4 +- ...mutability-inherits-through-fixed-length-vec.rs | 4 +- src/test/run-pass/negative.rs | 2 +- src/test/run-pass/nested-matchs.rs | 2 +- src/test/run-pass/new-box-syntax.rs | 8 +- src/test/run-pass/newtype-polymorphic.rs | 2 +- src/test/run-pass/numeric-method-autoexport.rs | 4 +- src/test/run-pass/object-one-type-two-traits.rs | 2 +- src/test/run-pass/operator-associativity.rs | 2 +- .../run-pass/out-of-stack-new-thread-no-split.rs | 2 +- src/test/run-pass/out-of-stack-no-split.rs | 2 +- src/test/run-pass/out-of-stack.rs | 2 +- src/test/run-pass/overloaded-autoderef-indexing.rs | 2 +- src/test/run-pass/overloaded-autoderef-order.rs | 4 +- src/test/run-pass/overloaded-autoderef-xcrate.rs | 2 +- src/test/run-pass/overloaded-autoderef.rs | 4 +- src/test/run-pass/overloaded-deref-count.rs | 4 +- src/test/run-pass/overloaded-deref.rs | 8 +- src/test/run-pass/overloaded-index-assoc-list.rs | 4 +- src/test/run-pass/owned-implies-static.rs | 2 +- src/test/run-pass/paren-free.rs | 2 +- src/test/run-pass/parse-complex-macro-invoc-op.rs | 22 +- src/test/run-pass/parse-panic.rs | 2 +- src/test/run-pass/priv-impl-prim-ty.rs | 2 +- src/test/run-pass/ptr-coercion.rs | 14 +- src/test/run-pass/range.rs | 4 +- .../reexported-static-methods-cross-crate.rs | 6 +- src/test/run-pass/regions-copy-closure.rs | 2 +- .../run-pass/regions-early-bound-trait-param.rs | 4 +- .../run-pass/regions-early-bound-used-in-bound.rs | 4 +- .../regions-early-bound-used-in-type-param.rs | 4 +- .../run-pass/regions-infer-borrow-scope-view.rs | 2 +- .../regions-infer-borrow-scope-within-loop-ok.rs | 2 +- .../run-pass/regions-return-interior-of-option.rs | 4 +- src/test/run-pass/regions-scope-chain-example.rs | 2 +- src/test/run-pass/repeated-vector-syntax.rs | 2 +- src/test/run-pass/resource-assign-is-not-copy.rs | 4 +- src/test/run-pass/self-re-assign.rs | 4 +- src/test/run-pass/seq-compare.rs | 18 +- src/test/run-pass/shadow.rs | 4 +- src/test/run-pass/shift.rs | 2 +- src/test/run-pass/simple-infer.rs | 2 +- src/test/run-pass/static-assert.rs | 6 +- src/test/run-pass/static-fn-inline-xc.rs | 2 +- src/test/run-pass/static-fn-trait-xc.rs | 2 +- src/test/run-pass/static-impl.rs | 6 +- src/test/run-pass/string-self-append.rs | 2 +- .../run-pass/struct-lit-functional-no-fields.rs | 4 +- src/test/run-pass/structured-compare.rs | 8 +- src/test/run-pass/supertrait-default-generics.rs | 2 +- src/test/run-pass/supported-cast.rs | 4 +- src/test/run-pass/swap-1.rs | 2 +- .../run-pass/tag-variant-disr-type-mismatch.rs | 2 +- src/test/run-pass/terminate-in-initializer.rs | 2 +- src/test/run-pass/trailing-comma.rs | 14 +- .../run-pass/trait-default-method-bound-subst.rs | 8 +- .../run-pass/trait-default-method-bound-subst2.rs | 2 +- .../run-pass/trait-default-method-bound-subst3.rs | 4 +- src/test/run-pass/trait-default-method-bound.rs | 2 +- src/test/run-pass/trait-default-method-xc-2.rs | 8 +- src/test/run-pass/trait-default-method-xc.rs | 24 +- src/test/run-pass/trait-generic.rs | 2 +- src/test/run-pass/trait-impl.rs | 2 +- src/test/run-pass/trait-inheritance-num.rs | 4 +- src/test/run-pass/trait-inheritance-num0.rs | 2 +- src/test/run-pass/trait-inheritance-num1.rs | 2 +- src/test/run-pass/trait-inheritance-num3.rs | 2 +- src/test/run-pass/trait-inheritance-num5.rs | 2 +- src/test/run-pass/trait-inheritance-visibility.rs | 2 +- src/test/run-pass/trait-to-str.rs | 6 +- src/test/run-pass/traits-conditional-dispatch.rs | 2 +- src/test/run-pass/trivial-message.rs | 2 +- src/test/run-pass/tuple-index-fat-types.rs | 4 +- src/test/run-pass/tuple-index.rs | 2 +- src/test/run-pass/type-param-constraints.rs | 12 +- src/test/run-pass/typestate-cfg-nesting.rs | 6 +- src/test/run-pass/typestate-multi-decl.rs | 2 +- ...res-infer-argument-types-from-expected-bound.rs | 2 +- ...fer-argument-types-from-expected-object-type.rs | 2 +- ...types-with-bound-regions-from-expected-bound.rs | 2 +- src/test/run-pass/unboxed-closures-prelude.rs | 4 +- .../unboxed-closures-static-call-fn-once.rs | 2 +- src/test/run-pass/unique-assign-copy.rs | 2 +- src/test/run-pass/unique-assign-drop.rs | 4 +- src/test/run-pass/unique-assign-generic.rs | 4 +- src/test/run-pass/unique-assign.rs | 2 +- src/test/run-pass/unique-autoderef-index.rs | 4 +- src/test/run-pass/unique-cmp.rs | 12 +- src/test/run-pass/unique-create.rs | 4 +- src/test/run-pass/unique-decl-init-copy.rs | 10 +- src/test/run-pass/unique-decl-init.rs | 2 +- src/test/run-pass/unique-decl-move.rs | 2 +- src/test/run-pass/unique-deref.rs | 2 +- src/test/run-pass/unique-drop-complex.rs | 2 +- src/test/run-pass/unique-fn-arg-move.rs | 2 +- src/test/run-pass/unique-in-vec-copy.rs | 2 +- src/test/run-pass/unique-in-vec.rs | 2 +- src/test/run-pass/unique-init.rs | 2 +- src/test/run-pass/unique-kinds.rs | 24 +- src/test/run-pass/unique-log.rs | 2 +- src/test/run-pass/unique-move-drop.rs | 4 +- src/test/run-pass/unique-move-temp.rs | 2 +- src/test/run-pass/unique-move.rs | 2 +- src/test/run-pass/unique-mutable.rs | 2 +- src/test/run-pass/unique-send.rs | 4 +- src/test/run-pass/unique-swap.rs | 8 +- src/test/run-pass/unreachable-code.rs | 2 +- src/test/run-pass/unused-move-capture.rs | 2 +- src/test/run-pass/unused-move.rs | 2 +- src/test/run-pass/unwind-unique.rs | 2 +- src/test/run-pass/use-uninit-match.rs | 2 +- src/test/run-pass/use-uninit-match2.rs | 2 +- src/test/run-pass/utf8_idents.rs | 24 +- src/test/run-pass/variadic-ffi.rs | 4 +- src/test/run-pass/vec-growth.rs | 10 +- src/test/run-pass/vec-macro-with-brackets.rs | 2 +- src/test/run-pass/vec-macro-with-trailing-comma.rs | 4 +- src/test/run-pass/vec-matching-autoslice.rs | 4 +- src/test/run-pass/vec-matching-fixed.rs | 2 +- src/test/run-pass/vec-matching-fold.rs | 6 +- .../vec-matching-legal-tail-element-borrow.rs | 2 +- src/test/run-pass/vec-matching.rs | 16 +- src/test/run-pass/vec-push.rs | 2 +- src/test/run-pass/vec-repeat-with-cast.rs | 2 +- src/test/run-pass/vec-slice.rs | 2 +- src/test/run-pass/vec-to_str.rs | 4 +- src/test/run-pass/vector-sort-panic-safe.rs | 12 +- src/test/run-pass/weird-exprs.rs | 8 +- src/test/run-pass/where-clause-region-outlives.rs | 4 +- src/test/run-pass/where-clauses-cross-crate.rs | 6 +- src/test/run-pass/where-clauses-lifetimes.rs | 2 +- src/test/run-pass/where-clauses-method.rs | 4 +- src/test/run-pass/where-clauses.rs | 6 +- src/test/run-pass/while-cont.rs | 2 +- src/test/run-pass/while-label.rs | 4 +- src/test/run-pass/while-let.rs | 12 +- 474 files changed, 1991 insertions(+), 1991 deletions(-) (limited to 'src/libstd') diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index f9f6de2df58..71f33feb8e1 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -35,7 +35,7 @@ //! use std::sync::Arc; //! use std::thread::Thread; //! -//! let five = Arc::new(5i); +//! let five = Arc::new(5); //! //! for _ in 0u..10 { //! let five = five.clone(); @@ -52,7 +52,7 @@ //! use std::sync::{Arc, Mutex}; //! use std::thread::Thread; //! -//! let five = Arc::new(Mutex::new(5i)); +//! let five = Arc::new(Mutex::new(5)); //! //! for _ in 0u..10 { //! let five = five.clone(); @@ -154,7 +154,7 @@ impl Arc { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] @@ -176,7 +176,7 @@ impl Arc { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// /// let weak_five = five.downgrade(); /// ``` @@ -221,7 +221,7 @@ impl Clone for Arc { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// /// five.clone(); /// ``` @@ -268,7 +268,7 @@ impl Arc { /// ``` /// use std::sync::Arc; /// - /// let mut five = Arc::new(5i); + /// let mut five = Arc::new(5); /// /// let mut_five = five.make_unique(); /// ``` @@ -304,14 +304,14 @@ impl Drop for Arc { /// use std::sync::Arc; /// /// { - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// /// // stuff /// /// drop(five); // explict drop /// } /// { - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// /// // stuff /// @@ -371,7 +371,7 @@ impl Weak { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// /// let weak_five = five.downgrade(); /// @@ -408,7 +408,7 @@ impl Clone for Weak { /// ``` /// use std::sync::Arc; /// - /// let weak_five = Arc::new(5i).downgrade(); + /// let weak_five = Arc::new(5).downgrade(); /// /// weak_five.clone(); /// ``` @@ -433,7 +433,7 @@ impl Drop for Weak { /// use std::sync::Arc; /// /// { - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// let weak_five = five.downgrade(); /// /// // stuff @@ -441,7 +441,7 @@ impl Drop for Weak { /// drop(weak_five); // explict drop /// } /// { - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// let weak_five = five.downgrade(); /// /// // stuff @@ -475,9 +475,9 @@ impl PartialEq for Arc { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// - /// five == Arc::new(5i); + /// five == Arc::new(5); /// ``` fn eq(&self, other: &Arc) -> bool { *(*self) == *(*other) } @@ -490,9 +490,9 @@ impl PartialEq for Arc { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// - /// five != Arc::new(5i); + /// five != Arc::new(5); /// ``` fn ne(&self, other: &Arc) -> bool { *(*self) != *(*other) } } @@ -507,9 +507,9 @@ impl PartialOrd for Arc { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// - /// five.partial_cmp(&Arc::new(5i)); + /// five.partial_cmp(&Arc::new(5)); /// ``` fn partial_cmp(&self, other: &Arc) -> Option { (**self).partial_cmp(&**other) @@ -524,9 +524,9 @@ impl PartialOrd for Arc { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// - /// five < Arc::new(5i); + /// five < Arc::new(5); /// ``` fn lt(&self, other: &Arc) -> bool { *(*self) < *(*other) } @@ -539,9 +539,9 @@ impl PartialOrd for Arc { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// - /// five <= Arc::new(5i); + /// five <= Arc::new(5); /// ``` fn le(&self, other: &Arc) -> bool { *(*self) <= *(*other) } @@ -554,9 +554,9 @@ impl PartialOrd for Arc { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// - /// five > Arc::new(5i); + /// five > Arc::new(5); /// ``` fn gt(&self, other: &Arc) -> bool { *(*self) > *(*other) } @@ -569,9 +569,9 @@ impl PartialOrd for Arc { /// ``` /// use std::sync::Arc; /// - /// let five = Arc::new(5i); + /// let five = Arc::new(5); /// - /// five >= Arc::new(5i); + /// five >= Arc::new(5); /// ``` fn ge(&self, other: &Arc) -> bool { *(*self) >= *(*other) } } @@ -719,14 +719,14 @@ mod tests { #[test] fn test_live() { - let x = Arc::new(5i); + let x = Arc::new(5); let y = x.downgrade(); assert!(y.upgrade().is_some()); } #[test] fn test_dead() { - let x = Arc::new(5i); + let x = Arc::new(5); let y = x.downgrade(); drop(x); assert!(y.upgrade().is_none()); diff --git a/src/liballoc/boxed_test.rs b/src/liballoc/boxed_test.rs index c47a771f60d..4ffb94e7a61 100644 --- a/src/liballoc/boxed_test.rs +++ b/src/liballoc/boxed_test.rs @@ -20,7 +20,7 @@ use std::boxed::BoxAny; #[test] fn test_owned_clone() { - let a = Box::new(5i); + let a = Box::new(5); let b: Box = a.clone(); assert!(a == b); } diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index 1fb6290c7a3..1d5637a6ad6 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -403,7 +403,7 @@ mod test { #[bench] fn alloc_owned_small(b: &mut Bencher) { b.iter(|| { - box 10i + box 10 }) } } diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index d41673f56ed..8a542e1b8cb 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -192,7 +192,7 @@ impl Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn new(value: T) -> Rc { @@ -217,7 +217,7 @@ impl Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// /// let weak_five = five.downgrade(); /// ``` @@ -247,7 +247,7 @@ pub fn strong_count(this: &Rc) -> uint { this.strong() } /// use std::rc; /// use std::rc::Rc; /// -/// let five = Rc::new(5i); +/// let five = Rc::new(5); /// /// rc::is_unique(&five); /// ``` @@ -329,7 +329,7 @@ impl Rc { /// ``` /// use std::rc::Rc; /// - /// let mut five = Rc::new(5i); + /// let mut five = Rc::new(5); /// /// let mut_five = five.make_unique(); /// ``` @@ -378,14 +378,14 @@ impl Drop for Rc { /// use std::rc::Rc; /// /// { - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// /// // stuff /// /// drop(five); // explict drop /// } /// { - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// /// // stuff /// @@ -425,7 +425,7 @@ impl Clone for Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// /// five.clone(); /// ``` @@ -466,9 +466,9 @@ impl PartialEq for Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// - /// five == Rc::new(5i); + /// five == Rc::new(5); /// ``` #[inline(always)] fn eq(&self, other: &Rc) -> bool { **self == **other } @@ -482,9 +482,9 @@ impl PartialEq for Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// - /// five != Rc::new(5i); + /// five != Rc::new(5); /// ``` #[inline(always)] fn ne(&self, other: &Rc) -> bool { **self != **other } @@ -504,9 +504,9 @@ impl PartialOrd for Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// - /// five.partial_cmp(&Rc::new(5i)); + /// five.partial_cmp(&Rc::new(5)); /// ``` #[inline(always)] fn partial_cmp(&self, other: &Rc) -> Option { @@ -522,9 +522,9 @@ impl PartialOrd for Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// - /// five < Rc::new(5i); + /// five < Rc::new(5); /// ``` #[inline(always)] fn lt(&self, other: &Rc) -> bool { **self < **other } @@ -538,9 +538,9 @@ impl PartialOrd for Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// - /// five <= Rc::new(5i); + /// five <= Rc::new(5); /// ``` #[inline(always)] fn le(&self, other: &Rc) -> bool { **self <= **other } @@ -554,9 +554,9 @@ impl PartialOrd for Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// - /// five > Rc::new(5i); + /// five > Rc::new(5); /// ``` #[inline(always)] fn gt(&self, other: &Rc) -> bool { **self > **other } @@ -570,9 +570,9 @@ impl PartialOrd for Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// - /// five >= Rc::new(5i); + /// five >= Rc::new(5); /// ``` #[inline(always)] fn ge(&self, other: &Rc) -> bool { **self >= **other } @@ -589,9 +589,9 @@ impl Ord for Rc { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// - /// five.partial_cmp(&Rc::new(5i)); + /// five.partial_cmp(&Rc::new(5)); /// ``` #[inline] fn cmp(&self, other: &Rc) -> Ordering { (**self).cmp(&**other) } @@ -653,7 +653,7 @@ impl Weak { /// ``` /// use std::rc::Rc; /// - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// /// let weak_five = five.downgrade(); /// @@ -682,7 +682,7 @@ impl Drop for Weak { /// use std::rc::Rc; /// /// { - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// let weak_five = five.downgrade(); /// /// // stuff @@ -690,7 +690,7 @@ impl Drop for Weak { /// drop(weak_five); // explict drop /// } /// { - /// let five = Rc::new(5i); + /// let five = Rc::new(5); /// let weak_five = five.downgrade(); /// /// // stuff @@ -726,7 +726,7 @@ impl Clone for Weak { /// ``` /// use std::rc::Rc; /// - /// let weak_five = Rc::new(5i).downgrade(); + /// let weak_five = Rc::new(5).downgrade(); /// /// weak_five.clone(); /// ``` @@ -789,7 +789,7 @@ mod tests { #[test] fn test_clone() { - let x = Rc::new(RefCell::new(5i)); + let x = Rc::new(RefCell::new(5)); let y = x.clone(); *x.borrow_mut() = 20; assert_eq!(*y.borrow(), 20); @@ -797,13 +797,13 @@ mod tests { #[test] fn test_simple() { - let x = Rc::new(5i); + let x = Rc::new(5); assert_eq!(*x, 5); } #[test] fn test_simple_clone() { - let x = Rc::new(5i); + let x = Rc::new(5); let y = x.clone(); assert_eq!(*x, 5); assert_eq!(*y, 5); @@ -811,20 +811,20 @@ mod tests { #[test] fn test_destructor() { - let x = Rc::new(box 5i); + let x = Rc::new(box 5); assert_eq!(**x, 5); } #[test] fn test_live() { - let x = Rc::new(5i); + let x = Rc::new(5); let y = x.downgrade(); assert!(y.upgrade().is_some()); } #[test] fn test_dead() { - let x = Rc::new(5i); + let x = Rc::new(5); let y = x.downgrade(); drop(x); assert!(y.upgrade().is_none()); diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index f717fc6075d..91ef2d17baa 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -212,7 +212,7 @@ impl BinaryHeap { /// /// ``` /// use std::collections::BinaryHeap; - /// let heap = BinaryHeap::from_vec(vec![9i, 1, 2, 7, 3, 2]); + /// let heap = BinaryHeap::from_vec(vec![9, 1, 2, 7, 3, 2]); /// ``` pub fn from_vec(vec: Vec) -> BinaryHeap { let mut heap = BinaryHeap { data: vec }; @@ -231,7 +231,7 @@ impl BinaryHeap { /// /// ``` /// use std::collections::BinaryHeap; - /// let heap = BinaryHeap::from_vec(vec![1i, 2, 3, 4]); + /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]); /// /// // Print 1, 2, 3, 4 in arbitrary order /// for x in heap.iter() { @@ -251,7 +251,7 @@ impl BinaryHeap { /// /// ``` /// use std::collections::BinaryHeap; - /// let heap = BinaryHeap::from_vec(vec![1i, 2, 3, 4]); + /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]); /// /// // Print 1, 2, 3, 4 in arbitrary order /// for x in heap.into_iter() { @@ -273,7 +273,7 @@ impl BinaryHeap { /// let mut heap = BinaryHeap::new(); /// assert_eq!(heap.peek(), None); /// - /// heap.push(1i); + /// heap.push(1); /// heap.push(5); /// heap.push(2); /// assert_eq!(heap.peek(), Some(&5)); @@ -356,7 +356,7 @@ impl BinaryHeap { /// /// ``` /// use std::collections::BinaryHeap; - /// let mut heap = BinaryHeap::from_vec(vec![1i, 3]); + /// let mut heap = BinaryHeap::from_vec(vec![1, 3]); /// /// assert_eq!(heap.pop(), Some(3)); /// assert_eq!(heap.pop(), Some(1)); @@ -380,7 +380,7 @@ impl BinaryHeap { /// ``` /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); - /// heap.push(3i); + /// heap.push(3); /// heap.push(5); /// heap.push(1); /// @@ -402,7 +402,7 @@ impl BinaryHeap { /// ``` /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); - /// heap.push(1i); + /// heap.push(1); /// heap.push(5); /// /// assert_eq!(heap.push_pop(3), 5); @@ -434,7 +434,7 @@ impl BinaryHeap { /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); /// - /// assert_eq!(heap.replace(1i), None); + /// assert_eq!(heap.replace(1), None); /// assert_eq!(heap.replace(3), Some(1)); /// assert_eq!(heap.len(), 1); /// assert_eq!(heap.peek(), Some(&3)); @@ -457,7 +457,7 @@ impl BinaryHeap { /// /// ``` /// use std::collections::BinaryHeap; - /// let heap = BinaryHeap::from_vec(vec![1i, 2, 3, 4, 5, 6, 7]); + /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4, 5, 6, 7]); /// let vec = heap.into_vec(); /// /// // Will print in some order @@ -475,12 +475,12 @@ impl BinaryHeap { /// ``` /// use std::collections::BinaryHeap; /// - /// let mut heap = BinaryHeap::from_vec(vec![1i, 2, 4, 5, 7]); + /// let mut heap = BinaryHeap::from_vec(vec![1, 2, 4, 5, 7]); /// heap.push(6); /// heap.push(3); /// /// let vec = heap.into_sorted_vec(); - /// assert_eq!(vec, vec![1i, 2, 3, 4, 5, 6, 7]); + /// assert_eq!(vec, vec![1, 2, 3, 4, 5, 6, 7]); /// ``` pub fn into_sorted_vec(mut self) -> Vec { let mut end = self.len(); @@ -676,8 +676,8 @@ mod tests { #[test] fn test_iterator() { - let data = vec!(5i, 9, 3); - let iterout = [9i, 5, 3]; + let data = vec!(5, 9, 3); + let iterout = [9, 5, 3]; let heap = BinaryHeap::from_vec(data); let mut i = 0; for el in heap.iter() { @@ -688,8 +688,8 @@ mod tests { #[test] fn test_iterator_reverse() { - let data = vec!(5i, 9, 3); - let iterout = vec!(3i, 5, 9); + let data = vec!(5, 9, 3); + let iterout = vec!(3, 5, 9); let pq = BinaryHeap::from_vec(data); let v: Vec = pq.iter().rev().map(|&x| x).collect(); @@ -698,8 +698,8 @@ mod tests { #[test] fn test_move_iter() { - let data = vec!(5i, 9, 3); - let iterout = vec!(9i, 5, 3); + let data = vec!(5, 9, 3); + let iterout = vec!(9, 5, 3); let pq = BinaryHeap::from_vec(data); let v: Vec = pq.into_iter().collect(); @@ -708,16 +708,16 @@ mod tests { #[test] fn test_move_iter_size_hint() { - let data = vec!(5i, 9); + let data = vec!(5, 9); let pq = BinaryHeap::from_vec(data); let mut it = pq.into_iter(); assert_eq!(it.size_hint(), (2, Some(2))); - assert_eq!(it.next(), Some(9i)); + assert_eq!(it.next(), Some(9)); assert_eq!(it.size_hint(), (1, Some(1))); - assert_eq!(it.next(), Some(5i)); + assert_eq!(it.next(), Some(5)); assert_eq!(it.size_hint(), (0, Some(0))); assert_eq!(it.next(), None); @@ -725,8 +725,8 @@ mod tests { #[test] fn test_move_iter_reverse() { - let data = vec!(5i, 9, 3); - let iterout = vec!(3i, 5, 9); + let data = vec!(5, 9, 3); + let iterout = vec!(3, 5, 9); let pq = BinaryHeap::from_vec(data); let v: Vec = pq.into_iter().rev().collect(); @@ -747,7 +747,7 @@ mod tests { #[test] fn test_push() { - let mut heap = BinaryHeap::from_vec(vec!(2i, 4, 9)); + let mut heap = BinaryHeap::from_vec(vec!(2, 4, 9)); assert_eq!(heap.len(), 3); assert!(*heap.peek().unwrap() == 9); heap.push(11); @@ -769,7 +769,7 @@ mod tests { #[test] fn test_push_unique() { - let mut heap = BinaryHeap::from_vec(vec!(box 2i, box 4, box 9)); + let mut heap = BinaryHeap::from_vec(vec!(box 2, box 4, box 9)); assert_eq!(heap.len(), 3); assert!(*heap.peek().unwrap() == box 9); heap.push(box 11); @@ -791,7 +791,7 @@ mod tests { #[test] fn test_push_pop() { - let mut heap = BinaryHeap::from_vec(vec!(5i, 5, 2, 1, 3)); + let mut heap = BinaryHeap::from_vec(vec!(5, 5, 2, 1, 3)); assert_eq!(heap.len(), 5); assert_eq!(heap.push_pop(6), 6); assert_eq!(heap.len(), 5); @@ -805,7 +805,7 @@ mod tests { #[test] fn test_replace() { - let mut heap = BinaryHeap::from_vec(vec!(5i, 5, 2, 1, 3)); + let mut heap = BinaryHeap::from_vec(vec!(5, 5, 2, 1, 3)); assert_eq!(heap.len(), 5); assert_eq!(heap.replace(6).unwrap(), 5); assert_eq!(heap.len(), 5); @@ -830,18 +830,18 @@ mod tests { #[test] fn test_to_vec() { check_to_vec(vec!()); - check_to_vec(vec!(5i)); - check_to_vec(vec!(3i, 2)); - check_to_vec(vec!(2i, 3)); - check_to_vec(vec!(5i, 1, 2)); - check_to_vec(vec!(1i, 100, 2, 3)); - check_to_vec(vec!(1i, 3, 5, 7, 9, 2, 4, 6, 8, 0)); - check_to_vec(vec!(2i, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1)); - check_to_vec(vec!(9i, 11, 9, 9, 9, 9, 11, 2, 3, 4, 11, 9, 0, 0, 0, 0)); - check_to_vec(vec!(0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); - check_to_vec(vec!(10i, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)); - check_to_vec(vec!(0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 1, 2)); - check_to_vec(vec!(5i, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1)); + check_to_vec(vec!(5)); + check_to_vec(vec!(3, 2)); + check_to_vec(vec!(2, 3)); + check_to_vec(vec!(5, 1, 2)); + check_to_vec(vec!(1, 100, 2, 3)); + check_to_vec(vec!(1, 3, 5, 7, 9, 2, 4, 6, 8, 0)); + check_to_vec(vec!(2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1)); + check_to_vec(vec!(9, 11, 9, 9, 9, 9, 11, 2, 3, 4, 11, 9, 0, 0, 0, 0)); + check_to_vec(vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); + check_to_vec(vec!(10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)); + check_to_vec(vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 1, 2)); + check_to_vec(vec!(5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 5, 4, 3, 2, 1)); } #[test] diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 4f2c2cb6028..2ab2a499e73 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1782,7 +1782,7 @@ mod test { #[test] fn test_entry(){ - let xs = [(1i, 10i), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)]; + let xs = [(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)]; let mut map: BTreeMap = xs.iter().map(|&x| x).collect(); diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index a090e4f24ce..a99af5a549d 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -282,7 +282,7 @@ impl BTreeSet { /// /// let mut v = BTreeSet::new(); /// assert_eq!(v.len(), 0); - /// v.insert(1i); + /// v.insert(1); /// assert_eq!(v.len(), 1); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -297,7 +297,7 @@ impl BTreeSet { /// /// let mut v = BTreeSet::new(); /// assert!(v.is_empty()); - /// v.insert(1i); + /// v.insert(1); /// assert!(!v.is_empty()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -311,7 +311,7 @@ impl BTreeSet { /// use std::collections::BTreeSet; /// /// let mut v = BTreeSet::new(); - /// v.insert(1i); + /// v.insert(1); /// v.clear(); /// assert!(v.is_empty()); /// ``` @@ -331,7 +331,7 @@ impl BTreeSet { /// ``` /// use std::collections::BTreeSet; /// - /// let set: BTreeSet = [1i, 2, 3].iter().map(|&x| x).collect(); + /// let set: BTreeSet = [1, 2, 3].iter().map(|&x| x).collect(); /// assert_eq!(set.contains(&1), true); /// assert_eq!(set.contains(&4), false); /// ``` @@ -348,7 +348,7 @@ impl BTreeSet { /// ``` /// use std::collections::BTreeSet; /// - /// let a: BTreeSet = [1i, 2, 3].iter().map(|&x| x).collect(); + /// let a: BTreeSet = [1, 2, 3].iter().map(|&x| x).collect(); /// let mut b: BTreeSet = BTreeSet::new(); /// /// assert_eq!(a.is_disjoint(&b), true); @@ -369,7 +369,7 @@ impl BTreeSet { /// ``` /// use std::collections::BTreeSet; /// - /// let sup: BTreeSet = [1i, 2, 3].iter().map(|&x| x).collect(); + /// let sup: BTreeSet = [1, 2, 3].iter().map(|&x| x).collect(); /// let mut set: BTreeSet = BTreeSet::new(); /// /// assert_eq!(set.is_subset(&sup), true); @@ -411,7 +411,7 @@ impl BTreeSet { /// ``` /// use std::collections::BTreeSet; /// - /// let sub: BTreeSet = [1i, 2].iter().map(|&x| x).collect(); + /// let sub: BTreeSet = [1, 2].iter().map(|&x| x).collect(); /// let mut set: BTreeSet = BTreeSet::new(); /// /// assert_eq!(set.is_superset(&sub), false); @@ -438,8 +438,8 @@ impl BTreeSet { /// /// let mut set = BTreeSet::new(); /// - /// assert_eq!(set.insert(2i), true); - /// assert_eq!(set.insert(2i), false); + /// assert_eq!(set.insert(2), true); + /// assert_eq!(set.insert(2), false); /// assert_eq!(set.len(), 1); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -461,7 +461,7 @@ impl BTreeSet { /// /// let mut set = BTreeSet::new(); /// - /// set.insert(2i); + /// set.insert(2); /// assert_eq!(set.remove(&2), true); /// assert_eq!(set.remove(&2), false); /// ``` @@ -731,7 +731,7 @@ mod test { fn test_clone_eq() { let mut m = BTreeSet::new(); - m.insert(1i); + m.insert(1); m.insert(2); assert!(m.clone() == m); @@ -742,11 +742,11 @@ mod test { let mut x = BTreeSet::new(); let mut y = BTreeSet::new(); - x.insert(1i); + x.insert(1); x.insert(2); x.insert(3); - y.insert(3i); + y.insert(3); y.insert(2); y.insert(1); @@ -874,7 +874,7 @@ mod test { #[test] fn test_from_iter() { - let xs = [1i, 2, 3, 4, 5, 6, 7, 8, 9]; + let xs = [1, 2, 3, 4, 5, 6, 7, 8, 9]; let set: BTreeSet = xs.iter().map(|&x| x).collect(); diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index aded4b8a7ac..57867b44893 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -235,9 +235,9 @@ impl DList { /// /// let mut a = DList::new(); /// let mut b = DList::new(); - /// a.push_back(1i); + /// a.push_back(1); /// a.push_back(2); - /// b.push_back(3i); + /// b.push_back(3); /// b.push_back(4); /// /// a.append(&mut b); @@ -529,7 +529,7 @@ impl DList { /// use std::collections::DList; /// /// let mut d = DList::new(); - /// d.push_back(1i); + /// d.push_back(1); /// d.push_back(3); /// assert_eq!(3, *d.back().unwrap()); /// ``` @@ -548,7 +548,7 @@ impl DList { /// /// let mut d = DList::new(); /// assert_eq!(d.pop_back(), None); - /// d.push_back(1i); + /// d.push_back(1); /// d.push_back(3); /// assert_eq!(d.pop_back(), Some(3)); /// ``` @@ -766,7 +766,7 @@ impl<'a, A> IterMut<'a, A> { /// } /// { /// let vec: Vec = list.into_iter().collect(); - /// assert_eq!(vec, vec![1i, 2, 3, 4]); + /// assert_eq!(vec, vec![1, 2, 3, 4]); /// } /// ``` #[inline] @@ -964,7 +964,7 @@ mod tests { assert_eq!(m.pop_front(), Some(box 1)); let mut n = DList::new(); - n.push_front(2i); + n.push_front(2); n.push_front(3); { assert_eq!(n.front().unwrap(), &3); @@ -984,7 +984,7 @@ mod tests { #[cfg(test)] fn generate_test() -> DList { - list_from(&[0i,1,2,3,4,5,6]) + list_from(&[0,1,2,3,4,5,6]) } #[cfg(test)] @@ -1007,7 +1007,7 @@ mod tests { { let mut m = DList::new(); let mut n = DList::new(); - n.push_back(2i); + n.push_back(2); m.append(&mut n); check_links(&m); assert_eq!(m.len(), 1); @@ -1019,7 +1019,7 @@ mod tests { { let mut m = DList::new(); let mut n = DList::new(); - m.push_back(2i); + m.push_back(2); m.append(&mut n); check_links(&m); assert_eq!(m.len(), 1); @@ -1028,8 +1028,8 @@ mod tests { } // Non-empty to non-empty - let v = vec![1i,2,3,4,5]; - let u = vec![9i,8,1,2,3,4,5]; + let v = vec![1,2,3,4,5]; + let u = vec![9,8,1,2,3,4,5]; let mut m = list_from(v.as_slice()); let mut n = list_from(u.as_slice()); m.append(&mut n); @@ -1054,7 +1054,7 @@ mod tests { // singleton { let mut m = DList::new(); - m.push_back(1i); + m.push_back(1); let p = m.split_off(0); assert_eq!(m.len(), 0); @@ -1065,29 +1065,29 @@ mod tests { // not singleton, forwards { - let u = vec![1i,2,3,4,5]; + let u = vec![1,2,3,4,5]; let mut m = list_from(u.as_slice()); let mut n = m.split_off(2); assert_eq!(m.len(), 2); assert_eq!(n.len(), 3); - for elt in 1i..3 { + for elt in 1..3 { assert_eq!(m.pop_front(), Some(elt)); } - for elt in 3i..6 { + for elt in 3..6 { assert_eq!(n.pop_front(), Some(elt)); } } // not singleton, backwards { - let u = vec![1i,2,3,4,5]; + let u = vec![1,2,3,4,5]; let mut m = list_from(u.as_slice()); let mut n = m.split_off(4); assert_eq!(m.len(), 4); assert_eq!(n.len(), 1); - for elt in 1i..5 { + for elt in 1..5 { assert_eq!(m.pop_front(), Some(elt)); } - for elt in 5i..6 { + for elt in 5..6 { assert_eq!(n.pop_front(), Some(elt)); } } @@ -1102,7 +1102,7 @@ mod tests { } let mut n = DList::new(); assert_eq!(n.iter().next(), None); - n.push_front(4i); + n.push_front(4); let mut it = n.iter(); assert_eq!(it.size_hint(), (1, Some(1))); assert_eq!(it.next().unwrap(), &4); @@ -1113,7 +1113,7 @@ mod tests { #[test] fn test_iterator_clone() { let mut n = DList::new(); - n.push_back(2i); + n.push_back(2); n.push_back(3); n.push_back(4); let mut it = n.iter(); @@ -1128,7 +1128,7 @@ mod tests { fn test_iterator_double_end() { let mut n = DList::new(); assert_eq!(n.iter().next(), None); - n.push_front(4i); + n.push_front(4); n.push_front(5); n.push_front(6); let mut it = n.iter(); @@ -1150,7 +1150,7 @@ mod tests { } let mut n = DList::new(); assert_eq!(n.iter().rev().next(), None); - n.push_front(4i); + n.push_front(4); let mut it = n.iter().rev(); assert_eq!(it.size_hint(), (1, Some(1))); assert_eq!(it.next().unwrap(), &4); @@ -1169,7 +1169,7 @@ mod tests { assert_eq!(len, 0); let mut n = DList::new(); assert!(n.iter_mut().next().is_none()); - n.push_front(4i); + n.push_front(4); n.push_back(5); let mut it = n.iter_mut(); assert_eq!(it.size_hint(), (2, Some(2))); @@ -1183,7 +1183,7 @@ mod tests { fn test_iterator_mut_double_end() { let mut n = DList::new(); assert!(n.iter_mut().next_back().is_none()); - n.push_front(4i); + n.push_front(4); n.push_front(5); n.push_front(6); let mut it = n.iter_mut(); @@ -1199,7 +1199,7 @@ mod tests { #[test] fn test_insert_prev() { - let mut m = list_from(&[0i,2,4,6,8]); + let mut m = list_from(&[0,2,4,6,8]); let len = m.len(); { let mut it = m.iter_mut(); @@ -1232,7 +1232,7 @@ mod tests { } let mut n = DList::new(); assert!(n.iter_mut().rev().next().is_none()); - n.push_front(4i); + n.push_front(4); let mut it = n.iter_mut().rev(); assert!(it.next().is_some()); assert!(it.next().is_none()); @@ -1240,7 +1240,7 @@ mod tests { #[test] fn test_send() { - let n = list_from(&[1i,2,3]); + let n = list_from(&[1,2,3]); Thread::scoped(move || { check_links(&n); let a: &[_] = &[&1,&2,&3]; @@ -1258,8 +1258,8 @@ mod tests { m.push_back(1); assert!(n == m); - let n = list_from(&[2i,3,4]); - let m = list_from(&[1i,2,3]); + let n = list_from(&[2,3,4]); + let m = list_from(&[1,2,3]); assert!(n != m); } @@ -1270,11 +1270,11 @@ mod tests { assert!(hash::hash::<_, SipHasher>(&x) == hash::hash::<_, SipHasher>(&y)); - x.push_back(1i); + x.push_back(1); x.push_back(2); x.push_back(3); - y.push_front(3i); + y.push_front(3); y.push_front(2); y.push_front(1); @@ -1284,7 +1284,7 @@ mod tests { #[test] fn test_ord() { let n: DList = list_from(&[]); - let m = list_from(&[1i,2,3]); + let m = list_from(&[1,2,3]); assert!(n < m); assert!(m > n); assert!(n <= n); @@ -1334,7 +1334,7 @@ mod tests { #[test] fn test_show() { - let list: DList = (0i..10).collect(); + let list: DList = (0..10).collect(); assert_eq!(format!("{:?}", list), "DList [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"); let list: DList<&str> = vec!["just", "one", "test", "more"].iter() @@ -1384,7 +1384,7 @@ mod tests { #[bench] fn bench_collect_into(b: &mut test::Bencher) { - let v = &[0i; 64]; + let v = &[0; 64]; b.iter(|| { let _: DList = v.iter().map(|x| *x).collect(); }) @@ -1426,7 +1426,7 @@ mod tests { #[bench] fn bench_iter(b: &mut test::Bencher) { - let v = &[0i; 128]; + let v = &[0; 128]; let m: DList = v.iter().map(|&x|x).collect(); b.iter(|| { assert!(m.iter().count() == 128); @@ -1434,7 +1434,7 @@ mod tests { } #[bench] fn bench_iter_mut(b: &mut test::Bencher) { - let v = &[0i; 128]; + let v = &[0; 128]; let mut m: DList = v.iter().map(|&x|x).collect(); b.iter(|| { assert!(m.iter_mut().count() == 128); @@ -1442,7 +1442,7 @@ mod tests { } #[bench] fn bench_iter_rev(b: &mut test::Bencher) { - let v = &[0i; 128]; + let v = &[0; 128]; let m: DList = v.iter().map(|&x|x).collect(); b.iter(|| { assert!(m.iter().rev().count() == 128); @@ -1450,7 +1450,7 @@ mod tests { } #[bench] fn bench_iter_mut_rev(b: &mut test::Bencher) { - let v = &[0i; 128]; + let v = &[0; 128]; let mut m: DList = v.iter().map(|&x|x).collect(); b.iter(|| { assert!(m.iter_mut().rev().count() == 128); diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index 34910f59fe0..c1855a469c1 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -186,7 +186,7 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); - /// buf.push_back(3i); + /// buf.push_back(3); /// buf.push_back(4); /// buf.push_back(5); /// assert_eq!(buf.get(1).unwrap(), &4); @@ -209,7 +209,7 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); - /// buf.push_back(3i); + /// buf.push_back(3); /// buf.push_back(4); /// buf.push_back(5); /// match buf.get_mut(1) { @@ -243,7 +243,7 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); - /// buf.push_back(3i); + /// buf.push_back(3); /// buf.push_back(4); /// buf.push_back(5); /// buf.swap(0, 2); @@ -269,7 +269,7 @@ impl RingBuf { /// ``` /// use std::collections::RingBuf; /// - /// let buf: RingBuf = RingBuf::with_capacity(10); + /// let buf: RingBuf = RingBuf::with_capacity(10); /// assert!(buf.capacity() >= 10); /// ``` #[inline] @@ -292,7 +292,7 @@ impl RingBuf { /// ``` /// use std::collections::RingBuf; /// - /// let mut buf: RingBuf = vec![1].into_iter().collect(); + /// let mut buf: RingBuf = vec![1].into_iter().collect(); /// buf.reserve_exact(10); /// assert!(buf.capacity() >= 11); /// ``` @@ -313,7 +313,7 @@ impl RingBuf { /// ``` /// use std::collections::RingBuf; /// - /// let mut buf: RingBuf = vec![1].into_iter().collect(); + /// let mut buf: RingBuf = vec![1].into_iter().collect(); /// buf.reserve(10); /// assert!(buf.capacity() >= 11); /// ``` @@ -473,8 +473,8 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); - /// buf.push_back(5i); - /// buf.push_back(10i); + /// buf.push_back(5); + /// buf.push_back(10); /// buf.push_back(15); /// buf.truncate(1); /// assert_eq!(buf.len(), 1); @@ -496,11 +496,11 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); - /// buf.push_back(5i); + /// buf.push_back(5); /// buf.push_back(3); /// buf.push_back(4); /// let b: &[_] = &[&5, &3, &4]; - /// assert_eq!(buf.iter().collect::>().as_slice(), b); + /// assert_eq!(buf.iter().collect::>().as_slice(), b); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn iter(&self) -> Iter { @@ -519,14 +519,14 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); - /// buf.push_back(5i); + /// buf.push_back(5); /// buf.push_back(3); /// buf.push_back(4); /// for num in buf.iter_mut() { /// *num = *num - 2; /// } /// let b: &[_] = &[&mut 3, &mut 1, &mut 2]; - /// assert_eq!(&buf.iter_mut().collect::>()[], b); + /// assert_eq!(&buf.iter_mut().collect::>()[], b); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T> { @@ -600,7 +600,7 @@ impl RingBuf { /// /// let mut v = RingBuf::new(); /// assert_eq!(v.len(), 0); - /// v.push_back(1i); + /// v.push_back(1); /// assert_eq!(v.len(), 1); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -615,7 +615,7 @@ impl RingBuf { /// /// let mut v = RingBuf::new(); /// assert!(v.is_empty()); - /// v.push_front(1i); + /// v.push_front(1); /// assert!(!v.is_empty()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -630,7 +630,7 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut v = RingBuf::new(); - /// v.push_back(1i); + /// v.push_back(1); /// assert_eq!(v.drain().next(), Some(1)); /// assert!(v.is_empty()); /// ``` @@ -651,7 +651,7 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut v = RingBuf::new(); - /// v.push_back(1i); + /// v.push_back(1); /// v.clear(); /// assert!(v.is_empty()); /// ``` @@ -672,9 +672,9 @@ impl RingBuf { /// let mut d = RingBuf::new(); /// assert_eq!(d.front(), None); /// - /// d.push_back(1i); - /// d.push_back(2i); - /// assert_eq!(d.front(), Some(&1i)); + /// d.push_back(1); + /// d.push_back(2); + /// assert_eq!(d.front(), Some(&1)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn front(&self) -> Option<&T> { @@ -692,13 +692,13 @@ impl RingBuf { /// let mut d = RingBuf::new(); /// assert_eq!(d.front_mut(), None); /// - /// d.push_back(1i); - /// d.push_back(2i); + /// d.push_back(1); + /// d.push_back(2); /// match d.front_mut() { - /// Some(x) => *x = 9i, + /// Some(x) => *x = 9, /// None => (), /// } - /// assert_eq!(d.front(), Some(&9i)); + /// assert_eq!(d.front(), Some(&9)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn front_mut(&mut self) -> Option<&mut T> { @@ -716,9 +716,9 @@ impl RingBuf { /// let mut d = RingBuf::new(); /// assert_eq!(d.back(), None); /// - /// d.push_back(1i); - /// d.push_back(2i); - /// assert_eq!(d.back(), Some(&2i)); + /// d.push_back(1); + /// d.push_back(2); + /// assert_eq!(d.back(), Some(&2)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn back(&self) -> Option<&T> { @@ -736,13 +736,13 @@ impl RingBuf { /// let mut d = RingBuf::new(); /// assert_eq!(d.back(), None); /// - /// d.push_back(1i); - /// d.push_back(2i); + /// d.push_back(1); + /// d.push_back(2); /// match d.back_mut() { - /// Some(x) => *x = 9i, + /// Some(x) => *x = 9, /// None => (), /// } - /// assert_eq!(d.back(), Some(&9i)); + /// assert_eq!(d.back(), Some(&9)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn back_mut(&mut self) -> Option<&mut T> { @@ -759,11 +759,11 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut d = RingBuf::new(); - /// d.push_back(1i); - /// d.push_back(2i); + /// d.push_back(1); + /// d.push_back(2); /// - /// assert_eq!(d.pop_front(), Some(1i)); - /// assert_eq!(d.pop_front(), Some(2i)); + /// assert_eq!(d.pop_front(), Some(1)); + /// assert_eq!(d.pop_front(), Some(2)); /// assert_eq!(d.pop_front(), None); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -785,9 +785,9 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut d = RingBuf::new(); - /// d.push_front(1i); - /// d.push_front(2i); - /// assert_eq!(d.front(), Some(&2i)); + /// d.push_front(1); + /// d.push_front(2); + /// assert_eq!(d.front(), Some(&2)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn push_front(&mut self, t: T) { @@ -809,7 +809,7 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); - /// buf.push_back(1i); + /// buf.push_back(1); /// buf.push_back(3); /// assert_eq!(3, *buf.back().unwrap()); /// ``` @@ -835,7 +835,7 @@ impl RingBuf { /// /// let mut buf = RingBuf::new(); /// assert_eq!(buf.pop_back(), None); - /// buf.push_back(1i); + /// buf.push_back(1); /// buf.push_back(3); /// assert_eq!(buf.pop_back(), Some(3)); /// ``` @@ -869,7 +869,7 @@ impl RingBuf { /// /// let mut buf = RingBuf::new(); /// assert_eq!(buf.swap_back_remove(0), None); - /// buf.push_back(5i); + /// buf.push_back(5); /// buf.push_back(99); /// buf.push_back(15); /// buf.push_back(20); @@ -902,11 +902,11 @@ impl RingBuf { /// /// let mut buf = RingBuf::new(); /// assert_eq!(buf.swap_front_remove(0), None); - /// buf.push_back(15i); + /// buf.push_back(15); /// buf.push_back(5); /// buf.push_back(10); /// buf.push_back(99); - /// buf.push_back(20i); + /// buf.push_back(20); /// assert_eq!(buf.swap_front_remove(3), Some(99)); /// ``` #[unstable(feature = "collections", @@ -934,7 +934,7 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); - /// buf.push_back(10i); + /// buf.push_back(10); /// buf.push_back(12); /// buf.insert(1,11); /// assert_eq!(Some(&11), buf.get(1)); @@ -1136,9 +1136,9 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); - /// buf.push_back(5i); - /// buf.push_back(10i); - /// buf.push_back(12i); + /// buf.push_back(5); + /// buf.push_back(10); + /// buf.push_back(12); /// buf.push_back(15); /// buf.remove(2); /// assert_eq!(Some(&15), buf.get(2)); @@ -1301,8 +1301,8 @@ impl RingBuf { /// use std::collections::RingBuf; /// /// let mut buf = RingBuf::new(); - /// buf.push_back(5i); - /// buf.push_back(10i); + /// buf.push_back(5); + /// buf.push_back(10); /// buf.push_back(15); /// buf.resize(2, 0); /// buf.resize(6, 20); @@ -1650,8 +1650,8 @@ mod tests { fn test_simple() { let mut d = RingBuf::new(); assert_eq!(d.len(), 0u); - d.push_front(17i); - d.push_front(42i); + d.push_front(17); + d.push_front(42); d.push_back(137); assert_eq!(d.len(), 3u); d.push_back(137); @@ -1769,7 +1769,7 @@ mod tests { fn bench_push_back_100(b: &mut test::Bencher) { let mut deq = RingBuf::with_capacity(101); b.iter(|| { - for i in 0i..100 { + for i in 0..100 { deq.push_back(i); } deq.head = 0; @@ -1781,7 +1781,7 @@ mod tests { fn bench_push_front_100(b: &mut test::Bencher) { let mut deq = RingBuf::with_capacity(101); b.iter(|| { - for i in 0i..100 { + for i in 0..100 { deq.push_front(i); } deq.head = 0; @@ -1791,7 +1791,7 @@ mod tests { #[bench] fn bench_pop_back_100(b: &mut test::Bencher) { - let mut deq: RingBuf = RingBuf::with_capacity(101); + let mut deq: RingBuf = RingBuf::with_capacity(101); b.iter(|| { deq.head = 100; @@ -1804,7 +1804,7 @@ mod tests { #[bench] fn bench_pop_front_100(b: &mut test::Bencher) { - let mut deq: RingBuf = RingBuf::with_capacity(101); + let mut deq: RingBuf = RingBuf::with_capacity(101); b.iter(|| { deq.head = 100; @@ -1819,7 +1819,7 @@ mod tests { fn bench_grow_1025(b: &mut test::Bencher) { b.iter(|| { let mut deq = RingBuf::new(); - for i in 0i..1025 { + for i in 0..1025 { deq.push_front(i); } test::black_box(deq); @@ -1828,7 +1828,7 @@ mod tests { #[bench] fn bench_iter_1000(b: &mut test::Bencher) { - let ring: RingBuf = (0i..1000).collect(); + let ring: RingBuf = (0..1000).collect(); b.iter(|| { let mut sum = 0; @@ -1841,7 +1841,7 @@ mod tests { #[bench] fn bench_mut_iter_1000(b: &mut test::Bencher) { - let mut ring: RingBuf = (0i..1000).collect(); + let mut ring: RingBuf = (0..1000).collect(); b.iter(|| { let mut sum = 0; @@ -1854,28 +1854,28 @@ mod tests { #[derive(Clone, PartialEq, Debug)] enum Taggy { - One(int), - Two(int, int), - Three(int, int, int), + One(i32), + Two(i32, i32), + Three(i32, i32, i32), } #[derive(Clone, PartialEq, Debug)] enum Taggypar { - Onepar(int), - Twopar(int, int), - Threepar(int, int, int), + Onepar(i32), + Twopar(i32, i32), + Threepar(i32, i32, i32), } #[derive(Clone, PartialEq, Debug)] struct RecCy { - x: int, - y: int, + x: i32, + y: i32, t: Taggy } #[test] fn test_param_int() { - test_parameterized::(5, 72, 64, 175); + test_parameterized::(5, 72, 64, 175); } #[test] @@ -1885,10 +1885,10 @@ mod tests { #[test] fn test_param_taggypar() { - test_parameterized::>(Onepar::(1), - Twopar::(1, 2), - Threepar::(1, 2, 3), - Twopar::(17, 42)); + test_parameterized::>(Onepar::(1), + Twopar::(1, 2), + Threepar::(1, 2, 3), + Twopar::(17, 42)); } #[test] @@ -1903,17 +1903,17 @@ mod tests { #[test] fn test_with_capacity() { let mut d = RingBuf::with_capacity(0); - d.push_back(1i); + d.push_back(1); assert_eq!(d.len(), 1); let mut d = RingBuf::with_capacity(50); - d.push_back(1i); + d.push_back(1); assert_eq!(d.len(), 1); } #[test] fn test_with_capacity_non_power_two() { let mut d3 = RingBuf::with_capacity(3); - d3.push_back(1i); + d3.push_back(1); // X = None, | = lo // [|1, X, X] @@ -1977,10 +1977,10 @@ mod tests { #[test] fn test_swap() { - let mut d: RingBuf = (0i..5).collect(); + let mut d: RingBuf = (0..5).collect(); d.pop_front(); d.swap(0, 3); - assert_eq!(d.iter().map(|&x|x).collect::>(), vec!(4, 2, 3, 1)); + assert_eq!(d.iter().map(|&x|x).collect::>(), vec!(4, 2, 3, 1)); } #[test] @@ -1989,20 +1989,20 @@ mod tests { assert_eq!(d.iter().next(), None); assert_eq!(d.iter().size_hint(), (0, Some(0))); - for i in 0i..5 { + for i in 0..5 { d.push_back(i); } { let b: &[_] = &[&0,&1,&2,&3,&4]; - assert_eq!(d.iter().collect::>(), b); + assert_eq!(d.iter().collect::>(), b); } - for i in 6i..9 { + for i in 6..9 { d.push_front(i); } { let b: &[_] = &[&8,&7,&6,&0,&1,&2,&3,&4]; - assert_eq!(d.iter().collect::>(), b); + assert_eq!(d.iter().collect::>(), b); } let mut it = d.iter(); @@ -2020,19 +2020,19 @@ mod tests { let mut d = RingBuf::new(); assert_eq!(d.iter().rev().next(), None); - for i in 0i..5 { + for i in 0..5 { d.push_back(i); } { let b: &[_] = &[&4,&3,&2,&1,&0]; - assert_eq!(d.iter().rev().collect::>(), b); + assert_eq!(d.iter().rev().collect::>(), b); } - for i in 6i..9 { + for i in 6..9 { d.push_front(i); } let b: &[_] = &[&4,&3,&2,&1,&0,&6,&7,&8]; - assert_eq!(d.iter().rev().collect::>(), b); + assert_eq!(d.iter().rev().collect::>(), b); } #[test] @@ -2040,13 +2040,13 @@ mod tests { let mut d = RingBuf::with_capacity(3); assert!(d.iter_mut().rev().next().is_none()); - d.push_back(1i); + d.push_back(1); d.push_back(2); d.push_back(3); assert_eq!(d.pop_front(), Some(1)); d.push_back(4); - assert_eq!(d.iter_mut().rev().map(|x| *x).collect::>(), + assert_eq!(d.iter_mut().rev().map(|x| *x).collect::>(), vec!(4, 3, 2)); } @@ -2101,7 +2101,7 @@ mod tests { // Empty iter { - let d: RingBuf = RingBuf::new(); + let d: RingBuf = RingBuf::new(); let mut iter = d.into_iter(); assert_eq!(iter.size_hint(), (0, Some(0))); @@ -2112,35 +2112,35 @@ mod tests { // simple iter { let mut d = RingBuf::new(); - for i in 0i..5 { + for i in 0..5 { d.push_back(i); } let b = vec![0,1,2,3,4]; - assert_eq!(d.into_iter().collect::>(), b); + assert_eq!(d.into_iter().collect::>(), b); } // wrapped iter { let mut d = RingBuf::new(); - for i in 0i..5 { + for i in 0..5 { d.push_back(i); } - for i in 6i..9 { + for i in 6..9 { d.push_front(i); } let b = vec![8,7,6,0,1,2,3,4]; - assert_eq!(d.into_iter().collect::>(), b); + assert_eq!(d.into_iter().collect::>(), b); } // partially used { let mut d = RingBuf::new(); - for i in 0i..5 { + for i in 0..5 { d.push_back(i); } - for i in 6i..9 { + for i in 6..9 { d.push_front(i); } @@ -2160,7 +2160,7 @@ mod tests { // Empty iter { - let mut d: RingBuf = RingBuf::new(); + let mut d: RingBuf = RingBuf::new(); { let mut iter = d.drain(); @@ -2176,32 +2176,32 @@ mod tests { // simple iter { let mut d = RingBuf::new(); - for i in 0i..5 { + for i in 0..5 { d.push_back(i); } - assert_eq!(d.drain().collect::>(), [0, 1, 2, 3, 4]); + assert_eq!(d.drain().collect::>(), [0, 1, 2, 3, 4]); assert!(d.is_empty()); } // wrapped iter { let mut d = RingBuf::new(); - for i in 0i..5 { + for i in 0..5 { d.push_back(i); } for i in 6i..9 { d.push_front(i); } - assert_eq!(d.drain().collect::>(), [8,7,6,0,1,2,3,4]); + assert_eq!(d.drain().collect::>(), [8,7,6,0,1,2,3,4]); assert!(d.is_empty()); } // partially used { let mut d = RingBuf::new(); - for i in 0i..5 { + for i in 0..5 { d.push_back(i); } for i in 6i..9 { @@ -2225,9 +2225,9 @@ mod tests { #[test] fn test_from_iter() { use core::iter; - let v = vec!(1i,2,3,4,5,6,7); - let deq: RingBuf = v.iter().map(|&x| x).collect(); - let u: Vec = deq.iter().map(|&x| x).collect(); + let v = vec!(1,2,3,4,5,6,7); + let deq: RingBuf = v.iter().map(|&x| x).collect(); + let u: Vec = deq.iter().map(|&x| x).collect(); assert_eq!(u, v); let seq = iter::count(0u, 2).take(256); @@ -2241,7 +2241,7 @@ mod tests { #[test] fn test_clone() { let mut d = RingBuf::new(); - d.push_front(17i); + d.push_front(17); d.push_front(42); d.push_back(137); d.push_back(137); @@ -2259,7 +2259,7 @@ mod tests { fn test_eq() { let mut d = RingBuf::new(); assert!(d == RingBuf::with_capacity(0)); - d.push_front(137i); + d.push_front(137); d.push_front(17); d.push_front(42); d.push_back(137); @@ -2281,12 +2281,12 @@ mod tests { let mut x = RingBuf::new(); let mut y = RingBuf::new(); - x.push_back(1i); + x.push_back(1); x.push_back(2); x.push_back(3); - y.push_back(0i); - y.push_back(1i); + y.push_back(0); + y.push_back(1); y.pop_front(); y.push_back(2); y.push_back(3); @@ -2298,7 +2298,7 @@ mod tests { fn test_ord() { let x = RingBuf::new(); let mut y = RingBuf::new(); - y.push_back(1i); + y.push_back(1); y.push_back(2); y.push_back(3); assert!(x < y); @@ -2309,7 +2309,7 @@ mod tests { #[test] fn test_show() { - let ringbuf: RingBuf = (0i..10).collect(); + let ringbuf: RingBuf = (0..10).collect(); assert_eq!(format!("{:?}", ringbuf), "RingBuf [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"); let ringbuf: RingBuf<&str> = vec!["just", "one", "test", "more"].iter() @@ -2389,41 +2389,41 @@ mod tests { // test growth path A // [T o o H] -> [T o o H . . . . ] let mut ring = RingBuf::with_capacity(4); - for i in 0i..3 { + for i in 0..3 { ring.push_back(i); } ring.reserve(7); - for i in 0i..3 { + for i in 0..3 { assert_eq!(ring.pop_front(), Some(i)); } // test growth path B // [H T o o] -> [. T o o H . . . ] let mut ring = RingBuf::with_capacity(4); - for i in 0i..1 { + for i in 0..1 { ring.push_back(i); assert_eq!(ring.pop_front(), Some(i)); } - for i in 0i..3 { + for i in 0..3 { ring.push_back(i); } ring.reserve(7); - for i in 0i..3 { + for i in 0..3 { assert_eq!(ring.pop_front(), Some(i)); } // test growth path C // [o o H T] -> [o o H . . . . T ] let mut ring = RingBuf::with_capacity(4); - for i in 0i..3 { + for i in 0..3 { ring.push_back(i); assert_eq!(ring.pop_front(), Some(i)); } - for i in 0i..3 { + for i in 0..3 { ring.push_back(i); } ring.reserve(7); - for i in 0i..3 { + for i in 0..3 { assert_eq!(ring.pop_front(), Some(i)); } } @@ -2431,7 +2431,7 @@ mod tests { #[test] fn test_get() { let mut ring = RingBuf::new(); - ring.push_back(0i); + ring.push_back(0); assert_eq!(ring.get(0), Some(&0)); assert_eq!(ring.get(1), None); @@ -2463,7 +2463,7 @@ mod tests { #[test] fn test_get_mut() { let mut ring = RingBuf::new(); - for i in 0i..3 { + for i in 0..3 { ring.push_back(i); } @@ -2633,8 +2633,8 @@ mod tests { #[test] fn test_front() { let mut ring = RingBuf::new(); - ring.push_back(10i); - ring.push_back(20i); + ring.push_back(10); + ring.push_back(20); assert_eq!(ring.front(), Some(&10)); ring.pop_front(); assert_eq!(ring.front(), Some(&20)); @@ -2644,7 +2644,7 @@ mod tests { #[test] fn test_as_slices() { - let mut ring: RingBuf = RingBuf::with_capacity(127); + let mut ring: RingBuf = RingBuf::with_capacity(127); let cap = ring.capacity() as int; let first = cap/2; let last = cap - first; @@ -2672,7 +2672,7 @@ mod tests { #[test] fn test_as_mut_slices() { - let mut ring: RingBuf = RingBuf::with_capacity(127); + let mut ring: RingBuf = RingBuf::with_capacity(127); let cap = ring.capacity() as int; let first = cap/2; let last = cap - first; diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index ba1be09934f..3813edf790b 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -15,7 +15,7 @@ //! //! ```rust //! // slicing a Vec -//! let vec = vec!(1i, 2, 3); +//! let vec = vec!(1, 2, 3); //! let int_slice = vec.as_slice(); //! // coercing an array to a slice //! let str_slice: &[&str] = &["one", "two", "three"]; @@ -26,7 +26,7 @@ //! block of memory that a mutable slice points to: //! //! ```rust -//! let x: &mut[int] = &mut [1i, 2, 3]; +//! let x: &mut[int] = &mut [1, 2, 3]; //! x[1] = 7; //! assert_eq!(x[0], 1); //! assert_eq!(x[1], 7); @@ -54,9 +54,9 @@ //! ```rust //! #![feature(slicing_syntax)] //! fn main() { -//! let numbers = [0i, 1i, 2i]; +//! let numbers = [0, 1, 2]; //! let last_numbers = &numbers[1..3]; -//! // last_numbers is now &[1i, 2i] +//! // last_numbers is now &[1, 2] //! } //! ``` //! @@ -76,7 +76,7 @@ //! type of the slice is `int`, the element type of the iterator is `&int`. //! //! ```rust -//! let numbers = [0i, 1i, 2i]; +//! let numbers = [0, 1, 2]; //! for &x in numbers.iter() { //! println!("{} is a number!", x); //! } @@ -134,7 +134,7 @@ pub trait SliceExt { /// # Examples /// /// ```rust - /// let mut v = [5i, 4, 1, 3, 2]; + /// let mut v = [5, 4, 1, 3, 2]; /// v.sort_by(|a, b| a.cmp(b)); /// assert!(v == [1, 2, 3, 4, 5]); /// @@ -160,11 +160,11 @@ pub trait SliceExt { /// # Examples /// /// ```rust - /// let mut a = [1i, 2, 3, 4, 5]; - /// let b = vec![6i, 7, 8]; + /// let mut a = [1, 2, 3, 4, 5]; + /// let b = vec![6, 7, 8]; /// let num_moved = a.move_from(b, 0, 3); /// assert_eq!(num_moved, 3); - /// assert!(a == [6i, 7, 8, 4, 5]); + /// assert!(a == [6, 7, 8, 4, 5]); /// ``` #[unstable(feature = "collections", reason = "uncertain about this API approach")] @@ -282,7 +282,7 @@ pub trait SliceExt { /// `[3,4]`): /// /// ```rust - /// let v = &[1i, 2, 3, 4]; + /// let v = &[1, 2, 3, 4]; /// for win in v.windows(2) { /// println!("{:?}", win); /// } @@ -305,7 +305,7 @@ pub trait SliceExt { /// `[3,4]`, `[5]`): /// /// ```rust - /// let v = &[1i, 2, 3, 4, 5]; + /// let v = &[1, 2, 3, 4, 5]; /// for win in v.chunks(2) { /// println!("{:?}", win); /// } @@ -396,7 +396,7 @@ pub trait SliceExt { /// found; the fourth could match any position in `[1,4]`. /// /// ```rust - /// let s = [0i, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; + /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; /// let s = s.as_slice(); /// /// let seek = 13; @@ -418,7 +418,7 @@ pub trait SliceExt { /// # Example /// /// ``` - /// let a = [1i, 2, 3]; + /// let a = [1, 2, 3]; /// assert_eq!(a.len(), 3); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -429,7 +429,7 @@ pub trait SliceExt { /// # Example /// /// ``` - /// let a = [1i, 2, 3]; + /// let a = [1, 2, 3]; /// assert!(!a.is_empty()); /// ``` #[inline] @@ -551,24 +551,24 @@ pub trait SliceExt { /// # Example /// /// ```rust - /// let mut v = [1i, 2, 3, 4, 5, 6]; + /// let mut v = [1, 2, 3, 4, 5, 6]; /// /// // scoped to restrict the lifetime of the borrows /// { /// let (left, right) = v.split_at_mut(0); /// assert!(left == []); - /// assert!(right == [1i, 2, 3, 4, 5, 6]); + /// assert!(right == [1, 2, 3, 4, 5, 6]); /// } /// /// { /// let (left, right) = v.split_at_mut(2); - /// assert!(left == [1i, 2]); - /// assert!(right == [3i, 4, 5, 6]); + /// assert!(left == [1, 2]); + /// assert!(right == [3, 4, 5, 6]); /// } /// /// { /// let (left, right) = v.split_at_mut(6); - /// assert!(left == [1i, 2, 3, 4, 5, 6]); + /// assert!(left == [1, 2, 3, 4, 5, 6]); /// assert!(right == []); /// } /// ``` @@ -580,9 +580,9 @@ pub trait SliceExt { /// # Example /// /// ```rust - /// let mut v = [1i, 2, 3]; + /// let mut v = [1, 2, 3]; /// v.reverse(); - /// assert!(v == [3i, 2, 1]); + /// assert!(v == [3, 2, 1]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn reverse(&mut self); @@ -612,7 +612,7 @@ pub trait SliceExt { /// # Examples /// /// ```rust - /// let v = [1i, 2, 3]; + /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// /// for p in perms { @@ -623,12 +623,12 @@ pub trait SliceExt { /// Iterating through permutations one by one. /// /// ```rust - /// let v = [1i, 2, 3]; + /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// - /// assert_eq!(Some(vec![1i, 2, 3]), perms.next()); - /// assert_eq!(Some(vec![1i, 3, 2]), perms.next()); - /// assert_eq!(Some(vec![3i, 1, 2]), perms.next()); + /// assert_eq!(Some(vec![1, 2, 3]), perms.next()); + /// assert_eq!(Some(vec![1, 3, 2]), perms.next()); + /// assert_eq!(Some(vec![3, 1, 2]), perms.next()); /// ``` #[unstable(feature = "collections")] fn permutations(&self) -> Permutations where Self::Item: Clone; @@ -640,15 +640,15 @@ pub trait SliceExt { /// # Example /// /// ```rust - /// let mut dst = [0i, 0, 0]; - /// let src = [1i, 2]; + /// let mut dst = [0, 0, 0]; + /// let src = [1, 2]; /// /// assert!(dst.clone_from_slice(&src) == 2); /// assert!(dst == [1, 2, 0]); /// - /// let src2 = [3i, 4, 5, 6]; + /// let src2 = [3, 4, 5, 6]; /// assert!(dst.clone_from_slice(&src2) == 3); - /// assert!(dst == [3i, 4, 5]); + /// assert!(dst == [3, 4, 5]); /// ``` #[unstable(feature = "collections")] fn clone_from_slice(&mut self, &[Self::Item]) -> uint where Self::Item: Clone; @@ -660,10 +660,10 @@ pub trait SliceExt { /// # Examples /// /// ```rust - /// let mut v = [-5i, 4, 1, -3, 2]; + /// let mut v = [-5, 4, 1, -3, 2]; /// /// v.sort(); - /// assert!(v == [-5i, -3, 1, 2, 4]); + /// assert!(v == [-5, -3, 1, 2, 4]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn sort(&mut self) where Self::Item: Ord; @@ -682,7 +682,7 @@ pub trait SliceExt { /// found; the fourth could match any position in `[1,4]`. /// /// ```rust - /// let s = [0i, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; + /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; /// let s = s.as_slice(); /// /// assert_eq!(s.binary_search(&13), Ok(9)); @@ -709,12 +709,12 @@ pub trait SliceExt { /// # Example /// /// ```rust - /// let v: &mut [_] = &mut [0i, 1, 2]; + /// let v: &mut [_] = &mut [0, 1, 2]; /// v.next_permutation(); - /// let b: &mut [_] = &mut [0i, 2, 1]; + /// let b: &mut [_] = &mut [0, 2, 1]; /// assert!(v == b); /// v.next_permutation(); - /// let b: &mut [_] = &mut [1i, 0, 2]; + /// let b: &mut [_] = &mut [1, 0, 2]; /// assert!(v == b); /// ``` #[unstable(feature = "collections", @@ -729,12 +729,12 @@ pub trait SliceExt { /// # Example /// /// ```rust - /// let v: &mut [_] = &mut [1i, 0, 2]; + /// let v: &mut [_] = &mut [1, 0, 2]; /// v.prev_permutation(); - /// let b: &mut [_] = &mut [0i, 2, 1]; + /// let b: &mut [_] = &mut [0, 2, 1]; /// assert!(v == b); /// v.prev_permutation(); - /// let b: &mut [_] = &mut [0i, 1, 2]; + /// let b: &mut [_] = &mut [0, 1, 2]; /// assert!(v == b); /// ``` #[unstable(feature = "collections", @@ -1576,7 +1576,7 @@ mod tests { fn test_is_empty() { let xs: [int; 0] = []; assert!(xs.is_empty()); - assert!(![0i].is_empty()); + assert!(![0].is_empty()); } #[test] @@ -1593,11 +1593,11 @@ mod tests { #[test] fn test_get() { - let mut a = vec![11i]; + let mut a = vec![11]; assert_eq!(a.get(1), None); - a = vec![11i, 12]; + a = vec![11, 12]; assert_eq!(a.get(1).unwrap(), &12); - a = vec![11i, 12, 13]; + a = vec![11, 12, 13]; assert_eq!(a.get(1).unwrap(), &12); } @@ -1605,9 +1605,9 @@ mod tests { fn test_first() { let mut a = vec![]; assert_eq!(a.first(), None); - a = vec![11i]; + a = vec![11]; assert_eq!(a.first().unwrap(), &11); - a = vec![11i, 12]; + a = vec![11, 12]; assert_eq!(a.first().unwrap(), &11); } @@ -1615,28 +1615,28 @@ mod tests { fn test_first_mut() { let mut a = vec![]; assert_eq!(a.first_mut(), None); - a = vec![11i]; + a = vec![11]; assert_eq!(*a.first_mut().unwrap(), 11); - a = vec![11i, 12]; + a = vec![11, 12]; assert_eq!(*a.first_mut().unwrap(), 11); } #[test] fn test_tail() { - let mut a = vec![11i]; + let mut a = vec![11]; let b: &[int] = &[]; assert_eq!(a.tail(), b); - a = vec![11i, 12]; + a = vec![11, 12]; let b: &[int] = &[12]; assert_eq!(a.tail(), b); } #[test] fn test_tail_mut() { - let mut a = vec![11i]; + let mut a = vec![11]; let b: &mut [int] = &mut []; assert!(a.tail_mut() == b); - a = vec![11i, 12]; + a = vec![11, 12]; let b: &mut [int] = &mut [12]; assert!(a.tail_mut() == b); } @@ -1657,20 +1657,20 @@ mod tests { #[test] fn test_init() { - let mut a = vec![11i]; + let mut a = vec![11]; let b: &[int] = &[]; assert_eq!(a.init(), b); - a = vec![11i, 12]; + a = vec![11, 12]; let b: &[int] = &[11]; assert_eq!(a.init(), b); } #[test] fn test_init_mut() { - let mut a = vec![11i]; + let mut a = vec![11]; let b: &mut [int] = &mut []; assert!(a.init_mut() == b); - a = vec![11i, 12]; + a = vec![11, 12]; let b: &mut [int] = &mut [11]; assert!(a.init_mut() == b); } @@ -1693,9 +1693,9 @@ mod tests { fn test_last() { let mut a = vec![]; assert_eq!(a.last(), None); - a = vec![11i]; + a = vec![11]; assert_eq!(a.last().unwrap(), &11); - a = vec![11i, 12]; + a = vec![11, 12]; assert_eq!(a.last().unwrap(), &12); } @@ -1703,16 +1703,16 @@ mod tests { fn test_last_mut() { let mut a = vec![]; assert_eq!(a.last_mut(), None); - a = vec![11i]; + a = vec![11]; assert_eq!(*a.last_mut().unwrap(), 11); - a = vec![11i, 12]; + a = vec![11, 12]; assert_eq!(*a.last_mut().unwrap(), 12); } #[test] fn test_slice() { // Test fixed length vector. - let vec_fixed = [1i, 2, 3, 4]; + let vec_fixed = [1, 2, 3, 4]; let v_a = vec_fixed[1u..vec_fixed.len()].to_vec(); assert_eq!(v_a.len(), 3u); let v_a = v_a.as_slice(); @@ -1721,7 +1721,7 @@ mod tests { assert_eq!(v_a[2], 4); // Test on stack. - let vec_stack: &[_] = &[1i, 2, 3]; + let vec_stack: &[_] = &[1, 2, 3]; let v_b = vec_stack[1u..3u].to_vec(); assert_eq!(v_b.len(), 2u); let v_b = v_b.as_slice(); @@ -1729,7 +1729,7 @@ mod tests { assert_eq!(v_b[1], 3); // Test `Box<[T]>` - let vec_unique = vec![1i, 2, 3, 4, 5, 6]; + let vec_unique = vec![1, 2, 3, 4, 5, 6]; let v_d = vec_unique[1u..6u].to_vec(); assert_eq!(v_d.len(), 5u); let v_d = v_d.as_slice(); @@ -1763,7 +1763,7 @@ mod tests { #[test] fn test_pop() { - let mut v = vec![5i]; + let mut v = vec![5]; let e = v.pop(); assert_eq!(v.len(), 0); assert_eq!(e, Some(5)); @@ -1775,19 +1775,19 @@ mod tests { #[test] fn test_swap_remove() { - let mut v = vec![1i, 2, 3, 4, 5]; + let mut v = vec![1, 2, 3, 4, 5]; let mut e = v.swap_remove(0); assert_eq!(e, 1); - assert_eq!(v, vec![5i, 2, 3, 4]); + assert_eq!(v, vec![5, 2, 3, 4]); e = v.swap_remove(3); assert_eq!(e, 4); - assert_eq!(v, vec![5i, 2, 3]); + assert_eq!(v, vec![5, 2, 3]); } #[test] #[should_fail] fn test_swap_remove_fail() { - let mut v = vec![1i]; + let mut v = vec![1]; let _ = v.swap_remove(0); let _ = v.swap_remove(0); } @@ -1811,12 +1811,12 @@ mod tests { fn test_push() { // Test on-stack push(). let mut v = vec![]; - v.push(1i); + v.push(1); assert_eq!(v.len(), 1u); assert_eq!(v.as_slice()[0], 1); // Test on-heap push(). - v.push(2i); + v.push(2); assert_eq!(v.len(), 2u); assert_eq!(v.as_slice()[0], 1); assert_eq!(v.as_slice()[1], 2); @@ -1824,7 +1824,7 @@ mod tests { #[test] fn test_truncate() { - let mut v = vec![box 6i,box 5,box 4]; + let mut v = vec![box 6,box 5,box 4]; v.truncate(1); let v = v.as_slice(); assert_eq!(v.len(), 1); @@ -1834,7 +1834,7 @@ mod tests { #[test] fn test_clear() { - let mut v = vec![box 6i,box 5,box 4]; + let mut v = vec![box 6,box 5,box 4]; v.clear(); assert_eq!(v.len(), 0); // If the unsafe block didn't drop things properly, we blow up here. @@ -1859,11 +1859,11 @@ mod tests { #[test] fn test_dedup_unique() { - let mut v0 = vec![box 1i, box 1, box 2, box 3]; + let mut v0 = vec![box 1, box 1, box 2, box 3]; v0.dedup(); - let mut v1 = vec![box 1i, box 2, box 2, box 3]; + let mut v1 = vec![box 1, box 2, box 2, box 3]; v1.dedup(); - let mut v2 = vec![box 1i, box 2, box 3, box 3]; + let mut v2 = vec![box 1, box 2, box 3, box 3]; v2.dedup(); /* * If the boxed pointers were leaked or otherwise misused, valgrind @@ -1873,11 +1873,11 @@ mod tests { #[test] fn test_dedup_shared() { - let mut v0 = vec![box 1i, box 1, box 2, box 3]; + let mut v0 = vec![box 1, box 1, box 2, box 3]; v0.dedup(); - let mut v1 = vec![box 1i, box 2, box 2, box 3]; + let mut v1 = vec![box 1, box 2, box 2, box 3]; v1.dedup(); - let mut v2 = vec![box 1i, box 2, box 3, box 3]; + let mut v2 = vec![box 1, box 2, box 3, box 3]; v2.dedup(); /* * If the pointers were leaked or otherwise misused, valgrind and/or @@ -1894,7 +1894,7 @@ mod tests { #[test] fn test_element_swaps() { - let mut v = [1i, 2, 3]; + let mut v = [1, 2, 3]; for (i, (a, b)) in ElementSwaps::new(v.len()).enumerate() { v.swap(a, b); match i { @@ -1930,7 +1930,7 @@ mod tests { assert_eq!(it.next(), None); } { - let v = [1i, 2, 3]; + let v = [1, 2, 3]; let mut it = v.permutations(); let (min_size, max_opt) = it.size_hint(); assert_eq!(min_size, 3*2); @@ -1964,7 +1964,7 @@ mod tests { #[test] fn test_lexicographic_permutations() { - let v : &mut[int] = &mut[1i, 2, 3, 4, 5]; + let v : &mut[int] = &mut[1, 2, 3, 4, 5]; assert!(v.prev_permutation() == false); assert!(v.next_permutation()); let b: &mut[int] = &mut[1, 2, 3, 5, 4]; @@ -1980,7 +1980,7 @@ mod tests { let b: &mut[int] = &mut[1, 2, 4, 5, 3]; assert!(v == b); - let v : &mut[int] = &mut[1i, 0, 0, 0]; + let v : &mut[int] = &mut[1, 0, 0, 0]; assert!(v.next_permutation() == false); assert!(v.prev_permutation()); let b: &mut[int] = &mut[0, 1, 0, 0]; @@ -2003,14 +2003,14 @@ mod tests { assert!(empty.prev_permutation() == false); assert!(empty == b); - let one_elem : &mut[int] = &mut[4i]; + let one_elem : &mut[int] = &mut[4]; assert!(one_elem.prev_permutation() == false); let b: &mut[int] = &mut[4]; assert!(one_elem == b); assert!(one_elem.next_permutation() == false); assert!(one_elem == b); - let two_elem : &mut[int] = &mut[1i, 2]; + let two_elem : &mut[int] = &mut[1, 2]; assert!(two_elem.prev_permutation() == false); let b : &mut[int] = &mut[1, 2]; let c : &mut[int] = &mut[2, 1]; @@ -2027,9 +2027,9 @@ mod tests { #[test] fn test_position_elem() { - assert!([].position_elem(&1i).is_none()); + assert!([].position_elem(&1).is_none()); - let v1 = vec![1i, 2, 3, 3, 2, 5]; + let v1 = vec![1, 2, 3, 3, 2, 5]; assert_eq!(v1.position_elem(&1), Some(0u)); assert_eq!(v1.position_elem(&2), Some(1u)); assert_eq!(v1.position_elem(&5), Some(5u)); @@ -2038,52 +2038,52 @@ mod tests { #[test] fn test_binary_search() { - assert_eq!([1i,2,3,4,5].binary_search(&5).ok(), Some(4)); - assert_eq!([1i,2,3,4,5].binary_search(&4).ok(), Some(3)); - assert_eq!([1i,2,3,4,5].binary_search(&3).ok(), Some(2)); - assert_eq!([1i,2,3,4,5].binary_search(&2).ok(), Some(1)); - assert_eq!([1i,2,3,4,5].binary_search(&1).ok(), Some(0)); + assert_eq!([1,2,3,4,5].binary_search(&5).ok(), Some(4)); + assert_eq!([1,2,3,4,5].binary_search(&4).ok(), Some(3)); + assert_eq!([1,2,3,4,5].binary_search(&3).ok(), Some(2)); + assert_eq!([1,2,3,4,5].binary_search(&2).ok(), Some(1)); + assert_eq!([1,2,3,4,5].binary_search(&1).ok(), Some(0)); - assert_eq!([2i,4,6,8,10].binary_search(&1).ok(), None); - assert_eq!([2i,4,6,8,10].binary_search(&5).ok(), None); - assert_eq!([2i,4,6,8,10].binary_search(&4).ok(), Some(1)); - assert_eq!([2i,4,6,8,10].binary_search(&10).ok(), Some(4)); + assert_eq!([2,4,6,8,10].binary_search(&1).ok(), None); + assert_eq!([2,4,6,8,10].binary_search(&5).ok(), None); + assert_eq!([2,4,6,8,10].binary_search(&4).ok(), Some(1)); + assert_eq!([2,4,6,8,10].binary_search(&10).ok(), Some(4)); - assert_eq!([2i,4,6,8].binary_search(&1).ok(), None); - assert_eq!([2i,4,6,8].binary_search(&5).ok(), None); - assert_eq!([2i,4,6,8].binary_search(&4).ok(), Some(1)); - assert_eq!([2i,4,6,8].binary_search(&8).ok(), Some(3)); + assert_eq!([2,4,6,8].binary_search(&1).ok(), None); + assert_eq!([2,4,6,8].binary_search(&5).ok(), None); + assert_eq!([2,4,6,8].binary_search(&4).ok(), Some(1)); + assert_eq!([2,4,6,8].binary_search(&8).ok(), Some(3)); - assert_eq!([2i,4,6].binary_search(&1).ok(), None); - assert_eq!([2i,4,6].binary_search(&5).ok(), None); - assert_eq!([2i,4,6].binary_search(&4).ok(), Some(1)); - assert_eq!([2i,4,6].binary_search(&6).ok(), Some(2)); + assert_eq!([2,4,6].binary_search(&1).ok(), None); + assert_eq!([2,4,6].binary_search(&5).ok(), None); + assert_eq!([2,4,6].binary_search(&4).ok(), Some(1)); + assert_eq!([2,4,6].binary_search(&6).ok(), Some(2)); - assert_eq!([2i,4].binary_search(&1).ok(), None); - assert_eq!([2i,4].binary_search(&5).ok(), None); - assert_eq!([2i,4].binary_search(&2).ok(), Some(0)); - assert_eq!([2i,4].binary_search(&4).ok(), Some(1)); + assert_eq!([2,4].binary_search(&1).ok(), None); + assert_eq!([2,4].binary_search(&5).ok(), None); + assert_eq!([2,4].binary_search(&2).ok(), Some(0)); + assert_eq!([2,4].binary_search(&4).ok(), Some(1)); - assert_eq!([2i].binary_search(&1).ok(), None); - assert_eq!([2i].binary_search(&5).ok(), None); - assert_eq!([2i].binary_search(&2).ok(), Some(0)); + assert_eq!([2].binary_search(&1).ok(), None); + assert_eq!([2].binary_search(&5).ok(), None); + assert_eq!([2].binary_search(&2).ok(), Some(0)); - assert_eq!([].binary_search(&1i).ok(), None); - assert_eq!([].binary_search(&5i).ok(), None); + assert_eq!([].binary_search(&1).ok(), None); + assert_eq!([].binary_search(&5).ok(), None); - assert!([1i,1,1,1,1].binary_search(&1).ok() != None); - assert!([1i,1,1,1,2].binary_search(&1).ok() != None); - assert!([1i,1,1,2,2].binary_search(&1).ok() != None); - assert!([1i,1,2,2,2].binary_search(&1).ok() != None); - assert_eq!([1i,2,2,2,2].binary_search(&1).ok(), Some(0)); + assert!([1,1,1,1,1].binary_search(&1).ok() != None); + assert!([1,1,1,1,2].binary_search(&1).ok() != None); + assert!([1,1,1,2,2].binary_search(&1).ok() != None); + assert!([1,1,2,2,2].binary_search(&1).ok() != None); + assert_eq!([1,2,2,2,2].binary_search(&1).ok(), Some(0)); - assert_eq!([1i,2,3,4,5].binary_search(&6).ok(), None); - assert_eq!([1i,2,3,4,5].binary_search(&0).ok(), None); + assert_eq!([1,2,3,4,5].binary_search(&6).ok(), None); + assert_eq!([1,2,3,4,5].binary_search(&0).ok(), None); } #[test] fn test_reverse() { - let mut v: Vec = vec![10i, 20]; + let mut v: Vec = vec![10, 20]; assert_eq!(v[0], 10); assert_eq!(v[1], 20); v.reverse(); @@ -2098,7 +2098,7 @@ mod tests { #[test] fn test_sort() { for len in 4u..25 { - for _ in 0i..100 { + for _ in 0..100 { let mut v = thread_rng().gen_iter::().take(len) .collect::>(); let mut v1 = v.clone(); @@ -2125,9 +2125,9 @@ mod tests { #[test] fn test_sort_stability() { - for len in 4i..25 { + for len in 4..25 { for _ in 0u..10 { - let mut counts = [0i; 10]; + let mut counts = [0; 10]; // create a vector like [(6, 1), (5, 1), (6, 2), ...], // where the first item of each tuple is random, but @@ -2159,21 +2159,21 @@ mod tests { let v: [Vec; 0] = []; let c: Vec = v.concat(); assert_eq!(c, []); - let d: Vec = [vec![1i], vec![2i,3i]].concat(); - assert_eq!(d, vec![1i, 2, 3]); + let d: Vec = [vec![1], vec![2,3]].concat(); + assert_eq!(d, vec![1, 2, 3]); let v: [&[int]; 2] = [&[1], &[2, 3]]; - assert_eq!(v.connect(&0), vec![1i, 0, 2, 3]); - let v: [&[int]; 3] = [&[1i], &[2], &[3]]; - assert_eq!(v.connect(&0), vec![1i, 0, 2, 0, 3]); + assert_eq!(v.connect(&0), vec![1, 0, 2, 3]); + let v: [&[int]; 3] = [&[1], &[2], &[3]]; + assert_eq!(v.connect(&0), vec![1, 0, 2, 0, 3]); } #[test] fn test_connect() { let v: [Vec; 0] = []; assert_eq!(v.connect(&0), vec![]); - assert_eq!([vec![1i], vec![2i, 3]].connect(&0), vec![1, 0, 2, 3]); - assert_eq!([vec![1i], vec![2i], vec![3i]].connect(&0), vec![1, 0, 2, 0, 3]); + assert_eq!([vec![1], vec![2, 3]].connect(&0), vec![1, 0, 2, 3]); + assert_eq!([vec![1], vec![2], vec![3]].connect(&0), vec![1, 0, 2, 0, 3]); let v: [&[int]; 2] = [&[1], &[2, 3]]; assert_eq!(v.connect(&0), vec![1, 0, 2, 3]); @@ -2183,42 +2183,42 @@ mod tests { #[test] fn test_insert() { - let mut a = vec![1i, 2, 4]; + let mut a = vec![1, 2, 4]; a.insert(2, 3); assert_eq!(a, vec![1, 2, 3, 4]); - let mut a = vec![1i, 2, 3]; + let mut a = vec![1, 2, 3]; a.insert(0, 0); assert_eq!(a, vec![0, 1, 2, 3]); - let mut a = vec![1i, 2, 3]; + let mut a = vec![1, 2, 3]; a.insert(3, 4); assert_eq!(a, vec![1, 2, 3, 4]); let mut a = vec![]; - a.insert(0, 1i); + a.insert(0, 1); assert_eq!(a, vec![1]); } #[test] #[should_fail] fn test_insert_oob() { - let mut a = vec![1i, 2, 3]; + let mut a = vec![1, 2, 3]; a.insert(4, 5); } #[test] fn test_remove() { - let mut a = vec![1i,2,3,4]; + let mut a = vec![1,2,3,4]; assert_eq!(a.remove(2), 3); - assert_eq!(a, vec![1i,2,4]); + assert_eq!(a, vec![1,2,4]); assert_eq!(a.remove(2), 4); - assert_eq!(a, vec![1i,2]); + assert_eq!(a, vec![1,2]); assert_eq!(a.remove(0), 1); - assert_eq!(a, vec![2i]); + assert_eq!(a, vec![2]); assert_eq!(a.remove(0), 2); assert_eq!(a, vec![]); @@ -2227,7 +2227,7 @@ mod tests { #[test] #[should_fail] fn test_remove_fail() { - let mut a = vec![1i]; + let mut a = vec![1]; let _ = a.remove(0); let _ = a.remove(0); } @@ -2244,7 +2244,7 @@ mod tests { #[test] fn test_slice_2() { - let v = vec![1i, 2, 3, 4, 5]; + let v = vec![1, 2, 3, 4, 5]; let v = v.slice(1u, 3u); assert_eq!(v.len(), 2u); assert_eq!(v[0], 2); @@ -2254,8 +2254,8 @@ mod tests { #[test] #[should_fail] fn test_permute_fail() { - let v = [(box 0i, Rc::new(0i)), (box 0i, Rc::new(0i)), - (box 0i, Rc::new(0i)), (box 0i, Rc::new(0i))]; + let v = [(box 0, Rc::new(0)), (box 0, Rc::new(0)), + (box 0, Rc::new(0)), (box 0, Rc::new(0))]; let mut i = 0u; for _ in v.permutations() { if i == 2 { @@ -2281,7 +2281,7 @@ mod tests { #[test] fn test_iterator() { - let xs = [1i, 2, 5, 10, 11]; + let xs = [1, 2, 5, 10, 11]; let mut it = xs.iter(); assert_eq!(it.size_hint(), (5, Some(5))); assert_eq!(it.next().unwrap(), &1); @@ -2299,7 +2299,7 @@ mod tests { #[test] fn test_random_access_iterator() { - let xs = [1i, 2, 5, 10, 11]; + let xs = [1, 2, 5, 10, 11]; let mut it = xs.iter(); assert_eq!(it.indexable(), 5); @@ -2337,14 +2337,14 @@ mod tests { #[test] fn test_iter_size_hints() { - let mut xs = [1i, 2, 5, 10, 11]; + let mut xs = [1, 2, 5, 10, 11]; assert_eq!(xs.iter().size_hint(), (5, Some(5))); assert_eq!(xs.iter_mut().size_hint(), (5, Some(5))); } #[test] fn test_iter_clone() { - let xs = [1i, 2, 5]; + let xs = [1, 2, 5]; let mut it = xs.iter(); it.next(); let mut jt = it.clone(); @@ -2355,7 +2355,7 @@ mod tests { #[test] fn test_mut_iterator() { - let mut xs = [1i, 2, 3, 4, 5]; + let mut xs = [1, 2, 3, 4, 5]; for x in xs.iter_mut() { *x += 1; } @@ -2365,7 +2365,7 @@ mod tests { #[test] fn test_rev_iterator() { - let xs = [1i, 2, 5, 10, 11]; + let xs = [1, 2, 5, 10, 11]; let ys = [11, 10, 5, 2, 1]; let mut i = 0; for &x in xs.iter().rev() { @@ -2398,7 +2398,7 @@ mod tests { #[test] fn test_splitator() { - let xs = &[1i,2,3,4,5]; + let xs = &[1,2,3,4,5]; let splits: &[&[int]] = &[&[1], &[3], &[5]]; assert_eq!(xs.split(|x| *x % 2 == 0).collect::>(), @@ -2423,7 +2423,7 @@ mod tests { #[test] fn test_splitnator() { - let xs = &[1i,2,3,4,5]; + let xs = &[1,2,3,4,5]; let splits: &[&[int]] = &[&[1,2,3,4,5]]; assert_eq!(xs.splitn(0, |x| *x % 2 == 0).collect::>(), @@ -2442,7 +2442,7 @@ mod tests { #[test] fn test_splitnator_mut() { - let xs = &mut [1i,2,3,4,5]; + let xs = &mut [1,2,3,4,5]; let splits: &[&mut [int]] = &[&mut [1,2,3,4,5]]; assert_eq!(xs.splitn_mut(0, |x| *x % 2 == 0).collect::>(), @@ -2462,7 +2462,7 @@ mod tests { #[test] fn test_rsplitator() { - let xs = &[1i,2,3,4,5]; + let xs = &[1,2,3,4,5]; let splits: &[&[int]] = &[&[5], &[3], &[1]]; assert_eq!(xs.split(|x| *x % 2 == 0).rev().collect::>(), @@ -2503,11 +2503,11 @@ mod tests { #[test] fn test_windowsator() { - let v = &[1i,2,3,4]; + let v = &[1,2,3,4]; let wins: &[&[int]] = &[&[1,2], &[2,3], &[3,4]]; assert_eq!(v.windows(2).collect::>(), wins); - let wins: &[&[int]] = &[&[1i,2,3], &[2,3,4]]; + let wins: &[&[int]] = &[&[1,2,3], &[2,3,4]]; assert_eq!(v.windows(3).collect::>(), wins); assert!(v.windows(6).next().is_none()); } @@ -2515,7 +2515,7 @@ mod tests { #[test] #[should_fail] fn test_windowsator_0() { - let v = &[1i,2,3,4]; + let v = &[1,2,3,4]; let _it = v.windows(0); } @@ -2523,18 +2523,18 @@ mod tests { fn test_chunksator() { use core::iter::ExactSizeIterator; - let v = &[1i,2,3,4,5]; + let v = &[1,2,3,4,5]; assert_eq!(v.chunks(2).len(), 3); - let chunks: &[&[int]] = &[&[1i,2], &[3,4], &[5]]; + let chunks: &[&[int]] = &[&[1,2], &[3,4], &[5]]; assert_eq!(v.chunks(2).collect::>(), chunks); - let chunks: &[&[int]] = &[&[1i,2,3], &[4,5]]; + let chunks: &[&[int]] = &[&[1,2,3], &[4,5]]; assert_eq!(v.chunks(3).collect::>(), chunks); - let chunks: &[&[int]] = &[&[1i,2,3,4,5]]; + let chunks: &[&[int]] = &[&[1,2,3,4,5]]; assert_eq!(v.chunks(6).collect::>(), chunks); - let chunks: &[&[int]] = &[&[5i], &[3,4], &[1,2]]; + let chunks: &[&[int]] = &[&[5], &[3,4], &[1,2]]; assert_eq!(v.chunks(2).rev().collect::>(), chunks); let mut it = v.chunks(2); assert_eq!(it.indexable(), 3); @@ -2550,33 +2550,33 @@ mod tests { #[test] #[should_fail] fn test_chunksator_0() { - let v = &[1i,2,3,4]; + let v = &[1,2,3,4]; let _it = v.chunks(0); } #[test] fn test_move_from() { - let mut a = [1i,2,3,4,5]; - let b = vec![6i,7,8]; + let mut a = [1,2,3,4,5]; + let b = vec![6,7,8]; assert_eq!(a.move_from(b, 0, 3), 3); - assert!(a == [6i,7,8,4,5]); - let mut a = [7i,2,8,1]; - let b = vec![3i,1,4,1,5,9]; + assert!(a == [6,7,8,4,5]); + let mut a = [7,2,8,1]; + let b = vec![3,1,4,1,5,9]; assert_eq!(a.move_from(b, 0, 6), 4); - assert!(a == [3i,1,4,1]); - let mut a = [1i,2,3,4]; - let b = vec![5i,6,7,8,9,0]; + assert!(a == [3,1,4,1]); + let mut a = [1,2,3,4]; + let b = vec![5,6,7,8,9,0]; assert_eq!(a.move_from(b, 2, 3), 1); - assert!(a == [7i,2,3,4]); - let mut a = [1i,2,3,4,5]; - let b = vec![5i,6,7,8,9,0]; + assert!(a == [7,2,3,4]); + let mut a = [1,2,3,4,5]; + let b = vec![5,6,7,8,9,0]; assert_eq!(a[2..4].move_from(b,1,6), 2); - assert!(a == [1i,2,6,7,5]); + assert!(a == [1,2,6,7,5]); } #[test] fn test_reverse_part() { - let mut values = [1i,2,3,4,5]; + let mut values = [1,2,3,4,5]; values[1..4].reverse(); assert!(values == [1,4,3,2,5]); } @@ -2592,8 +2592,8 @@ mod tests { } let empty: Vec = vec![]; test_show_vec!(empty, "[]"); - test_show_vec!(vec![1i], "[1]"); - test_show_vec!(vec![1i, 2, 3], "[1, 2, 3]"); + test_show_vec!(vec![1], "[1]"); + test_show_vec!(vec![1, 2, 3], "[1, 2, 3]"); test_show_vec!(vec![vec![], vec![1u], vec![1u, 1u]], "[[], [1], [1, 1]]"); @@ -2635,16 +2635,16 @@ mod tests { fn test_overflow_does_not_cause_segfault() { let mut v = vec![]; v.reserve_exact(-1); - v.push(1i); + v.push(1); v.push(2); } #[test] #[should_fail] fn test_overflow_does_not_cause_segfault_managed() { - let mut v = vec![Rc::new(1i)]; + let mut v = vec![Rc::new(1)]; v.reserve_exact(-1); - v.push(Rc::new(2i)); + v.push(Rc::new(2)); } #[test] @@ -2717,13 +2717,13 @@ mod tests { #[test] fn test_shrink_to_fit() { let mut xs = vec![0, 1, 2, 3]; - for i in 4i..100 { + for i in 4..100 { xs.push(i) } assert_eq!(xs.capacity(), 128); xs.shrink_to_fit(); assert_eq!(xs.capacity(), 100); - assert_eq!(xs, (0i..100i).collect::>()); + assert_eq!(xs, (0..100).collect::>()); } #[test] @@ -2756,14 +2756,14 @@ mod tests { #[test] fn test_mut_splitator() { - let mut xs = [0i,1,0,2,3,0,0,4,5,0]; + let mut xs = [0,1,0,2,3,0,0,4,5,0]; assert_eq!(xs.split_mut(|x| *x == 0).count(), 6); for slice in xs.split_mut(|x| *x == 0) { slice.reverse(); } assert!(xs == [0,1,0,3,2,0,0,5,4,0]); - let mut xs = [0i,1,0,2,3,0,0,4,5,0,6,7]; + let mut xs = [0,1,0,2,3,0,0,4,5,0,6,7]; for slice in xs.split_mut(|x| *x == 0).take(5) { slice.reverse(); } @@ -2772,7 +2772,7 @@ mod tests { #[test] fn test_mut_splitator_rev() { - let mut xs = [1i,2,0,3,4,0,0,5,6,0]; + let mut xs = [1,2,0,3,4,0,0,5,6,0]; for slice in xs.split_mut(|x| *x == 0).rev().take(4) { slice.reverse(); } @@ -2781,7 +2781,7 @@ mod tests { #[test] fn test_get_mut() { - let mut v = [0i,1,2]; + let mut v = [0,1,2]; assert_eq!(v.get_mut(3), None); v.get_mut(1).map(|e| *e = 7); assert_eq!(v[1], 7); @@ -2819,13 +2819,13 @@ mod tests { #[test] #[should_fail] fn test_mut_chunks_0() { - let mut v = [1i, 2, 3, 4]; + let mut v = [1, 2, 3, 4]; let _it = v.chunks_mut(0); } #[test] fn test_mut_last() { - let mut x = [1i, 2, 3, 4, 5]; + let mut x = [1, 2, 3, 4, 5]; let h = x.last_mut(); assert_eq!(*h.unwrap(), 5); @@ -2868,10 +2868,10 @@ mod bench { #[bench] fn mut_iterator(b: &mut Bencher) { - let mut v = repeat(0i).take(100).collect::>(); + let mut v = repeat(0).take(100).collect::>(); b.iter(|| { - let mut i = 0i; + let mut i = 0; for x in v.iter_mut() { *x = i; i += 1; @@ -3007,7 +3007,7 @@ mod bench { v.set_len(1024); } for x in v.iter_mut() { - *x = 0i; + *x = 0; } v }); diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 8f7920fe1c4..56f266b7ca6 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1291,8 +1291,8 @@ mod tests { #[test] fn test_simple_types() { - assert_eq!(1i.to_string(), "1"); - assert_eq!((-1i).to_string(), "-1"); + assert_eq!(1.to_string(), "1"); + assert_eq!((-1).to_string(), "-1"); assert_eq!(200u.to_string(), "200"); assert_eq!(2u8.to_string(), "2"); assert_eq!(true.to_string(), "true"); @@ -1304,9 +1304,9 @@ mod tests { fn test_vectors() { let x: Vec = vec![]; assert_eq!(format!("{:?}", x), "[]"); - assert_eq!(format!("{:?}", vec![1i]), "[1]"); - assert_eq!(format!("{:?}", vec![1i, 2, 3]), "[1, 2, 3]"); - assert!(format!("{:?}", vec![vec![], vec![1i], vec![1i, 1]]) == + assert_eq!(format!("{:?}", vec![1]), "[1]"); + assert_eq!(format!("{:?}", vec![1, 2, 3]), "[1, 2, 3]"); + assert!(format!("{:?}", vec![vec![], vec![1], vec![1, 1]]) == "[[], [1], [1, 1]]"); } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 336a3d7521a..8be29c45851 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -73,8 +73,8 @@ use core::uint; /// /// ``` /// let mut vec = Vec::new(); -/// vec.push(1i); -/// vec.push(2i); +/// vec.push(1); +/// vec.push(2); /// /// assert_eq!(vec.len(), 2); /// assert_eq!(vec[0], 1); @@ -82,7 +82,7 @@ use core::uint; /// assert_eq!(vec.pop(), Some(2)); /// assert_eq!(vec.len(), 1); /// -/// vec[0] = 7i; +/// vec[0] = 7; /// assert_eq!(vec[0], 7); /// /// vec.push_all(&[1, 2, 3]); @@ -90,13 +90,13 @@ use core::uint; /// for x in vec.iter() { /// println!("{}", x); /// } -/// assert_eq!(vec, vec![7i, 1, 2, 3]); +/// assert_eq!(vec, vec![7, 1, 2, 3]); /// ``` /// /// The `vec!` macro is provided to make initialization more convenient: /// /// ``` -/// let mut vec = vec![1i, 2i, 3i]; +/// let mut vec = vec![1, 2, 3]; /// vec.push(4); /// assert_eq!(vec, vec![1, 2, 3, 4]); /// ``` @@ -106,9 +106,9 @@ use core::uint; /// ``` /// let mut stack = Vec::new(); /// -/// stack.push(1i); -/// stack.push(2i); -/// stack.push(3i); +/// stack.push(1); +/// stack.push(2); +/// stack.push(3); /// /// loop { /// let top = match stack.pop() { @@ -186,7 +186,7 @@ impl Vec { /// assert_eq!(vec.len(), 0); /// /// // These are all done without reallocating... - /// for i in 0i..10 { + /// for i in 0..10 { /// vec.push(i); /// } /// @@ -220,7 +220,7 @@ impl Vec { /// use std::mem; /// /// fn main() { - /// let mut v = vec![1i, 2, 3]; + /// let mut v = vec![1, 2, 3]; /// /// // Pull out the various important pieces of information about `v` /// let p = v.as_mut_ptr(); @@ -239,7 +239,7 @@ impl Vec { /// /// // Put everything back together into a Vec /// let rebuilt = Vec::from_raw_parts(p, len, cap); - /// assert_eq!(rebuilt, vec![4i, 5i, 6i]); + /// assert_eq!(rebuilt, vec![4, 5, 6]); /// } /// } /// ``` @@ -395,7 +395,7 @@ impl Vec { /// # Examples /// /// ``` - /// let mut vec = vec![1i, 2, 3, 4]; + /// let mut vec = vec![1, 2, 3, 4]; /// vec.truncate(2); /// assert_eq!(vec, vec![1, 2]); /// ``` @@ -419,7 +419,7 @@ impl Vec { /// ``` /// fn foo(slice: &mut [int]) {} /// - /// let mut vec = vec![1i, 2]; + /// let mut vec = vec![1, 2]; /// foo(vec.as_mut_slice()); /// ``` #[inline] @@ -522,7 +522,7 @@ impl Vec { /// # Examples /// /// ``` - /// let mut vec = vec![1i, 2, 3]; + /// let mut vec = vec![1, 2, 3]; /// vec.insert(1, 4); /// assert_eq!(vec, vec![1, 4, 2, 3]); /// vec.insert(4, 5); @@ -560,7 +560,7 @@ impl Vec { /// # Examples /// /// ``` - /// let mut v = vec![1i, 2, 3]; + /// let mut v = vec![1, 2, 3]; /// assert_eq!(v.remove(1), 2); /// assert_eq!(v, vec![1, 3]); /// ``` @@ -594,7 +594,7 @@ impl Vec { /// # Examples /// /// ``` - /// let mut vec = vec![1i, 2, 3, 4]; + /// let mut vec = vec![1, 2, 3, 4]; /// vec.retain(|&x| x%2 == 0); /// assert_eq!(vec, vec![2, 4]); /// ``` @@ -627,7 +627,7 @@ impl Vec { /// # Examples /// /// ```rust - /// let mut vec = vec!(1i, 2); + /// let mut vec = vec!(1, 2); /// vec.push(3); /// assert_eq!(vec, vec!(1, 2, 3)); /// ``` @@ -665,7 +665,7 @@ impl Vec { /// # Examples /// /// ```rust - /// let mut vec = vec![1i, 2, 3]; + /// let mut vec = vec![1, 2, 3]; /// assert_eq!(vec.pop(), Some(3)); /// assert_eq!(vec, vec![1, 2]); /// ``` @@ -758,7 +758,7 @@ impl Vec { /// # Examples /// /// ``` - /// let mut v = vec![1i, 2, 3]; + /// let mut v = vec![1, 2, 3]; /// /// v.clear(); /// @@ -775,7 +775,7 @@ impl Vec { /// # Examples /// /// ``` - /// let a = vec![1i, 2, 3]; + /// let a = vec![1, 2, 3]; /// assert_eq!(a.len(), 3); /// ``` #[inline] @@ -790,7 +790,7 @@ impl Vec { /// let mut v = Vec::new(); /// assert!(v.is_empty()); /// - /// v.push(1i); + /// v.push(1); /// assert!(!v.is_empty()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -1045,7 +1045,7 @@ impl Vec { /// vec.resize(3, "world"); /// assert_eq!(vec, vec!["hello", "world", "world"]); /// - /// let mut vec = vec![1i, 2, 3, 4]; + /// let mut vec = vec![1, 2, 3, 4]; /// vec.resize(2, 0); /// assert_eq!(vec, vec![1, 2]); /// ``` @@ -1069,8 +1069,8 @@ impl Vec { /// # Examples /// /// ``` - /// let mut vec = vec![1i]; - /// vec.push_all(&[2i, 3, 4]); + /// let mut vec = vec![1]; + /// vec.push_all(&[2, 3, 4]); /// assert_eq!(vec, vec![1, 2, 3, 4]); /// ``` #[inline] @@ -1103,11 +1103,11 @@ impl Vec { /// # Examples /// /// ``` - /// let mut vec = vec![1i, 2, 2, 3, 2]; + /// let mut vec = vec![1, 2, 2, 3, 2]; /// /// vec.dedup(); /// - /// assert_eq!(vec, vec![1i, 2, 3, 2]); + /// assert_eq!(vec, vec![1, 2, 3, 2]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn dedup(&mut self) { @@ -1487,7 +1487,7 @@ impl AsSlice for Vec { /// ``` /// fn foo(slice: &[int]) {} /// - /// let vec = vec![1i, 2]; + /// let vec = vec![1, 2]; /// foo(vec.as_slice()); /// ``` #[inline] @@ -1969,7 +1969,7 @@ mod tests { v.reserve(2); assert!(v.capacity() >= 2); - for i in 0i..16 { + for i in 0..16 { v.push(i); } @@ -1988,13 +1988,13 @@ mod tests { let mut v = Vec::new(); let mut w = Vec::new(); - v.extend(0i..3); - for i in 0i..3 { w.push(i) } + v.extend(0..3); + for i in 0..3 { w.push(i) } assert_eq!(v, w); - v.extend(3i..10); - for i in 3i..10 { w.push(i) } + v.extend(3..10); + for i in 3..10 { w.push(i) } assert_eq!(v, w); } @@ -2055,7 +2055,7 @@ mod tests { #[test] fn test_clone() { let v: Vec = vec!(); - let w = vec!(1i, 2, 3); + let w = vec!(1, 2, 3); assert_eq!(v, v.clone()); @@ -2068,8 +2068,8 @@ mod tests { #[test] fn test_clone_from() { let mut v = vec!(); - let three = vec!(box 1i, box 2, box 3); - let two = vec!(box 4i, box 5); + let three = vec!(box 1, box 2, box 3); + let two = vec!(box 4, box 5); // zero, long v.clone_from(&three); assert_eq!(v, three); @@ -2128,14 +2128,14 @@ mod tests { #[test] fn test_partition() { assert_eq!(vec![].into_iter().partition(|x: &int| *x < 3), (vec![], vec![])); - assert_eq!(vec![1i, 2, 3].into_iter().partition(|x: &int| *x < 4), (vec![1, 2, 3], vec![])); - assert_eq!(vec![1i, 2, 3].into_iter().partition(|x: &int| *x < 2), (vec![1], vec![2, 3])); - assert_eq!(vec![1i, 2, 3].into_iter().partition(|x: &int| *x < 0), (vec![], vec![1, 2, 3])); + assert_eq!(vec![1, 2, 3].into_iter().partition(|x: &int| *x < 4), (vec![1, 2, 3], vec![])); + assert_eq!(vec![1, 2, 3].into_iter().partition(|x: &int| *x < 2), (vec![1], vec![2, 3])); + assert_eq!(vec![1, 2, 3].into_iter().partition(|x: &int| *x < 0), (vec![], vec![1, 2, 3])); } #[test] fn test_zip_unzip() { - let z1 = vec![(1i, 4i), (2, 5), (3, 6)]; + let z1 = vec![(1, 4), (2, 5), (3, 6)]; let (left, right): (Vec<_>, Vec<_>) = z1.iter().map(|&x| x).unzip(); @@ -2148,13 +2148,13 @@ mod tests { fn test_unsafe_ptrs() { unsafe { // Test on-stack copy-from-buf. - let a = [1i, 2, 3]; + let a = [1, 2, 3]; let ptr = a.as_ptr(); let b = Vec::from_raw_buf(ptr, 3u); assert_eq!(b, vec![1, 2, 3]); // Test on-heap copy-from-buf. - let c = vec![1i, 2, 3, 4, 5]; + let c = vec![1, 2, 3, 4, 5]; let ptr = c.as_ptr(); let d = Vec::from_raw_buf(ptr, 5u); assert_eq!(d, vec![1, 2, 3, 4, 5]); @@ -2198,14 +2198,14 @@ mod tests { #[test] fn test_index() { - let vec = vec!(1i, 2, 3); + let vec = vec!(1, 2, 3); assert!(vec[1] == 2); } #[test] #[should_fail] fn test_index_out_of_bounds() { - let vec = vec!(1i, 2, 3); + let vec = vec!(1, 2, 3); let _ = vec[3]; } @@ -2273,7 +2273,7 @@ mod tests { #[test] fn test_map_in_place() { let v = vec![0u, 1, 2]; - assert_eq!(v.map_in_place(|i: uint| i as int - 1), [-1i, 0, 1]); + assert_eq!(v.map_in_place(|i: uint| i as int - 1), [-1, 0, 1]); } #[test] diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 9f83b91fc9b..5022a96b9b0 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -768,7 +768,7 @@ mod test_map { #[test] fn test_get_mut() { let mut m = VecMap::new(); - assert!(m.insert(1, 12i).is_none()); + assert!(m.insert(1, 12).is_none()); assert!(m.insert(2, 8).is_none()); assert!(m.insert(5, 14).is_none()); let new = 100; @@ -783,7 +783,7 @@ mod test_map { let mut map = VecMap::new(); assert_eq!(map.len(), 0); assert!(map.is_empty()); - assert!(map.insert(5, 20i).is_none()); + assert!(map.insert(5, 20).is_none()); assert_eq!(map.len(), 1); assert!(!map.is_empty()); assert!(map.insert(11, 12).is_none()); @@ -797,7 +797,7 @@ mod test_map { #[test] fn test_clear() { let mut map = VecMap::new(); - assert!(map.insert(5, 20i).is_none()); + assert!(map.insert(5, 20).is_none()); assert!(map.insert(11, 12).is_none()); assert!(map.insert(14, 22).is_none()); map.clear(); @@ -810,15 +810,15 @@ mod test_map { #[test] fn test_insert() { let mut m = VecMap::new(); - assert_eq!(m.insert(1, 2i), None); - assert_eq!(m.insert(1, 3i), Some(2)); - assert_eq!(m.insert(1, 4i), Some(3)); + assert_eq!(m.insert(1, 2), None); + assert_eq!(m.insert(1, 3), Some(2)); + assert_eq!(m.insert(1, 4), Some(3)); } #[test] fn test_remove() { let mut m = VecMap::new(); - m.insert(1, 2i); + m.insert(1, 2); assert_eq!(m.remove(&1), Some(2)); assert_eq!(m.remove(&1), None); } @@ -853,7 +853,7 @@ mod test_map { fn test_iterator() { let mut m = VecMap::new(); - assert!(m.insert(0, 1i).is_none()); + assert!(m.insert(0, 1).is_none()); assert!(m.insert(1, 2).is_none()); assert!(m.insert(3, 5).is_none()); assert!(m.insert(6, 10).is_none()); @@ -878,7 +878,7 @@ mod test_map { fn test_iterator_size_hints() { let mut m = VecMap::new(); - assert!(m.insert(0, 1i).is_none()); + assert!(m.insert(0, 1).is_none()); assert!(m.insert(1, 2).is_none()); assert!(m.insert(3, 5).is_none()); assert!(m.insert(6, 10).is_none()); @@ -894,7 +894,7 @@ mod test_map { fn test_mut_iterator() { let mut m = VecMap::new(); - assert!(m.insert(0, 1i).is_none()); + assert!(m.insert(0, 1).is_none()); assert!(m.insert(1, 2).is_none()); assert!(m.insert(3, 5).is_none()); assert!(m.insert(6, 10).is_none()); @@ -917,7 +917,7 @@ mod test_map { fn test_rev_iterator() { let mut m = VecMap::new(); - assert!(m.insert(0, 1i).is_none()); + assert!(m.insert(0, 1).is_none()); assert!(m.insert(1, 2).is_none()); assert!(m.insert(3, 5).is_none()); assert!(m.insert(6, 10).is_none()); @@ -936,7 +936,7 @@ mod test_map { fn test_mut_rev_iterator() { let mut m = VecMap::new(); - assert!(m.insert(0, 1i).is_none()); + assert!(m.insert(0, 1).is_none()); assert!(m.insert(1, 2).is_none()); assert!(m.insert(3, 5).is_none()); assert!(m.insert(6, 10).is_none()); @@ -958,13 +958,13 @@ mod test_map { #[test] fn test_move_iter() { let mut m = VecMap::new(); - m.insert(1, box 2i); + m.insert(1, box 2); let mut called = false; for (k, v) in m.into_iter() { assert!(!called); called = true; assert_eq!(k, 1); - assert_eq!(v, box 2i); + assert_eq!(v, box 2); } assert!(called); } @@ -987,8 +987,8 @@ mod test_map { let mut map = VecMap::new(); let empty = VecMap::::new(); - map.insert(1, 2i); - map.insert(3, 4i); + map.insert(1, 2); + map.insert(3, 4); let map_str = format!("{:?}", map); assert!(map_str == "VecMap {1: 2, 3: 4}" || map_str == "{3: 4, 1: 2}"); @@ -1012,9 +1012,9 @@ mod test_map { let mut b = VecMap::new(); assert!(a == b); - assert!(a.insert(0, 5i).is_none()); + assert!(a.insert(0, 5).is_none()); assert!(a != b); - assert!(b.insert(0, 4i).is_none()); + assert!(b.insert(0, 4).is_none()); assert!(a != b); assert!(a.insert(5, 19).is_none()); assert!(a != b); @@ -1034,7 +1034,7 @@ mod test_map { let mut b = VecMap::new(); assert!(!(a < b) && !(b < a)); - assert!(b.insert(2u, 5i).is_none()); + assert!(b.insert(2u, 5).is_none()); assert!(a < b); assert!(a.insert(2, 7).is_none()); assert!(!(a < b) && b < a); @@ -1052,7 +1052,7 @@ mod test_map { let mut b = VecMap::new(); assert!(a <= b && a >= b); - assert!(a.insert(1u, 1i).is_none()); + assert!(a.insert(1u, 1).is_none()); assert!(a > b && a >= b); assert!(b < a && b <= a); assert!(b.insert(2, 2).is_none()); diff --git a/src/libcoretest/any.rs b/src/libcoretest/any.rs index 7c71c733662..5ad3833a5ef 100644 --- a/src/libcoretest/any.rs +++ b/src/libcoretest/any.rs @@ -123,7 +123,7 @@ fn any_fixed_vec() { #[bench] fn bench_downcast_ref(b: &mut Bencher) { b.iter(|| { - let mut x = 0i; + let mut x = 0; let mut y = &mut x as &mut Any; test::black_box(&mut y); test::black_box(y.downcast_ref::() == Some(&0)); diff --git a/src/libcoretest/cell.rs b/src/libcoretest/cell.rs index 8bd2ed95ed5..5815dbc0acc 100644 --- a/src/libcoretest/cell.rs +++ b/src/libcoretest/cell.rs @@ -14,14 +14,14 @@ use std::mem::drop; #[test] fn smoketest_cell() { - let x = Cell::new(10i); + let x = Cell::new(10); assert!(x == Cell::new(10)); assert!(x.get() == 10); x.set(20); assert!(x == Cell::new(20)); assert!(x.get() == 20); - let y = Cell::new((30i, 40i)); + let y = Cell::new((30, 40)); assert!(y == Cell::new((30, 40))); assert!(y.get() == (30, 40)); } @@ -50,35 +50,35 @@ fn ref_and_refmut_have_sensible_show() { #[test] fn double_imm_borrow() { - let x = RefCell::new(0i); + let x = RefCell::new(0); let _b1 = x.borrow(); x.borrow(); } #[test] fn no_mut_then_imm_borrow() { - let x = RefCell::new(0i); + let x = RefCell::new(0); let _b1 = x.borrow_mut(); assert!(x.try_borrow().is_none()); } #[test] fn no_imm_then_borrow_mut() { - let x = RefCell::new(0i); + let x = RefCell::new(0); let _b1 = x.borrow(); assert!(x.try_borrow_mut().is_none()); } #[test] fn no_double_borrow_mut() { - let x = RefCell::new(0i); + let x = RefCell::new(0); let _b1 = x.borrow_mut(); assert!(x.try_borrow_mut().is_none()); } #[test] fn imm_release_borrow_mut() { - let x = RefCell::new(0i); + let x = RefCell::new(0); { let _b1 = x.borrow(); } @@ -87,7 +87,7 @@ fn imm_release_borrow_mut() { #[test] fn mut_release_borrow_mut() { - let x = RefCell::new(0i); + let x = RefCell::new(0); { let _b1 = x.borrow_mut(); } @@ -96,7 +96,7 @@ fn mut_release_borrow_mut() { #[test] fn double_borrow_single_release_no_borrow_mut() { - let x = RefCell::new(0i); + let x = RefCell::new(0); let _b1 = x.borrow(); { let _b2 = x.borrow(); @@ -107,7 +107,7 @@ fn double_borrow_single_release_no_borrow_mut() { #[test] #[should_fail] fn discard_doesnt_unborrow() { - let x = RefCell::new(0i); + let x = RefCell::new(0); let _b = x.borrow(); let _ = _b; let _b = x.borrow_mut(); @@ -115,7 +115,7 @@ fn discard_doesnt_unborrow() { #[test] fn clone_ref_updates_flag() { - let x = RefCell::new(0i); + let x = RefCell::new(0); { let b1 = x.borrow(); assert!(x.try_borrow_mut().is_none()); diff --git a/src/libcoretest/clone.rs b/src/libcoretest/clone.rs index 67c30d945d4..5ab6ab27ba1 100644 --- a/src/libcoretest/clone.rs +++ b/src/libcoretest/clone.rs @@ -10,7 +10,7 @@ #[test] fn test_borrowed_clone() { - let x = 5i; + let x = 5; let y: &int = &x; let z: &int = (&y).clone(); assert_eq!(*z, 5); @@ -18,8 +18,8 @@ fn test_borrowed_clone() { #[test] fn test_clone_from() { - let a = box 5i; - let mut b = box 10i; + let a = box 5; + let mut b = box 10; b.clone_from(&a); assert_eq!(*b, 5); } diff --git a/src/libcoretest/cmp.rs b/src/libcoretest/cmp.rs index 992c99f1f9f..6bc1f14cc5a 100644 --- a/src/libcoretest/cmp.rs +++ b/src/libcoretest/cmp.rs @@ -13,20 +13,20 @@ use core::cmp::Ordering::{Less, Greater, Equal}; #[test] fn test_int_totalord() { - assert_eq!(5i.cmp(&10), Less); - assert_eq!(10i.cmp(&5), Greater); - assert_eq!(5i.cmp(&5), Equal); - assert_eq!((-5i).cmp(&12), Less); - assert_eq!(12i.cmp(&-5), Greater); + assert_eq!(5.cmp(&10), Less); + assert_eq!(10.cmp(&5), Greater); + assert_eq!(5.cmp(&5), Equal); + assert_eq!((-5).cmp(&12), Less); + assert_eq!(12.cmp(&-5), Greater); } #[test] fn test_mut_int_totalord() { - assert_eq!((&mut 5i).cmp(&&mut 10), Less); - assert_eq!((&mut 10i).cmp(&&mut 5), Greater); - assert_eq!((&mut 5i).cmp(&&mut 5), Equal); - assert_eq!((&mut -5i).cmp(&&mut 12), Less); - assert_eq!((&mut 12i).cmp(&&mut -5), Greater); + assert_eq!((&mut 5).cmp(&&mut 10), Less); + assert_eq!((&mut 10).cmp(&&mut 5), Greater); + assert_eq!((&mut 5).cmp(&&mut 5), Equal); + assert_eq!((&mut -5).cmp(&&mut 12), Less); + assert_eq!((&mut 12).cmp(&&mut -5), Greater); } #[test] @@ -47,11 +47,11 @@ fn test_partial_min() { use core::f64::NAN; let data_integer = [ // a, b, result - (0i, 0i, Some(0i)), - (1i, 0i, Some(0i)), - (0i, 1i, Some(0i)), - (-1i, 0i, Some(-1i)), - (0i, -1i, Some(-1i)) + (0, 0, Some(0)), + (1, 0, Some(0)), + (0, 1, Some(0)), + (-1, 0, Some(-1)), + (0, -1, Some(-1)) ]; let data_float = [ @@ -80,11 +80,11 @@ fn test_partial_max() { use core::f64::NAN; let data_integer = [ // a, b, result - (0i, 0i, Some(0i)), - (1i, 0i, Some(1i)), - (0i, 1i, Some(1i)), - (-1i, 0i, Some(0i)), - (0i, -1i, Some(0i)) + (0, 0, Some(0)), + (1, 0, Some(1)), + (0, 1, Some(1)), + (-1, 0, Some(0)), + (0, -1, Some(0)) ]; let data_float = [ diff --git a/src/libcoretest/finally.rs b/src/libcoretest/finally.rs index 6ec87203e00..22917b09ce9 100644 --- a/src/libcoretest/finally.rs +++ b/src/libcoretest/finally.rs @@ -15,7 +15,7 @@ use std::thread::Thread; #[test] fn test_success() { - let mut i = 0i; + let mut i = 0; try_finally( &mut i, (), |i, ()| { @@ -32,7 +32,7 @@ fn test_success() { #[test] #[should_fail] fn test_fail() { - let mut i = 0i; + let mut i = 0; try_finally( &mut i, (), |i, ()| { @@ -47,7 +47,7 @@ fn test_fail() { #[test] fn test_retval() { - let mut closure = |&mut:| 10i; + let mut closure = |&mut:| 10; let i = closure.finally(|| { }); assert_eq!(i, 10); } diff --git a/src/libcoretest/hash/mod.rs b/src/libcoretest/hash/mod.rs index d48820aee06..f83b03d845b 100644 --- a/src/libcoretest/hash/mod.rs +++ b/src/libcoretest/hash/mod.rs @@ -56,7 +56,7 @@ fn test_writer_hasher() { assert_eq!(hash(&5i16), 5); assert_eq!(hash(&5i32), 5); assert_eq!(hash(&5i64), 5); - assert_eq!(hash(&5i), 5); + assert_eq!(hash(&5), 5); assert_eq!(hash(&false), 0); assert_eq!(hash(&true), 1); @@ -76,12 +76,12 @@ fn test_writer_hasher() { // FIXME (#18248) Add tests for hashing Rc and Rc<[T]> unsafe { - let ptr: *const int = mem::transmute(5i); + let ptr: *const int = mem::transmute(5); assert_eq!(hash(&ptr), 5); } unsafe { - let ptr: *mut int = mem::transmute(5i); + let ptr: *mut int = mem::transmute(5); assert_eq!(hash(&ptr), 5); } } diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index 8bcd4982fba..e6b0265576c 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -20,8 +20,8 @@ use test::Bencher; #[test] fn test_lt() { let empty: [int; 0] = []; - let xs = [1i,2,3]; - let ys = [1i,2,0]; + let xs = [1,2,3]; + let ys = [1,2,0]; assert!(!lt(xs.iter(), ys.iter())); assert!(!le(xs.iter(), ys.iter())); @@ -64,15 +64,15 @@ fn test_lt() { #[test] fn test_multi_iter() { - let xs = [1i,2,3,4]; - let ys = [4i,3,2,1]; + let xs = [1,2,3,4]; + let ys = [4,3,2,1]; assert!(eq(xs.iter(), ys.iter().rev())); assert!(lt(xs.iter(), xs.iter().skip(2))); } #[test] fn test_counter_from_iter() { - let it = count(0i, 5).take(10); + let it = count(0, 5).take(10); let xs: Vec = FromIterator::from_iter(it); assert!(xs == vec![0, 5, 10, 15, 20, 25, 30, 35, 40, 45]); } @@ -304,7 +304,7 @@ fn test_cycle() { #[test] fn test_iterator_nth() { - let v: &[_] = &[0i, 1, 2, 3, 4]; + let v: &[_] = &[0, 1, 2, 3, 4]; for i in 0u..v.len() { assert_eq!(v.iter().nth(i).unwrap(), &v[i]); } @@ -313,14 +313,14 @@ fn test_iterator_nth() { #[test] fn test_iterator_last() { - let v: &[_] = &[0i, 1, 2, 3, 4]; + let v: &[_] = &[0, 1, 2, 3, 4]; assert_eq!(v.iter().last().unwrap(), &4); assert_eq!(v[..1].iter().last().unwrap(), &0); } #[test] fn test_iterator_len() { - let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(v[..4].iter().count(), 4); assert_eq!(v[..10].iter().count(), 10); assert_eq!(v[..0].iter().count(), 0); @@ -328,7 +328,7 @@ fn test_iterator_len() { #[test] fn test_iterator_sum() { - let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(v[..4].iter().map(|&x| x).sum(), 6); assert_eq!(v.iter().map(|&x| x).sum(), 55); assert_eq!(v[..0].iter().map(|&x| x).sum(), 0); @@ -336,7 +336,7 @@ fn test_iterator_sum() { #[test] fn test_iterator_product() { - let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(v[..4].iter().map(|&x| x).product(), 0); assert_eq!(v[1..5].iter().map(|&x| x).product(), 24); assert_eq!(v[..0].iter().map(|&x| x).product(), 1); @@ -344,7 +344,7 @@ fn test_iterator_product() { #[test] fn test_iterator_max() { - let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(v[..4].iter().map(|&x| x).max(), Some(3)); assert_eq!(v.iter().map(|&x| x).max(), Some(10)); assert_eq!(v[..0].iter().map(|&x| x).max(), None); @@ -352,7 +352,7 @@ fn test_iterator_max() { #[test] fn test_iterator_min() { - let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(v[..4].iter().map(|&x| x).min(), Some(0)); assert_eq!(v.iter().map(|&x| x).min(), Some(0)); assert_eq!(v[..0].iter().map(|&x| x).min(), None); @@ -360,9 +360,9 @@ fn test_iterator_min() { #[test] fn test_iterator_size_hint() { - let c = count(0i, 1); - let v: &[_] = &[0i, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - let v2 = &[10i, 11, 12]; + let c = count(0, 1); + let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + let v2 = &[10, 11, 12]; let vi = v.iter(); assert_eq!(c.size_hint(), (uint::MAX, None)); @@ -375,10 +375,10 @@ fn test_iterator_size_hint() { assert_eq!(c.enumerate().size_hint(), (uint::MAX, None)); assert_eq!(c.chain(vi.map(|&i| i)).size_hint(), (uint::MAX, None)); assert_eq!(c.zip(vi).size_hint(), (10, Some(10))); - assert_eq!(c.scan(0i, |_,_| Some(0i)).size_hint(), (0, None)); + assert_eq!(c.scan(0, |_,_| Some(0)).size_hint(), (0, None)); assert_eq!(c.filter(|_| false).size_hint(), (0, None)); - assert_eq!(c.map(|_| 0i).size_hint(), (uint::MAX, None)); - assert_eq!(c.filter_map(|_| Some(0i)).size_hint(), (0, None)); + assert_eq!(c.map(|_| 0).size_hint(), (uint::MAX, None)); + assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, None)); assert_eq!(vi.take(5).size_hint(), (5, Some(5))); assert_eq!(vi.take(12).size_hint(), (10, Some(10))); @@ -389,22 +389,22 @@ fn test_iterator_size_hint() { assert_eq!(vi.enumerate().size_hint(), (10, Some(10))); assert_eq!(vi.chain(v2.iter()).size_hint(), (13, Some(13))); assert_eq!(vi.zip(v2.iter()).size_hint(), (3, Some(3))); - assert_eq!(vi.scan(0i, |_,_| Some(0i)).size_hint(), (0, Some(10))); + assert_eq!(vi.scan(0, |_,_| Some(0)).size_hint(), (0, Some(10))); assert_eq!(vi.filter(|_| false).size_hint(), (0, Some(10))); assert_eq!(vi.map(|&i| i+1).size_hint(), (10, Some(10))); - assert_eq!(vi.filter_map(|_| Some(0i)).size_hint(), (0, Some(10))); + assert_eq!(vi.filter_map(|_| Some(0)).size_hint(), (0, Some(10))); } #[test] fn test_collect() { - let a = vec![1i, 2, 3, 4, 5]; + let a = vec![1, 2, 3, 4, 5]; let b: Vec = a.iter().map(|&x| x).collect(); assert!(a == b); } #[test] fn test_all() { - let v: Box<[int]> = box [1i, 2, 3, 4, 5]; + let v: Box<[int]> = box [1, 2, 3, 4, 5]; assert!(v.iter().all(|&x| x < 10)); assert!(!v.iter().all(|&x| x % 2 == 0)); assert!(!v.iter().all(|&x| x > 100)); @@ -413,7 +413,7 @@ fn test_all() { #[test] fn test_any() { - let v: Box<[int]> = box [1i, 2, 3, 4, 5]; + let v: Box<[int]> = box [1, 2, 3, 4, 5]; assert!(v.iter().any(|&x| x < 10)); assert!(v.iter().any(|&x| x % 2 == 0)); assert!(!v.iter().any(|&x| x > 100)); @@ -422,7 +422,7 @@ fn test_any() { #[test] fn test_find() { - let v: &[int] = &[1i, 3, 9, 27, 103, 14, 11]; + let v: &[int] = &[1, 3, 9, 27, 103, 14, 11]; assert_eq!(*v.iter().find(|&&x| x & 1 == 0).unwrap(), 14); assert_eq!(*v.iter().find(|&&x| x % 3 == 0).unwrap(), 3); assert!(v.iter().find(|&&x| x % 12 == 0).is_none()); @@ -430,7 +430,7 @@ fn test_find() { #[test] fn test_position() { - let v = &[1i, 3, 9, 27, 103, 14, 11]; + let v = &[1, 3, 9, 27, 103, 14, 11]; assert_eq!(v.iter().position(|x| *x & 1 == 0).unwrap(), 5); assert_eq!(v.iter().position(|x| *x % 3 == 0).unwrap(), 1); assert!(v.iter().position(|x| *x % 12 == 0).is_none()); @@ -438,7 +438,7 @@ fn test_position() { #[test] fn test_count() { - let xs = &[1i, 2, 2, 1, 5, 9, 0, 2]; + let xs = &[1, 2, 2, 1, 5, 9, 0, 2]; assert_eq!(xs.iter().filter(|x| **x == 2).count(), 3); assert_eq!(xs.iter().filter(|x| **x == 5).count(), 1); assert_eq!(xs.iter().filter(|x| **x == 95).count(), 0); @@ -446,19 +446,19 @@ fn test_count() { #[test] fn test_max_by() { - let xs: &[int] = &[-3i, 0, 1, 5, -10]; + let xs: &[int] = &[-3, 0, 1, 5, -10]; assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10); } #[test] fn test_min_by() { - let xs: &[int] = &[-3i, 0, 1, 5, -10]; + let xs: &[int] = &[-3, 0, 1, 5, -10]; assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0); } #[test] fn test_by_ref() { - let mut xs = 0i..10; + let mut xs = 0..10; // sum the first five values let partial_sum = xs.by_ref().take(5).fold(0, |a, b| a + b); assert_eq!(partial_sum, 10); @@ -467,7 +467,7 @@ fn test_by_ref() { #[test] fn test_rev() { - let xs = [2i, 4, 6, 8, 10, 12, 14, 16]; + let xs = [2, 4, 6, 8, 10, 12, 14, 16]; let mut it = xs.iter(); it.next(); it.next(); @@ -494,7 +494,7 @@ fn test_cloned() { #[test] fn test_double_ended_map() { - let xs = [1i, 2, 3, 4, 5, 6]; + let xs = [1, 2, 3, 4, 5, 6]; let mut it = xs.iter().map(|&x| x * -1); assert_eq!(it.next(), Some(-1)); assert_eq!(it.next(), Some(-2)); @@ -507,7 +507,7 @@ fn test_double_ended_map() { #[test] fn test_double_ended_enumerate() { - let xs = [1i, 2, 3, 4, 5, 6]; + let xs = [1, 2, 3, 4, 5, 6]; let mut it = xs.iter().map(|&x| x).enumerate(); assert_eq!(it.next(), Some((0, 1))); assert_eq!(it.next(), Some((1, 2))); @@ -520,8 +520,8 @@ fn test_double_ended_enumerate() { #[test] fn test_double_ended_zip() { - let xs = [1i, 2, 3, 4, 5, 6]; - let ys = [1i, 2, 3, 7]; + let xs = [1, 2, 3, 4, 5, 6]; + let ys = [1, 2, 3, 7]; let a = xs.iter().map(|&x| x); let b = ys.iter().map(|&x| x); let mut it = a.zip(b); @@ -534,7 +534,7 @@ fn test_double_ended_zip() { #[test] fn test_double_ended_filter() { - let xs = [1i, 2, 3, 4, 5, 6]; + let xs = [1, 2, 3, 4, 5, 6]; let mut it = xs.iter().filter(|&x| *x & 1 == 0); assert_eq!(it.next_back().unwrap(), &6); assert_eq!(it.next_back().unwrap(), &4); @@ -544,7 +544,7 @@ fn test_double_ended_filter() { #[test] fn test_double_ended_filter_map() { - let xs = [1i, 2, 3, 4, 5, 6]; + let xs = [1, 2, 3, 4, 5, 6]; let mut it = xs.iter().filter_map(|&x| if x & 1 == 0 { Some(x * 2) } else { None }); assert_eq!(it.next_back().unwrap(), 12); assert_eq!(it.next_back().unwrap(), 8); @@ -554,8 +554,8 @@ fn test_double_ended_filter_map() { #[test] fn test_double_ended_chain() { - let xs = [1i, 2, 3, 4, 5]; - let ys = [7i, 9, 11]; + let xs = [1, 2, 3, 4, 5]; + let ys = [7, 9, 11]; let mut it = xs.iter().chain(ys.iter()).rev(); assert_eq!(it.next().unwrap(), &11); assert_eq!(it.next().unwrap(), &9); @@ -572,7 +572,7 @@ fn test_double_ended_chain() { fn test_rposition() { fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' } fn g(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'd' } - let v = [(0i, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; + let v = [(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; assert_eq!(v.iter().rposition(f), Some(3u)); assert!(v.iter().rposition(g).is_none()); @@ -581,9 +581,9 @@ fn test_rposition() { #[test] #[should_fail] fn test_rposition_panic() { - let v = [(box 0i, box 0i), (box 0i, box 0i), - (box 0i, box 0i), (box 0i, box 0i)]; - let mut i = 0i; + let v = [(box 0, box 0), (box 0, box 0), + (box 0, box 0), (box 0, box 0)]; + let mut i = 0; v.iter().rposition(|_elt| { if i == 2 { panic!() @@ -635,8 +635,8 @@ fn test_double_ended_flat_map() { #[test] fn test_random_access_chain() { - let xs = [1i, 2, 3, 4, 5]; - let ys = [7i, 9, 11]; + let xs = [1, 2, 3, 4, 5]; + let ys = [7, 9, 11]; let mut it = xs.iter().chain(ys.iter()); assert_eq!(it.idx(0).unwrap(), &1); assert_eq!(it.idx(5).unwrap(), &7); @@ -656,13 +656,13 @@ fn test_random_access_chain() { #[test] fn test_random_access_enumerate() { - let xs = [1i, 2, 3, 4, 5]; + let xs = [1, 2, 3, 4, 5]; check_randacc_iter(xs.iter().enumerate(), xs.len()); } #[test] fn test_random_access_rev() { - let xs = [1i, 2, 3, 4, 5]; + let xs = [1, 2, 3, 4, 5]; check_randacc_iter(xs.iter().rev(), xs.len()); let mut it = xs.iter().rev(); it.next(); @@ -673,14 +673,14 @@ fn test_random_access_rev() { #[test] fn test_random_access_zip() { - let xs = [1i, 2, 3, 4, 5]; - let ys = [7i, 9, 11]; + let xs = [1, 2, 3, 4, 5]; + let ys = [7, 9, 11]; check_randacc_iter(xs.iter().zip(ys.iter()), cmp::min(xs.len(), ys.len())); } #[test] fn test_random_access_take() { - let xs = [1i, 2, 3, 4, 5]; + let xs = [1, 2, 3, 4, 5]; let empty: &[int] = &[]; check_randacc_iter(xs.iter().take(3), 3); check_randacc_iter(xs.iter().take(20), xs.len()); @@ -690,7 +690,7 @@ fn test_random_access_take() { #[test] fn test_random_access_skip() { - let xs = [1i, 2, 3, 4, 5]; + let xs = [1, 2, 3, 4, 5]; let empty: &[int] = &[]; check_randacc_iter(xs.iter().skip(2), xs.len() - 2); check_randacc_iter(empty.iter().skip(2), 0); @@ -698,7 +698,7 @@ fn test_random_access_skip() { #[test] fn test_random_access_inspect() { - let xs = [1i, 2, 3, 4, 5]; + let xs = [1, 2, 3, 4, 5]; // test .map and .inspect that don't implement Clone let mut it = xs.iter().inspect(|_| {}); @@ -711,7 +711,7 @@ fn test_random_access_inspect() { #[test] fn test_random_access_map() { - let xs = [1i, 2, 3, 4, 5]; + let xs = [1, 2, 3, 4, 5]; let mut it = xs.iter().map(|x| *x); assert_eq!(xs.len(), it.indexable()); @@ -722,7 +722,7 @@ fn test_random_access_map() { #[test] fn test_random_access_cycle() { - let xs = [1i, 2, 3, 4, 5]; + let xs = [1, 2, 3, 4, 5]; let empty: &[int] = &[]; check_randacc_iter(xs.iter().cycle().take(27), 27); check_randacc_iter(empty.iter().cycle(), 0); @@ -730,8 +730,8 @@ fn test_random_access_cycle() { #[test] fn test_double_ended_range() { - assert!((11i..14).rev().collect::>() == vec![13i, 12, 11]); - for _ in (10i..0).rev() { + assert!((11..14).rev().collect::>() == vec![13, 12, 11]); + for _ in (10..0).rev() { panic!("unreachable"); } @@ -743,73 +743,73 @@ fn test_double_ended_range() { #[test] fn test_range() { - assert!((0i..5).collect::>() == vec![0i, 1, 2, 3, 4]); - assert!((-10i..-1).collect::>() == + assert!((0..5).collect::>() == vec![0, 1, 2, 3, 4]); + assert!((-10..-1).collect::>() == vec![-10, -9, -8, -7, -6, -5, -4, -3, -2]); - assert!((0i..5).rev().collect::>() == vec![4, 3, 2, 1, 0]); - assert_eq!((200i..-5).count(), 0); - assert_eq!((200i..-5).rev().count(), 0); - assert_eq!((200i..200).count(), 0); - assert_eq!((200i..200).rev().count(), 0); + assert!((0..5).rev().collect::>() == vec![4, 3, 2, 1, 0]); + assert_eq!((200..-5).count(), 0); + assert_eq!((200..-5).rev().count(), 0); + assert_eq!((200..200).count(), 0); + assert_eq!((200..200).rev().count(), 0); - assert_eq!((0i..100).size_hint(), (100, Some(100))); + assert_eq!((0..100).size_hint(), (100, Some(100))); // this test is only meaningful when sizeof uint < sizeof u64 assert_eq!((uint::MAX - 1..uint::MAX).size_hint(), (1, Some(1))); - assert_eq!((-10i..-1).size_hint(), (9, Some(9))); + assert_eq!((-10..-1).size_hint(), (9, Some(9))); } #[test] fn test_range_inclusive() { - assert!(range_inclusive(0i, 5).collect::>() == - vec![0i, 1, 2, 3, 4, 5]); - assert!(range_inclusive(0i, 5).rev().collect::>() == - vec![5i, 4, 3, 2, 1, 0]); - assert_eq!(range_inclusive(200i, -5).count(), 0); - assert_eq!(range_inclusive(200i, -5).rev().count(), 0); - assert!(range_inclusive(200i, 200).collect::>() == vec![200]); - assert!(range_inclusive(200i, 200).rev().collect::>() == vec![200]); + assert!(range_inclusive(0, 5).collect::>() == + vec![0, 1, 2, 3, 4, 5]); + assert!(range_inclusive(0, 5).rev().collect::>() == + vec![5, 4, 3, 2, 1, 0]); + assert_eq!(range_inclusive(200, -5).count(), 0); + assert_eq!(range_inclusive(200, -5).rev().count(), 0); + assert!(range_inclusive(200, 200).collect::>() == vec![200]); + assert!(range_inclusive(200, 200).rev().collect::>() == vec![200]); } #[test] fn test_range_step() { - assert!(range_step(0i, 20, 5).collect::>() == + assert!(range_step(0, 20, 5).collect::>() == vec![0, 5, 10, 15]); - assert!(range_step(20i, 0, -5).collect::>() == + assert!(range_step(20, 0, -5).collect::>() == vec![20, 15, 10, 5]); - assert!(range_step(20i, 0, -6).collect::>() == + assert!(range_step(20, 0, -6).collect::>() == vec![20, 14, 8, 2]); assert!(range_step(200u8, 255, 50).collect::>() == vec![200u8, 250]); - assert!(range_step(200i, -5, 1).collect::>() == vec![]); - assert!(range_step(200i, 200, 1).collect::>() == vec![]); + assert!(range_step(200, -5, 1).collect::>() == vec![]); + assert!(range_step(200, 200, 1).collect::>() == vec![]); } #[test] fn test_range_step_inclusive() { - assert!(range_step_inclusive(0i, 20, 5).collect::>() == + assert!(range_step_inclusive(0, 20, 5).collect::>() == vec![0, 5, 10, 15, 20]); - assert!(range_step_inclusive(20i, 0, -5).collect::>() == + assert!(range_step_inclusive(20, 0, -5).collect::>() == vec![20, 15, 10, 5, 0]); - assert!(range_step_inclusive(20i, 0, -6).collect::>() == + assert!(range_step_inclusive(20, 0, -6).collect::>() == vec![20, 14, 8, 2]); assert!(range_step_inclusive(200u8, 255, 50).collect::>() == vec![200u8, 250]); - assert!(range_step_inclusive(200i, -5, 1).collect::>() == + assert!(range_step_inclusive(200, -5, 1).collect::>() == vec![]); - assert!(range_step_inclusive(200i, 200, 1).collect::>() == + assert!(range_step_inclusive(200, 200, 1).collect::>() == vec![200]); } #[test] fn test_reverse() { - let mut ys = [1i, 2, 3, 4, 5]; + let mut ys = [1, 2, 3, 4, 5]; ys.iter_mut().reverse_in_place(); assert!(ys == [5, 4, 3, 2, 1]); } #[test] fn test_peekable_is_empty() { - let a = [1i]; + let a = [1]; let mut it = a.iter().peekable(); assert!( !it.is_empty() ); it.next(); @@ -821,16 +821,16 @@ fn test_min_max() { let v: [int; 0] = []; assert_eq!(v.iter().min_max(), NoElements); - let v = [1i]; + let v = [1]; assert!(v.iter().min_max() == OneElement(&1)); - let v = [1i, 2, 3, 4, 5]; + let v = [1, 2, 3, 4, 5]; assert!(v.iter().min_max() == MinMax(&1, &5)); - let v = [1i, 2, 3, 4, 5, 6]; + let v = [1, 2, 3, 4, 5, 6]; assert!(v.iter().min_max() == MinMax(&1, &6)); - let v = [1i, 1, 1, 1]; + let v = [1, 1, 1, 1]; assert!(v.iter().min_max() == MinMax(&1, &1)); } @@ -839,10 +839,10 @@ fn test_min_max_result() { let r: MinMaxResult = NoElements; assert_eq!(r.into_option(), None); - let r = OneElement(1i); + let r = OneElement(1); assert_eq!(r.into_option(), Some((1,1))); - let r = MinMax(1i,2); + let r = MinMax(1,2); assert_eq!(r.into_option(), Some((1,2))); } diff --git a/src/libcoretest/mem.rs b/src/libcoretest/mem.rs index 3dc209e6fcb..fd9dc696bdf 100644 --- a/src/libcoretest/mem.rs +++ b/src/libcoretest/mem.rs @@ -70,8 +70,8 @@ fn align_of_val_basic() { #[test] fn test_swap() { - let mut x = 31337i; - let mut y = 42i; + let mut x = 31337; + let mut y = 42; swap(&mut x, &mut y); assert_eq!(x, 42); assert_eq!(y, 31337); @@ -87,7 +87,7 @@ fn test_replace() { #[test] fn test_transmute_copy() { - assert_eq!(1u, unsafe { transmute_copy(&1i) }); + assert_eq!(1u, unsafe { transmute_copy(&1) }); } #[test] @@ -95,7 +95,7 @@ fn test_transmute() { trait Foo {} impl Foo for int {} - let a = box 100i as Box; + let a = box 100 as Box; unsafe { let x: ::core::raw::TraitObject = transmute(a); assert!(*(x.data as *const int) == 100); @@ -146,7 +146,7 @@ fn trait_static_method_call(b: &mut Bencher) { #[bench] fn match_option_some(b: &mut Bencher) { - let x = Some(10i); + let x = Some(10); b.iter(|| { match x { Some(y) => y, @@ -157,11 +157,11 @@ fn match_option_some(b: &mut Bencher) { #[bench] fn match_vec_pattern(b: &mut Bencher) { - let x = [1i,2,3,4,5,6]; + let x = [1,2,3,4,5,6]; b.iter(|| { match x { - [1,2,3,..] => 10i, - _ => 11i, + [1,2,3,..] => 10, + _ => 11, } }); } diff --git a/src/libcoretest/nonzero.rs b/src/libcoretest/nonzero.rs index ab2f6da1cf7..be4c83d23e8 100644 --- a/src/libcoretest/nonzero.rs +++ b/src/libcoretest/nonzero.rs @@ -16,7 +16,7 @@ use std::mem::size_of; #[test] fn test_create_nonzero_instance() { let _a = unsafe { - NonZero::new(21i) + NonZero::new(21) }; } @@ -28,14 +28,14 @@ fn test_size_nonzero_in_option() { #[test] fn test_match_on_nonzero_option() { let a = Some(unsafe { - NonZero::new(42i) + NonZero::new(42) }); match a { Some(val) => assert_eq!(*val, 42), None => panic!("unexpected None while matching on Some(NonZero(_))") } - match unsafe { Some(NonZero::new(43i)) } { + match unsafe { Some(NonZero::new(43)) } { Some(val) => assert_eq!(*val, 43), None => panic!("unexpected None while matching on Some(NonZero(_))") } @@ -52,9 +52,9 @@ fn test_match_option_empty_vec() { #[test] fn test_match_option_vec() { - let a = Some(vec![1i, 2, 3, 4]); + let a = Some(vec![1, 2, 3, 4]); match a { - Some(v) => assert_eq!(v, vec![1i, 2, 3, 4]), + Some(v) => assert_eq!(v, vec![1, 2, 3, 4]), None => panic!("unexpected None while matching on Some(vec![1, 2, 3, 4])") } } @@ -63,9 +63,9 @@ fn test_match_option_vec() { fn test_match_option_rc() { use std::rc::Rc; - let five = Rc::new(5i); + let five = Rc::new(5); match Some(five) { - Some(r) => assert_eq!(*r, 5i), + Some(r) => assert_eq!(*r, 5), None => panic!("unexpected None while matching on Some(Rc::new(5))") } } @@ -74,9 +74,9 @@ fn test_match_option_rc() { fn test_match_option_arc() { use std::sync::Arc; - let five = Arc::new(5i); + let five = Arc::new(5); match Some(five) { - Some(a) => assert_eq!(*a, 5i), + Some(a) => assert_eq!(*a, 5), None => panic!("unexpected None while matching on Some(Arc::new(5))") } } diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs index b98432e26b2..f89733e766b 100644 --- a/src/libcoretest/num/int_macros.rs +++ b/src/libcoretest/num/int_macros.rs @@ -151,8 +151,8 @@ mod tests { #[test] fn test_signed_checked_div() { - assert!(10i.checked_div(2) == Some(5)); - assert!(5i.checked_div(0) == None); + assert!(10.checked_div(2) == Some(5)); + assert!(5.checked_div(0) == None); assert!(int::MIN.checked_div(-1) == None); } diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs index e0623bade5c..0b013359f7e 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -40,11 +40,11 @@ pub fn test_num(ten: T, two: T) where + Rem + Debug + Copy { - assert_eq!(ten.add(two), cast(12i).unwrap()); - assert_eq!(ten.sub(two), cast(8i).unwrap()); - assert_eq!(ten.mul(two), cast(20i).unwrap()); - assert_eq!(ten.div(two), cast(5i).unwrap()); - assert_eq!(ten.rem(two), cast(0i).unwrap()); + assert_eq!(ten.add(two), cast(12).unwrap()); + assert_eq!(ten.sub(two), cast(8).unwrap()); + assert_eq!(ten.mul(two), cast(20).unwrap()); + assert_eq!(ten.div(two), cast(5).unwrap()); + assert_eq!(ten.rem(two), cast(0).unwrap()); assert_eq!(ten.add(two), ten + two); assert_eq!(ten.sub(two), ten - two); diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs index bb9d1524786..b32ae68b5d3 100644 --- a/src/libcoretest/option.rs +++ b/src/libcoretest/option.rs @@ -16,7 +16,7 @@ use core::clone::Clone; #[test] fn test_get_ptr() { unsafe { - let x = box 0i; + let x = box 0; let addr_x: *const int = mem::transmute(&*x); let opt = Some(x); let y = opt.unwrap(); @@ -59,7 +59,7 @@ fn test_get_resource() { } } - let i = Rc::new(RefCell::new(0i)); + let i = Rc::new(RefCell::new(0)); { let x = r(i.clone()); let opt = Some(x); @@ -71,7 +71,7 @@ fn test_get_resource() { #[test] fn test_option_dance() { let x = Some(()); - let mut y = Some(5i); + let mut y = Some(5); let mut y2 = 0; for _x in x.iter() { y2 = y.take().unwrap(); @@ -89,12 +89,12 @@ fn test_option_too_much_dance() { #[test] fn test_and() { - let x: Option = Some(1i); - assert_eq!(x.and(Some(2i)), Some(2)); + let x: Option = Some(1); + assert_eq!(x.and(Some(2)), Some(2)); assert_eq!(x.and(None::), None); let x: Option = None; - assert_eq!(x.and(Some(2i)), None); + assert_eq!(x.and(Some(2)), None); assert_eq!(x.and(None::), None); } @@ -133,7 +133,7 @@ fn test_or_else() { #[test] fn test_unwrap() { - assert_eq!(Some(1i).unwrap(), 1); + assert_eq!(Some(1).unwrap(), 1); let s = Some("hello".to_string()).unwrap(); assert_eq!(s, "hello"); } @@ -172,7 +172,7 @@ fn test_unwrap_or_else() { #[test] fn test_iter() { - let val = 5i; + let val = 5; let x = Some(val); let mut it = x.iter(); @@ -185,8 +185,8 @@ fn test_iter() { #[test] fn test_mut_iter() { - let val = 5i; - let new_val = 11i; + let val = 5; + let new_val = 11; let mut x = Some(val); { @@ -223,13 +223,13 @@ fn test_ord() { /* FIXME(#20575) #[test] fn test_collect() { - let v: Option> = (0i..0).map(|_| Some(0i)).collect(); + let v: Option> = (0..0).map(|_| Some(0i)).collect(); assert!(v == Some(vec![])); - let v: Option> = (0i..3).map(|x| Some(x)).collect(); + let v: Option> = (0..3).map(|x| Some(x)).collect(); assert!(v == Some(vec![0, 1, 2])); - let v: Option> = (0i..3).map(|x| { + let v: Option> = (0..3).map(|x| { if x > 1 { None } else { Some(x) } }).collect(); assert!(v == None); diff --git a/src/libcoretest/ptr.rs b/src/libcoretest/ptr.rs index 875affe0ac7..7f0b97c53d4 100644 --- a/src/libcoretest/ptr.rs +++ b/src/libcoretest/ptr.rs @@ -84,7 +84,7 @@ fn test_as_ref() { assert_eq!(q.as_ref().unwrap(), &2); // Lifetime inference - let u = 2i; + let u = 2; { let p: *const int = &u as *const _; assert_eq!(p.as_ref().unwrap(), &2); @@ -102,7 +102,7 @@ fn test_as_mut() { assert!(q.as_mut().unwrap() == &mut 2); // Lifetime inference - let mut u = 2i; + let mut u = 2; { let p: *mut int = &mut u as *mut _; assert!(p.as_mut().unwrap() == &mut 2); @@ -113,7 +113,7 @@ fn test_as_mut() { #[test] fn test_ptr_addition() { unsafe { - let xs = repeat(5i).take(16).collect::>(); + let xs = repeat(5).take(16).collect::>(); let mut ptr = xs.as_ptr(); let end = ptr.offset(16); @@ -131,7 +131,7 @@ fn test_ptr_addition() { m_ptr = m_ptr.offset(1); } - assert!(xs_mut == repeat(10i).take(16).collect::>()); + assert!(xs_mut == repeat(10).take(16).collect::>()); } } diff --git a/src/libcoretest/result.rs b/src/libcoretest/result.rs index d36228fa3d7..ab7b5101e72 100644 --- a/src/libcoretest/result.rs +++ b/src/libcoretest/result.rs @@ -13,11 +13,11 @@ pub fn op2() -> Result { Err("sadface") } #[test] pub fn test_and() { - assert_eq!(op1().and(Ok(667i)).unwrap(), 667); + assert_eq!(op1().and(Ok(667)).unwrap(), 667); assert_eq!(op1().and(Err::("bad")).unwrap_err(), "bad"); - assert_eq!(op2().and(Ok(667i)).unwrap_err(), "sadface"); + assert_eq!(op2().and(Ok(667)).unwrap_err(), "sadface"); assert_eq!(op2().and(Err::("bad")).unwrap_err(), "sadface"); } @@ -68,20 +68,20 @@ pub fn test_impl_map_err() { /* FIXME(#20575) #[test] fn test_collect() { - let v: Result, ()> = (0i..0).map(|_| Ok::(0)).collect(); + let v: Result, ()> = (0..0).map(|_| Ok::(0)).collect(); assert!(v == Ok(vec![])); - let v: Result, ()> = (0i..3).map(|x| Ok::(x)).collect(); + let v: Result, ()> = (0..3).map(|x| Ok::(x)).collect(); assert!(v == Ok(vec![0, 1, 2])); - let v: Result, int> = (0i..3).map(|x| { + let v: Result, int> = (0..3).map(|x| { if x > 1 { Err(x) } else { Ok(x) } }).collect(); assert!(v == Err(2)); // test that it does not take more elements than it needs let mut functions: [Box Result<(), int>>; 3] = - [box || Ok(()), box || Err(1i), box || panic!()]; + [box || Ok(()), box || Err(1), box || panic!()]; let v: Result, int> = functions.iter_mut().map(|f| (*f)()).collect(); assert!(v == Err(1)); @@ -101,7 +101,7 @@ pub fn test_fmt_default() { #[test] pub fn test_unwrap_or() { - let ok: Result = Ok(100i); + let ok: Result = Ok(100); let ok_err: Result = Err("Err"); assert_eq!(ok.unwrap_or(50), 100); @@ -112,7 +112,7 @@ pub fn test_unwrap_or() { pub fn test_unwrap_or_else() { fn handler(msg: &'static str) -> int { if msg == "I got this." { - 50i + 50 } else { panic!("BadBad") } @@ -130,7 +130,7 @@ pub fn test_unwrap_or_else() { pub fn test_unwrap_or_else_panic() { fn handler(msg: &'static str) -> int { if msg == "I got this." { - 50i + 50 } else { panic!("BadBad") } diff --git a/src/libcoretest/slice.rs b/src/libcoretest/slice.rs index 6fae384763f..6d5cc38ef0a 100644 --- a/src/libcoretest/slice.rs +++ b/src/libcoretest/slice.rs @@ -12,25 +12,25 @@ use core::result::Result::{Ok, Err}; #[test] fn binary_search_not_found() { - let b = [1i, 2, 4, 6, 8, 9]; + let b = [1, 2, 4, 6, 8, 9]; assert!(b.binary_search_by(|v| v.cmp(&6)) == Ok(3)); - let b = [1i, 2, 4, 6, 8, 9]; + let b = [1, 2, 4, 6, 8, 9]; assert!(b.binary_search_by(|v| v.cmp(&5)) == Err(3)); - let b = [1i, 2, 4, 6, 7, 8, 9]; + let b = [1, 2, 4, 6, 7, 8, 9]; assert!(b.binary_search_by(|v| v.cmp(&6)) == Ok(3)); - let b = [1i, 2, 4, 6, 7, 8, 9]; + let b = [1, 2, 4, 6, 7, 8, 9]; assert!(b.binary_search_by(|v| v.cmp(&5)) == Err(3)); - let b = [1i, 2, 4, 6, 8, 9]; + let b = [1, 2, 4, 6, 8, 9]; assert!(b.binary_search_by(|v| v.cmp(&8)) == Ok(4)); - let b = [1i, 2, 4, 6, 8, 9]; + let b = [1, 2, 4, 6, 8, 9]; assert!(b.binary_search_by(|v| v.cmp(&7)) == Err(4)); - let b = [1i, 2, 4, 6, 7, 8, 9]; + let b = [1, 2, 4, 6, 7, 8, 9]; assert!(b.binary_search_by(|v| v.cmp(&8)) == Ok(5)); - let b = [1i, 2, 4, 5, 6, 8, 9]; + let b = [1, 2, 4, 5, 6, 8, 9]; assert!(b.binary_search_by(|v| v.cmp(&7)) == Err(5)); - let b = [1i, 2, 4, 5, 6, 8, 9]; + let b = [1, 2, 4, 5, 6, 8, 9]; assert!(b.binary_search_by(|v| v.cmp(&0)) == Err(0)); - let b = [1i, 2, 4, 5, 6, 8]; + let b = [1, 2, 4, 5, 6, 8]; assert!(b.binary_search_by(|v| v.cmp(&9)) == Err(6)); } diff --git a/src/libcoretest/tuple.rs b/src/libcoretest/tuple.rs index e524d8de056..57844f5995f 100644 --- a/src/libcoretest/tuple.rs +++ b/src/libcoretest/tuple.rs @@ -12,7 +12,7 @@ use std::cmp::Ordering::{Equal, Less, Greater}; #[test] fn test_clone() { - let a = (1i, "2"); + let a = (1, "2"); let b = a.clone(); assert_eq!(a, b); } @@ -59,10 +59,10 @@ fn test_tuple_cmp() { #[test] fn test_show() { - let s = format!("{:?}", (1i,)); + let s = format!("{:?}", (1,)); assert_eq!(s, "(1,)"); - let s = format!("{:?}", (1i, true)); + let s = format!("{:?}", (1, true)); assert_eq!(s, "(1, true)"); - let s = format!("{:?}", (1i, "hi", true)); + let s = format!("{:?}", (1, "hi", true)); assert_eq!(s, "(1, \"hi\", true)"); } diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 0e2ab008e13..bf7fdaeadf4 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -20,7 +20,7 @@ //! error!("this is printed by default"); //! //! if log_enabled!(log::INFO) { -//! let x = 3i * 4i; // expensive computation +//! let x = 3 * 4; // expensive computation //! info!("the answer was: {:?}", x); //! } //! } diff --git a/src/liblog/macros.rs b/src/liblog/macros.rs index 5249e971439..5c7085b7b6c 100644 --- a/src/liblog/macros.rs +++ b/src/liblog/macros.rs @@ -119,7 +119,7 @@ macro_rules! warn { /// #[macro_use] extern crate log; /// /// fn main() { -/// let ret = 3i; +/// let ret = 3; /// info!("this function is about to return: {}", ret); /// } /// ``` @@ -145,7 +145,7 @@ macro_rules! info { /// #[macro_use] extern crate log; /// /// fn main() { -/// debug!("x = {x}, y = {y}", x=10i, y=20i); +/// debug!("x = {x}, y = {y}", x=10, y=20); /// } /// ``` /// diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index 8d87a8e5f0e..1b5e5ae8398 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -311,36 +311,36 @@ mod tests { }} } - t!(vec!(Weighted { weight: 1, item: 10i}), [10]); + t!(vec!(Weighted { weight: 1, item: 10}), [10]); // skip some - t!(vec!(Weighted { weight: 0, item: 20i}, - Weighted { weight: 2, item: 21i}, - Weighted { weight: 0, item: 22i}, - Weighted { weight: 1, item: 23i}), + t!(vec!(Weighted { weight: 0, item: 20}, + Weighted { weight: 2, item: 21}, + Weighted { weight: 0, item: 22}, + Weighted { weight: 1, item: 23}), [21,21, 23]); // different weights - t!(vec!(Weighted { weight: 4, item: 30i}, - Weighted { weight: 3, item: 31i}), + t!(vec!(Weighted { weight: 4, item: 30}, + Weighted { weight: 3, item: 31}), [30,30,30,30, 31,31,31]); // check that we're binary searching // correctly with some vectors of odd // length. - t!(vec!(Weighted { weight: 1, item: 40i}, - Weighted { weight: 1, item: 41i}, - Weighted { weight: 1, item: 42i}, - Weighted { weight: 1, item: 43i}, - Weighted { weight: 1, item: 44i}), + t!(vec!(Weighted { weight: 1, item: 40}, + Weighted { weight: 1, item: 41}, + Weighted { weight: 1, item: 42}, + Weighted { weight: 1, item: 43}, + Weighted { weight: 1, item: 44}), [40, 41, 42, 43, 44]); - t!(vec!(Weighted { weight: 1, item: 50i}, - Weighted { weight: 1, item: 51i}, - Weighted { weight: 1, item: 52i}, - Weighted { weight: 1, item: 53i}, - Weighted { weight: 1, item: 54i}, - Weighted { weight: 1, item: 55i}, - Weighted { weight: 1, item: 56i}), + t!(vec!(Weighted { weight: 1, item: 50}, + Weighted { weight: 1, item: 51}, + Weighted { weight: 1, item: 52}, + Weighted { weight: 1, item: 53}, + Weighted { weight: 1, item: 54}, + Weighted { weight: 1, item: 55}, + Weighted { weight: 1, item: 56}), [50, 51, 52, 53, 54, 55, 56]); } @@ -350,15 +350,15 @@ mod tests { } #[test] #[should_fail] fn test_weighted_choice_zero_weight() { - WeightedChoice::new(&mut [Weighted { weight: 0, item: 0i}, - Weighted { weight: 0, item: 1i}]); + WeightedChoice::new(&mut [Weighted { weight: 0, item: 0}, + Weighted { weight: 0, item: 1}]); } #[test] #[should_fail] fn test_weighted_choice_weight_overflows() { let x = (-1) as uint / 2; // x + x + 2 is the overflow - WeightedChoice::new(&mut [Weighted { weight: x, item: 0i }, - Weighted { weight: 1, item: 1i }, - Weighted { weight: x, item: 2i }, - Weighted { weight: 1, item: 3i }]); + WeightedChoice::new(&mut [Weighted { weight: x, item: 0 }, + Weighted { weight: 1, item: 1 }, + Weighted { weight: x, item: 2 }, + Weighted { weight: 1, item: 3 }]); } } diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index e8dedeb8d60..16830c84c46 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -171,12 +171,12 @@ mod tests { #[should_fail] #[test] fn test_range_bad_limits_equal() { - Range::new(10i, 10i); + Range::new(10, 10); } #[should_fail] #[test] fn test_range_bad_limits_flipped() { - Range::new(10i, 5i); + Range::new(10, 5); } #[test] diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 76258151850..395fcd047d6 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -152,7 +152,7 @@ pub trait Rng : Sized { // (3) adds more `unsafe` that needs to be checked, (4) // probably doesn't give much performance gain if // optimisations are on. - let mut count = 0i; + let mut count = 0; let mut num = 0; for byte in dest.iter_mut() { if count == 0 { @@ -269,7 +269,7 @@ pub trait Rng : Sized { /// ``` /// use std::rand::{thread_rng, Rng}; /// - /// let choices = [1i, 2, 4, 8, 16, 32]; + /// let choices = [1, 2, 4, 8, 16, 32]; /// let mut rng = thread_rng(); /// println!("{:?}", rng.choose(&choices)); /// assert_eq!(rng.choose(&choices[..0]), None); @@ -290,7 +290,7 @@ pub trait Rng : Sized { /// use std::rand::{thread_rng, Rng}; /// /// let mut rng = thread_rng(); - /// let mut y = [1i, 2, 3]; + /// let mut y = [1, 2, 3]; /// rng.shuffle(&mut y); /// println!("{:?}", y.as_slice()); /// rng.shuffle(&mut y); diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index f13814527cd..5d77cfe1061 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -493,7 +493,7 @@ pub struct BoxPointers; impl BoxPointers { fn check_heap_type<'a, 'tcx>(&self, cx: &Context<'a, 'tcx>, span: Span, ty: Ty<'tcx>) { - let mut n_uniq = 0i; + let mut n_uniq = 0u; ty::fold_ty(cx.tcx, ty, |t| { match t.sty { ty::ty_uniq(_) => { diff --git a/src/librustc_trans/save/span_utils.rs b/src/librustc_trans/save/span_utils.rs index 97b3cda006b..2685f0cb5ce 100644 --- a/src/librustc_trans/save/span_utils.rs +++ b/src/librustc_trans/save/span_utils.rs @@ -236,7 +236,7 @@ impl<'a> SpanUtils<'a> { let mut toks = self.retokenise_span(span); // We keep track of how many brackets we're nested in - let mut bracket_count = 0i; + let mut bracket_count = 0; loop { let ts = toks.real_token(); if ts.tok == token::Eof { diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs index 8d7eb5816c2..bdb579d1ffa 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -1078,7 +1078,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, let sw = if kind == Switch { build::Switch(bcx, test_val, else_cx.llbb, opts.len()) } else { - C_int(ccx, 0i) // Placeholder for when not using a switch + C_int(ccx, 0) // Placeholder for when not using a switch }; let defaults = enter_default(else_cx, dm, m, col, val); diff --git a/src/librustc_trans/trans/foreign.rs b/src/librustc_trans/trans/foreign.rs index 5965d396e87..6c017866ef0 100644 --- a/src/librustc_trans/trans/foreign.rs +++ b/src/librustc_trans/trans/foreign.rs @@ -973,9 +973,9 @@ pub fn lltype_for_foreign_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn add_argument_attributes(tys: &ForeignTypes, llfn: ValueRef) { let mut i = if tys.fn_ty.ret_ty.is_indirect() { - 1i + 1 } else { - 0i + 0 }; match tys.fn_ty.ret_ty.attr { diff --git a/src/librustc_trans/trans/tvec.rs b/src/librustc_trans/trans/tvec.rs index 06bc19f45a4..358e38a671d 100644 --- a/src/librustc_trans/trans/tvec.rs +++ b/src/librustc_trans/trans/tvec.rs @@ -499,7 +499,7 @@ pub fn iter_vec_raw<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>, CondBr(header_bcx, not_yet_at_end, body_bcx.llbb, next_bcx.llbb, DebugLoc::None); let body_bcx = f(body_bcx, data_ptr, vt.unit_ty); AddIncomingToPhi(data_ptr, InBoundsGEP(body_bcx, data_ptr, - &[C_int(bcx.ccx(), 1i)]), + &[C_int(bcx.ccx(), 1)]), body_bcx.llbb); Br(body_bcx, header_bcx.llbb, DebugLoc::None); next_bcx diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index d3c2ffa9544..c9b6af26ce0 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -116,7 +116,7 @@ impl FromHex for str { fn from_hex(&self) -> Result, FromHexError> { // This may be an overestimate if there is any whitespace let mut b = Vec::with_capacity(self.len() / 2); - let mut modulus = 0i; + let mut modulus = 0; let mut buf = 0u8; for (idx, byte) in self.bytes().enumerate() { diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 2e7a6fd4923..c16a6978620 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -3937,7 +3937,7 @@ mod tests { hash_map.insert("a".to_string(), 1u); hash_map.insert("b".to_string(), 2); assert_eq!(hash_map.to_json(), object); - assert_eq!(Some(15i).to_json(), I64(15)); + assert_eq!(Some(15).to_json(), I64(15)); assert_eq!(Some(15u).to_json(), U64(15)); assert_eq!(None::.to_json(), Null); } @@ -3997,7 +3997,7 @@ mod tests { fn big_json() -> string::String { let mut src = "[\n".to_string(); - for _ in 0i..500 { + for _ in 0..500 { src.push_str(r#"{ "a": true, "b": null, "c":3.1415, "d": "Hello world", "e": \ [1,2,3]},"#); } diff --git a/src/libstd/collections/hash/bench.rs b/src/libstd/collections/hash/bench.rs index 28689767cb0..ce02648b8f2 100644 --- a/src/libstd/collections/hash/bench.rs +++ b/src/libstd/collections/hash/bench.rs @@ -32,7 +32,7 @@ fn new_insert_drop(b : &mut Bencher) { b.iter(|| { let mut m = HashMap::new(); - m.insert(0i, 0i); + m.insert(0, 0); assert_eq!(m.len(), 1); }) } @@ -43,7 +43,7 @@ fn grow_by_insertion(b: &mut Bencher) { let mut m = HashMap::new(); - for i in range_inclusive(1i, 1000) { + for i in range_inclusive(1, 1000) { m.insert(i, i); } @@ -61,12 +61,12 @@ fn find_existing(b: &mut Bencher) { let mut m = HashMap::new(); - for i in range_inclusive(1i, 1000) { + for i in range_inclusive(1, 1000) { m.insert(i, i); } b.iter(|| { - for i in range_inclusive(1i, 1000) { + for i in range_inclusive(1, 1000) { m.contains_key(&i); } }); @@ -78,12 +78,12 @@ fn find_nonexisting(b: &mut Bencher) { let mut m = HashMap::new(); - for i in range_inclusive(1i, 1000) { + for i in range_inclusive(1, 1000) { m.insert(i, i); } b.iter(|| { - for i in range_inclusive(1001i, 2000) { + for i in range_inclusive(1001, 2000) { m.contains_key(&i); } }); @@ -95,11 +95,11 @@ fn hashmap_as_queue(b: &mut Bencher) { let mut m = HashMap::new(); - for i in range_inclusive(1i, 1000) { + for i in range_inclusive(1, 1000) { m.insert(i, i); } - let mut k = 1i; + let mut k = 1; b.iter(|| { m.remove(&k); @@ -114,11 +114,11 @@ fn get_remove_insert(b: &mut Bencher) { let mut m = HashMap::new(); - for i in range_inclusive(1i, 1000) { + for i in range_inclusive(1, 1000) { m.insert(i, i); } - let mut k = 1i; + let mut k = 1; b.iter(|| { m.get(&(k + 400)); diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index a291ec16a62..0b81e119821 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -536,7 +536,7 @@ impl HashMap /// /// let s = RandomState::new(); /// let mut map = HashMap::with_hash_state(s); - /// map.insert(1i, 2u); + /// map.insert(1, 2u); /// ``` #[inline] #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] @@ -564,7 +564,7 @@ impl HashMap /// /// let s = RandomState::new(); /// let mut map = HashMap::with_capacity_and_hash_state(10, s); - /// map.insert(1i, 2u); + /// map.insert(1, 2u); /// ``` #[inline] #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] @@ -809,7 +809,7 @@ impl HashMap /// use std::collections::HashMap; /// /// let mut map = HashMap::new(); - /// map.insert("a", 1i); + /// map.insert("a", 1); /// map.insert("b", 2); /// map.insert("c", 3); /// @@ -834,7 +834,7 @@ impl HashMap /// use std::collections::HashMap; /// /// let mut map = HashMap::new(); - /// map.insert("a", 1i); + /// map.insert("a", 1); /// map.insert("b", 2); /// map.insert("c", 3); /// @@ -859,7 +859,7 @@ impl HashMap /// use std::collections::HashMap; /// /// let mut map = HashMap::new(); - /// map.insert("a", 1i); + /// map.insert("a", 1); /// map.insert("b", 2); /// map.insert("c", 3); /// @@ -882,7 +882,7 @@ impl HashMap /// use std::collections::HashMap; /// /// let mut map = HashMap::new(); - /// map.insert("a", 1i); + /// map.insert("a", 1); /// map.insert("b", 2); /// map.insert("c", 3); /// @@ -910,7 +910,7 @@ impl HashMap /// use std::collections::HashMap; /// /// let mut map = HashMap::new(); - /// map.insert("a", 1i); + /// map.insert("a", 1); /// map.insert("b", 2); /// map.insert("c", 3); /// @@ -1622,7 +1622,7 @@ mod test_map { fn test_create_capacity_zero() { let mut m = HashMap::with_capacity(0); - assert!(m.insert(1i, 1i).is_none()); + assert!(m.insert(1, 1).is_none()); assert!(m.contains_key(&1)); assert!(!m.contains_key(&0)); @@ -1632,9 +1632,9 @@ mod test_map { fn test_insert() { let mut m = HashMap::new(); assert_eq!(m.len(), 0); - assert!(m.insert(1i, 2i).is_none()); + assert!(m.insert(1, 2).is_none()); assert_eq!(m.len(), 1); - assert!(m.insert(2i, 4i).is_none()); + assert!(m.insert(2, 4).is_none()); assert_eq!(m.len(), 2); assert_eq!(*m.get(&1).unwrap(), 2); assert_eq!(*m.get(&2).unwrap(), 4); @@ -1674,7 +1674,7 @@ mod test_map { #[test] fn test_drops() { DROP_VECTOR.with(|slot| { - *slot.borrow_mut() = repeat(0i).take(200).collect(); + *slot.borrow_mut() = repeat(0).take(200).collect(); }); { @@ -1807,10 +1807,10 @@ mod test_map { // Try this a few times to make sure we never screw up the hashmap's // internal state. - for _ in 0i..10 { + for _ in 0..10 { assert!(m.is_empty()); - for i in range_inclusive(1i, 1000) { + for i in range_inclusive(1, 1000) { assert!(m.insert(i, i).is_none()); for j in range_inclusive(1, i) { @@ -1824,12 +1824,12 @@ mod test_map { } } - for i in range_inclusive(1001i, 2000) { + for i in range_inclusive(1001, 2000) { assert!(!m.contains_key(&i)); } // remove forwards - for i in range_inclusive(1i, 1000) { + for i in range_inclusive(1, 1000) { assert!(m.remove(&i).is_some()); for j in range_inclusive(1, i) { @@ -1841,16 +1841,16 @@ mod test_map { } } - for i in range_inclusive(1i, 1000) { + for i in range_inclusive(1, 1000) { assert!(!m.contains_key(&i)); } - for i in range_inclusive(1i, 1000) { + for i in range_inclusive(1, 1000) { assert!(m.insert(i, i).is_none()); } // remove backwards - for i in range_step_inclusive(1000i, 1, -1) { + for i in range_step_inclusive(1000, 1, -1) { assert!(m.remove(&i).is_some()); for j in range_inclusive(i, 1000) { @@ -1867,9 +1867,9 @@ mod test_map { #[test] fn test_find_mut() { let mut m = HashMap::new(); - assert!(m.insert(1i, 12i).is_none()); - assert!(m.insert(2i, 8i).is_none()); - assert!(m.insert(5i, 14i).is_none()); + assert!(m.insert(1, 12).is_none()); + assert!(m.insert(2, 8).is_none()); + assert!(m.insert(5, 14).is_none()); let new = 100; match m.get_mut(&5) { None => panic!(), Some(x) => *x = new @@ -1880,18 +1880,18 @@ mod test_map { #[test] fn test_insert_overwrite() { let mut m = HashMap::new(); - assert!(m.insert(1i, 2i).is_none()); + assert!(m.insert(1, 2).is_none()); assert_eq!(*m.get(&1).unwrap(), 2); - assert!(!m.insert(1i, 3i).is_none()); + assert!(!m.insert(1, 3).is_none()); assert_eq!(*m.get(&1).unwrap(), 3); } #[test] fn test_insert_conflicts() { let mut m = HashMap::with_capacity(4); - assert!(m.insert(1i, 2i).is_none()); - assert!(m.insert(5i, 3i).is_none()); - assert!(m.insert(9i, 4i).is_none()); + assert!(m.insert(1, 2).is_none()); + assert!(m.insert(5, 3).is_none()); + assert!(m.insert(9, 4).is_none()); assert_eq!(*m.get(&9).unwrap(), 4); assert_eq!(*m.get(&5).unwrap(), 3); assert_eq!(*m.get(&1).unwrap(), 2); @@ -1900,7 +1900,7 @@ mod test_map { #[test] fn test_conflict_remove() { let mut m = HashMap::with_capacity(4); - assert!(m.insert(1i, 2i).is_none()); + assert!(m.insert(1, 2).is_none()); assert_eq!(*m.get(&1).unwrap(), 2); assert!(m.insert(5, 3).is_none()); assert_eq!(*m.get(&1).unwrap(), 2); @@ -1917,7 +1917,7 @@ mod test_map { #[test] fn test_is_empty() { let mut m = HashMap::with_capacity(4); - assert!(m.insert(1i, 2i).is_none()); + assert!(m.insert(1, 2).is_none()); assert!(!m.is_empty()); assert!(m.remove(&1).is_some()); assert!(m.is_empty()); @@ -1926,7 +1926,7 @@ mod test_map { #[test] fn test_pop() { let mut m = HashMap::new(); - m.insert(1i, 2i); + m.insert(1, 2); assert_eq!(m.remove(&1), Some(2)); assert_eq!(m.remove(&1), None); } @@ -1950,7 +1950,7 @@ mod test_map { #[test] fn test_keys() { - let vec = vec![(1i, 'a'), (2i, 'b'), (3i, 'c')]; + let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')]; let map = vec.into_iter().collect::>(); let keys = map.keys().map(|&k| k).collect::>(); assert_eq!(keys.len(), 3); @@ -1961,7 +1961,7 @@ mod test_map { #[test] fn test_values() { - let vec = vec![(1i, 'a'), (2i, 'b'), (3i, 'c')]; + let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')]; let map = vec.into_iter().collect::>(); let values = map.values().map(|&v| v).collect::>(); assert_eq!(values.len(), 3); @@ -1973,8 +1973,8 @@ mod test_map { #[test] fn test_find() { let mut m = HashMap::new(); - assert!(m.get(&1i).is_none()); - m.insert(1i, 2i); + assert!(m.get(&1).is_none()); + m.insert(1, 2); match m.get(&1) { None => panic!(), Some(v) => assert_eq!(*v, 2) @@ -1984,17 +1984,17 @@ mod test_map { #[test] fn test_eq() { let mut m1 = HashMap::new(); - m1.insert(1i, 2i); - m1.insert(2i, 3i); - m1.insert(3i, 4i); + m1.insert(1, 2); + m1.insert(2, 3); + m1.insert(3, 4); let mut m2 = HashMap::new(); - m2.insert(1i, 2i); - m2.insert(2i, 3i); + m2.insert(1, 2); + m2.insert(2, 3); assert!(m1 != m2); - m2.insert(3i, 4i); + m2.insert(3, 4); assert_eq!(m1, m2); } @@ -2004,8 +2004,8 @@ mod test_map { let mut map: HashMap = HashMap::new(); let empty: HashMap = HashMap::new(); - map.insert(1i, 2i); - map.insert(3i, 4i); + map.insert(1, 2); + map.insert(3, 4); let map_str = format!("{:?}", map); @@ -2127,7 +2127,7 @@ mod test_map { #[test] fn test_from_iter() { - let xs = [(1i, 1i), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; + let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; let map: HashMap = xs.iter().map(|&x| x).collect(); @@ -2138,7 +2138,7 @@ mod test_map { #[test] fn test_size_hint() { - let xs = [(1i, 1i), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; + let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; let map: HashMap = xs.iter().map(|&x| x).collect(); @@ -2151,7 +2151,7 @@ mod test_map { #[test] fn test_iter_len() { - let xs = [(1i, 1i), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; + let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; let map: HashMap = xs.iter().map(|&x| x).collect(); @@ -2164,7 +2164,7 @@ mod test_map { #[test] fn test_mut_size_hint() { - let xs = [(1i, 1i), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; + let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; let mut map: HashMap = xs.iter().map(|&x| x).collect(); @@ -2177,7 +2177,7 @@ mod test_map { #[test] fn test_iter_mut_len() { - let xs = [(1i, 1i), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; + let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; let mut map: HashMap = xs.iter().map(|&x| x).collect(); @@ -2213,7 +2213,7 @@ mod test_map { #[test] fn test_entry(){ - let xs = [(1i, 10i), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)]; + let xs = [(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)]; let mut map: HashMap = xs.iter().map(|&x| x).collect(); diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 2b15e50c6fa..3095c2c0e41 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -168,7 +168,7 @@ impl HashSet /// /// let s = RandomState::new(); /// let mut set = HashSet::with_capacity_and_hash_state(10u, s); - /// set.insert(1i); + /// set.insert(1); /// ``` #[inline] #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] @@ -290,8 +290,8 @@ impl HashSet /// /// ``` /// use std::collections::HashSet; - /// let a: HashSet = [1i, 2, 3].iter().map(|&x| x).collect(); - /// let b: HashSet = [4i, 2, 3, 4].iter().map(|&x| x).collect(); + /// let a: HashSet = [1, 2, 3].iter().map(|&x| x).collect(); + /// let b: HashSet = [4, 2, 3, 4].iter().map(|&x| x).collect(); /// /// // Can be seen as `a - b`. /// for x in a.difference(&b) { @@ -299,12 +299,12 @@ impl HashSet /// } /// /// let diff: HashSet = a.difference(&b).map(|&x| x).collect(); - /// assert_eq!(diff, [1i].iter().map(|&x| x).collect()); + /// assert_eq!(diff, [1].iter().map(|&x| x).collect()); /// /// // Note that difference is not symmetric, /// // and `b - a` means something else: /// let diff: HashSet = b.difference(&a).map(|&x| x).collect(); - /// assert_eq!(diff, [4i].iter().map(|&x| x).collect()); + /// assert_eq!(diff, [4].iter().map(|&x| x).collect()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn difference<'a>(&'a self, other: &'a HashSet) -> Difference<'a, T, S> { @@ -320,8 +320,8 @@ impl HashSet /// /// ``` /// use std::collections::HashSet; - /// let a: HashSet = [1i, 2, 3].iter().map(|&x| x).collect(); - /// let b: HashSet = [4i, 2, 3, 4].iter().map(|&x| x).collect(); + /// let a: HashSet = [1, 2, 3].iter().map(|&x| x).collect(); + /// let b: HashSet = [4, 2, 3, 4].iter().map(|&x| x).collect(); /// /// // Print 1, 4 in arbitrary order. /// for x in a.symmetric_difference(&b) { @@ -332,7 +332,7 @@ impl HashSet /// let diff2: HashSet = b.symmetric_difference(&a).map(|&x| x).collect(); /// /// assert_eq!(diff1, diff2); - /// assert_eq!(diff1, [1i, 4].iter().map(|&x| x).collect()); + /// assert_eq!(diff1, [1, 4].iter().map(|&x| x).collect()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn symmetric_difference<'a>(&'a self, other: &'a HashSet) @@ -346,8 +346,8 @@ impl HashSet /// /// ``` /// use std::collections::HashSet; - /// let a: HashSet = [1i, 2, 3].iter().map(|&x| x).collect(); - /// let b: HashSet = [4i, 2, 3, 4].iter().map(|&x| x).collect(); + /// let a: HashSet = [1, 2, 3].iter().map(|&x| x).collect(); + /// let b: HashSet = [4, 2, 3, 4].iter().map(|&x| x).collect(); /// /// // Print 2, 3 in arbitrary order. /// for x in a.intersection(&b) { @@ -355,7 +355,7 @@ impl HashSet /// } /// /// let diff: HashSet = a.intersection(&b).map(|&x| x).collect(); - /// assert_eq!(diff, [2i, 3].iter().map(|&x| x).collect()); + /// assert_eq!(diff, [2, 3].iter().map(|&x| x).collect()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn intersection<'a>(&'a self, other: &'a HashSet) -> Intersection<'a, T, S> { @@ -371,8 +371,8 @@ impl HashSet /// /// ``` /// use std::collections::HashSet; - /// let a: HashSet = [1i, 2, 3].iter().map(|&x| x).collect(); - /// let b: HashSet = [4i, 2, 3, 4].iter().map(|&x| x).collect(); + /// let a: HashSet = [1, 2, 3].iter().map(|&x| x).collect(); + /// let b: HashSet = [4, 2, 3, 4].iter().map(|&x| x).collect(); /// /// // Print 1, 2, 3, 4 in arbitrary order. /// for x in a.union(&b) { @@ -380,7 +380,7 @@ impl HashSet /// } /// /// let diff: HashSet = a.union(&b).map(|&x| x).collect(); - /// assert_eq!(diff, [1i, 2, 3, 4].iter().map(|&x| x).collect()); + /// assert_eq!(diff, [1, 2, 3, 4].iter().map(|&x| x).collect()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn union<'a>(&'a self, other: &'a HashSet) -> Union<'a, T, S> { @@ -955,8 +955,8 @@ mod test_set { let mut ys = HashSet::new(); assert!(xs.is_disjoint(&ys)); assert!(ys.is_disjoint(&xs)); - assert!(xs.insert(5i)); - assert!(ys.insert(11i)); + assert!(xs.insert(5)); + assert!(ys.insert(11)); assert!(xs.is_disjoint(&ys)); assert!(ys.is_disjoint(&xs)); assert!(xs.insert(7)); @@ -974,13 +974,13 @@ mod test_set { #[test] fn test_subset_and_superset() { let mut a = HashSet::new(); - assert!(a.insert(0i)); + assert!(a.insert(0)); assert!(a.insert(5)); assert!(a.insert(11)); assert!(a.insert(7)); let mut b = HashSet::new(); - assert!(b.insert(0i)); + assert!(b.insert(0)); assert!(b.insert(7)); assert!(b.insert(19)); assert!(b.insert(250)); @@ -1018,7 +1018,7 @@ mod test_set { let mut a = HashSet::new(); let mut b = HashSet::new(); - assert!(a.insert(11i)); + assert!(a.insert(11)); assert!(a.insert(1)); assert!(a.insert(3)); assert!(a.insert(77)); @@ -1026,7 +1026,7 @@ mod test_set { assert!(a.insert(5)); assert!(a.insert(-5)); - assert!(b.insert(2i)); + assert!(b.insert(2)); assert!(b.insert(11)); assert!(b.insert(77)); assert!(b.insert(-9)); @@ -1048,13 +1048,13 @@ mod test_set { let mut a = HashSet::new(); let mut b = HashSet::new(); - assert!(a.insert(1i)); + assert!(a.insert(1)); assert!(a.insert(3)); assert!(a.insert(5)); assert!(a.insert(9)); assert!(a.insert(11)); - assert!(b.insert(3i)); + assert!(b.insert(3)); assert!(b.insert(9)); let mut i = 0; @@ -1071,13 +1071,13 @@ mod test_set { let mut a = HashSet::new(); let mut b = HashSet::new(); - assert!(a.insert(1i)); + assert!(a.insert(1)); assert!(a.insert(3)); assert!(a.insert(5)); assert!(a.insert(9)); assert!(a.insert(11)); - assert!(b.insert(-2i)); + assert!(b.insert(-2)); assert!(b.insert(3)); assert!(b.insert(9)); assert!(b.insert(14)); @@ -1097,7 +1097,7 @@ mod test_set { let mut a = HashSet::new(); let mut b = HashSet::new(); - assert!(a.insert(1i)); + assert!(a.insert(1)); assert!(a.insert(3)); assert!(a.insert(5)); assert!(a.insert(9)); @@ -1106,7 +1106,7 @@ mod test_set { assert!(a.insert(19)); assert!(a.insert(24)); - assert!(b.insert(-2i)); + assert!(b.insert(-2)); assert!(b.insert(1)); assert!(b.insert(5)); assert!(b.insert(9)); @@ -1124,7 +1124,7 @@ mod test_set { #[test] fn test_from_iter() { - let xs = [1i, 2, 3, 4, 5, 6, 7, 8, 9]; + let xs = [1, 2, 3, 4, 5, 6, 7, 8, 9]; let set: HashSet = xs.iter().map(|&x| x).collect(); @@ -1154,13 +1154,13 @@ mod test_set { // I'm keeping them around to prevent a regression. let mut s1 = HashSet::new(); - s1.insert(1i); + s1.insert(1); s1.insert(2); s1.insert(3); let mut s2 = HashSet::new(); - s2.insert(1i); + s2.insert(1); s2.insert(2); assert!(s1 != s2); @@ -1175,7 +1175,7 @@ mod test_set { let mut set: HashSet = HashSet::new(); let empty: HashSet = HashSet::new(); - set.insert(1i); + set.insert(1); set.insert(2); let set_str = format!("{:?}", set); @@ -1201,7 +1201,7 @@ mod test_set { let mut s: HashSet = (1is..100).collect(); // try this a bunch of times to make sure we don't screw up internal state. - for _ in 0i..20 { + for _ in 0..20 { assert_eq!(s.len(), 99); { diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 9e6a45d8bf0..429923890ef 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -274,7 +274,7 @@ impl>> Bucket { // ... and it's zero at all other times. let maybe_wraparound_dist = (self.idx ^ (self.idx + 1)) & self.table.capacity(); // Finally, we obtain the offset 1 or the offset -cap + 1. - let dist = 1i - (maybe_wraparound_dist as int); + let dist = 1 - (maybe_wraparound_dist as int); self.idx += 1; diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index 4ab43e875cd..1b93dc7119d 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -29,10 +29,10 @@ //! ``` //! format!("Hello"); // => "Hello" //! format!("Hello, {}!", "world"); // => "Hello, world!" -//! format!("The number is {}", 1i); // => "The number is 1" -//! format!("{:?}", (3i, 4i)); // => "(3i, 4i)" -//! format!("{value}", value=4i); // => "4" -//! format!("{} {}", 1i, 2u); // => "1 2" +//! format!("The number is {}", 1); // => "The number is 1" +//! format!("{:?}", (3, 4)); // => "(3, 4)" +//! format!("{value}", value=4); // => "4" +//! format!("{} {}", 1, 2u); // => "1 2" //! ``` //! //! From these, you can see that the first argument is a format string. It is @@ -55,7 +55,7 @@ //! the iterator advances. This leads to behavior like this: //! //! ```rust -//! format!("{1} {} {0} {}", 1i, 2i); // => "2 1 1 2" +//! format!("{1} {} {0} {}", 1, 2); // => "2 1 1 2" //! ``` //! //! The internal iterator over the argument has not been advanced by the time @@ -83,8 +83,8 @@ //! //! ``` //! format!("{argument}", argument = "test"); // => "test" -//! format!("{name} {}", 1i, name = 2i); // => "2 1" -//! format!("{a} {c} {b}", a="a", b='b', c=3i); // => "a 3 b" +//! format!("{name} {}", 1, name = 2); // => "2 1" +//! format!("{a} {c} {b}", a="a", b='b', c=3); // => "a 3 b" //! ``` //! //! It is illegal to put positional parameters (those without names) after @@ -206,7 +206,7 @@ //! let myvector = Vector2D { x: 3, y: 4 }; //! //! println!("{}", myvector); // => "(3, 4)" -//! println!("{:?}", myvector); // => "Vector2D {x: 3i, y:4i}" +//! println!("{:?}", myvector); // => "Vector2D {x: 3, y:4}" //! println!("{:10.3b}", myvector); // => " 5.000" //! } //! ``` diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 9c3285a9d08..e91e8241a55 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -32,7 +32,7 @@ /// # #![allow(unreachable_code)] /// panic!(); /// panic!("this is a terrible mistake!"); -/// panic!(4i); // panic with the value of 4 to be collected elsewhere +/// panic!(4); // panic with the value of 4 to be collected elsewhere /// panic!("this is a {} {message}", "fancy", message = "message"); /// ``` #[macro_export] @@ -68,7 +68,7 @@ macro_rules! panic { /// ``` /// format!("test"); /// format!("hello {}", "world!"); -/// format!("x = {}, y = {y}", 10i, y = 30i); +/// format!("x = {}, y = {y}", 10, y = 30); /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] @@ -282,7 +282,7 @@ pub mod builtin { /// # Example /// /// ``` - /// let s = concat!("test", 10i, 'b', true); + /// let s = concat!("test", 10, 'b', true); /// assert_eq!(s, "test10btrue"); /// ``` #[macro_export] diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index d010a5de622..a996ad1f5b3 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -356,11 +356,11 @@ pub fn test_num(ten: T, two: T) where + Rem + Debug + Copy { - assert_eq!(ten.add(two), cast(12i).unwrap()); - assert_eq!(ten.sub(two), cast(8i).unwrap()); - assert_eq!(ten.mul(two), cast(20i).unwrap()); - assert_eq!(ten.div(two), cast(5i).unwrap()); - assert_eq!(ten.rem(two), cast(0i).unwrap()); + assert_eq!(ten.add(two), cast(12).unwrap()); + assert_eq!(ten.sub(two), cast(8).unwrap()); + assert_eq!(ten.mul(two), cast(20).unwrap()); + assert_eq!(ten.div(two), cast(5).unwrap()); + assert_eq!(ten.rem(two), cast(0).unwrap()); assert_eq!(ten.add(two), ten + two); assert_eq!(ten.sub(two), ten - two); @@ -393,7 +393,7 @@ mod tests { assert_eq!(20u16, _20.to_u16().unwrap()); assert_eq!(20u32, _20.to_u32().unwrap()); assert_eq!(20u64, _20.to_u64().unwrap()); - assert_eq!(20i, _20.to_int().unwrap()); + assert_eq!(20, _20.to_int().unwrap()); assert_eq!(20i8, _20.to_i8().unwrap()); assert_eq!(20i16, _20.to_i16().unwrap()); assert_eq!(20i32, _20.to_i32().unwrap()); @@ -406,7 +406,7 @@ mod tests { assert_eq!(_20, NumCast::from(20u16).unwrap()); assert_eq!(_20, NumCast::from(20u32).unwrap()); assert_eq!(_20, NumCast::from(20u64).unwrap()); - assert_eq!(_20, NumCast::from(20i).unwrap()); + assert_eq!(_20, NumCast::from(20).unwrap()); assert_eq!(_20, NumCast::from(20i8).unwrap()); assert_eq!(_20, NumCast::from(20i16).unwrap()); assert_eq!(_20, NumCast::from(20i32).unwrap()); @@ -419,7 +419,7 @@ mod tests { assert_eq!(_20, cast(20u16).unwrap()); assert_eq!(_20, cast(20u32).unwrap()); assert_eq!(_20, cast(20u64).unwrap()); - assert_eq!(_20, cast(20i).unwrap()); + assert_eq!(_20, cast(20).unwrap()); assert_eq!(_20, cast(20i8).unwrap()); assert_eq!(_20, cast(20i16).unwrap()); assert_eq!(_20, cast(20i32).unwrap()); @@ -438,7 +438,7 @@ mod tests { #[test] fn test_i16_cast() { test_cast_20!(20i16) } #[test] fn test_i32_cast() { test_cast_20!(20i32) } #[test] fn test_i64_cast() { test_cast_20!(20i64) } - #[test] fn test_int_cast() { test_cast_20!(20i) } + #[test] fn test_int_cast() { test_cast_20!(20) } #[test] fn test_f32_cast() { test_cast_20!(20f32) } #[test] fn test_f64_cast() { test_cast_20!(20f64) } @@ -831,23 +831,23 @@ mod tests { #[test] fn test_saturating_add_int() { use int::{MIN,MAX}; - assert_eq!(3i.saturating_add(5i), 8i); - assert_eq!(3i.saturating_add(MAX-1), MAX); + assert_eq!(3.saturating_add(5), 8); + assert_eq!(3.saturating_add(MAX-1), MAX); assert_eq!(MAX.saturating_add(MAX), MAX); assert_eq!((MAX-2).saturating_add(1), MAX-1); - assert_eq!(3i.saturating_add(-5i), -2i); - assert_eq!(MIN.saturating_add(-1i), MIN); - assert_eq!((-2i).saturating_add(-MAX), MIN); + assert_eq!(3.saturating_add(-5), -2); + assert_eq!(MIN.saturating_add(-1), MIN); + assert_eq!((-2).saturating_add(-MAX), MIN); } #[test] fn test_saturating_sub_int() { use int::{MIN,MAX}; - assert_eq!(3i.saturating_sub(5i), -2i); - assert_eq!(MIN.saturating_sub(1i), MIN); - assert_eq!((-2i).saturating_sub(MAX), MIN); - assert_eq!(3i.saturating_sub(-5i), 8i); - assert_eq!(3i.saturating_sub(-(MAX-1)), MAX); + assert_eq!(3.saturating_sub(5), -2); + assert_eq!(MIN.saturating_sub(1), MIN); + assert_eq!((-2).saturating_sub(MAX), MIN); + assert_eq!(3.saturating_sub(-5), 8); + assert_eq!(3.saturating_sub(-(MAX-1)), MAX); assert_eq!(MAX.saturating_sub(-MAX), MAX); assert_eq!((MAX-2).saturating_sub(-1), MAX-1); } @@ -1010,10 +1010,10 @@ mod tests { assert_eq!(result, naive_pow($num, $exp)); }} } - assert_pow!((3i, 0 ) => 1); - assert_pow!((5i, 1 ) => 5); - assert_pow!((-4i, 2 ) => 16); - assert_pow!((8i, 3 ) => 512); + assert_pow!((3, 0 ) => 1); + assert_pow!((5, 1 ) => 5); + assert_pow!((-4, 2 ) => 16); + assert_pow!((8, 3 ) => 512); assert_pow!((2u64, 50) => 1125899906842624); } } diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs index 99c7e399b1c..d048cde2613 100644 --- a/src/libstd/old_io/fs.rs +++ b/src/libstd/old_io/fs.rs @@ -981,7 +981,7 @@ mod test { let initial_msg = "food-is-yummy"; let overwrite_msg = "-the-bar!!"; let final_msg = "foo-the-bar!!"; - let seek_idx = 3i; + let seek_idx = 3; let mut read_mem = [0; 13]; let tmpdir = tmpdir(); let filename = &tmpdir.join("file_rt_io_file_test_seek_and_write.txt"); @@ -1101,7 +1101,7 @@ mod test { let dir = &tmpdir.join("di_readdir"); check!(mkdir(dir, old_io::USER_RWX)); let prefix = "foo"; - for n in 0i..3 { + for n in 0..3 { let f = dir.join(format!("{}.txt", n)); let mut w = check!(File::create(&f)); let msg_str = format!("{}{}", prefix, n.to_string()); diff --git a/src/libstd/old_io/net/tcp.rs b/src/libstd/old_io/net/tcp.rs index e0feaa4e558..0f513dd8995 100644 --- a/src/libstd/old_io/net/tcp.rs +++ b/src/libstd/old_io/net/tcp.rs @@ -1160,7 +1160,7 @@ mod test { tx.send(TcpStream::connect(addr).unwrap()).unwrap(); }); let _l = rx.recv().unwrap(); - for i in 0i..1001 { + for i in 0..1001 { match a.accept() { Ok(..) => break, Err(ref e) if e.kind == TimedOut => {} @@ -1260,7 +1260,7 @@ mod test { assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut); s.set_timeout(Some(20)); - for i in 0i..1001 { + for i in 0..1001 { match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, @@ -1299,7 +1299,7 @@ mod test { assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut); tx.send(()).unwrap(); - for _ in 0i..100 { + for _ in 0..100 { assert!(s.write(&[0;128 * 1024]).is_ok()); } } @@ -1318,7 +1318,7 @@ mod test { let mut s = a.accept().unwrap(); s.set_write_timeout(Some(20)); - for i in 0i..1001 { + for i in 0..1001 { match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, @@ -1388,7 +1388,7 @@ mod test { }); // Try to ensure that the reading clone is indeed reading - for _ in 0i..50 { + for _ in 0..50 { ::thread::Thread::yield_now(); } diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index d3e60de2780..f3bf482ae25 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -1142,7 +1142,7 @@ mod tests { fn test_zero() { let mut p = sleeper(); p.signal_kill().unwrap(); - for _ in 0i..20 { + for _ in 0..20 { if p.signal(0).is_err() { assert!(!p.wait().unwrap().success()); return diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 38c0a7b8f9b..600ca60349a 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -1484,7 +1484,7 @@ mod tests { #[ignore] fn test_getenv_big() { let mut s = "".to_string(); - let mut i = 0i; + let mut i = 0; while i < 100 { s.push_str("aaaaaaaaaa"); i += 1; diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 2969eec4737..211abc2fc83 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -427,7 +427,7 @@ pub fn random() -> T { /// use std::rand::{thread_rng, sample}; /// /// let mut rng = thread_rng(); -/// let sample = sample(&mut rng, 1i..100, 5); +/// let sample = sample(&mut rng, 1..100, 5); /// println!("{:?}", sample); /// ``` pub fn sample, R: Rng>(rng: &mut R, @@ -481,16 +481,16 @@ mod test { fn test_gen_range() { let mut r = thread_rng(); for _ in 0u..1000 { - let a = r.gen_range(-3i, 42); + let a = r.gen_range(-3, 42); assert!(a >= -3 && a < 42); - assert_eq!(r.gen_range(0i, 1), 0); - assert_eq!(r.gen_range(-12i, -11), -12); + assert_eq!(r.gen_range(0, 1), 0); + assert_eq!(r.gen_range(-12, -11), -12); } for _ in 0u..1000 { - let a = r.gen_range(10i, 42); + let a = r.gen_range(10, 42); assert!(a >= 10 && a < 42); - assert_eq!(r.gen_range(0i, 1), 0); + assert_eq!(r.gen_range(0, 1), 0); assert_eq!(r.gen_range(3_000_000, 3_000_001), 3_000_000); } @@ -500,7 +500,7 @@ mod test { #[should_fail] fn test_gen_range_panic_int() { let mut r = thread_rng(); - r.gen_range(5i, -2); + r.gen_range(5, -2); } #[test] @@ -544,7 +544,7 @@ mod test { #[test] fn test_choose() { let mut r = thread_rng(); - assert_eq!(r.choose(&[1i, 1, 1]).map(|&x|x), Some(1)); + assert_eq!(r.choose(&[1, 1, 1]).map(|&x|x), Some(1)); let v: &[int] = &[]; assert_eq!(r.choose(v), None); @@ -555,16 +555,16 @@ mod test { let mut r = thread_rng(); let empty: &mut [int] = &mut []; r.shuffle(empty); - let mut one = [1i]; + let mut one = [1]; r.shuffle(&mut one); let b: &[_] = &[1]; assert_eq!(one, b); - let mut two = [1i, 2]; + let mut two = [1, 2]; r.shuffle(&mut two); assert!(two == [1, 2] || two == [2, 1]); - let mut x = [1i, 1, 1]; + let mut x = [1, 1, 1]; r.shuffle(&mut x); let b: &[_] = &[1, 1, 1]; assert_eq!(x, b); @@ -574,7 +574,7 @@ mod test { fn test_thread_rng() { let mut r = thread_rng(); r.gen::(); - let mut v = [1i, 1, 1]; + let mut v = [1, 1, 1]; r.shuffle(&mut v); let b: &[_] = &[1, 1, 1]; assert_eq!(v, b); @@ -597,8 +597,8 @@ mod test { #[test] fn test_sample() { - let min_val = 1i; - let max_val = 100i; + let min_val = 1; + let max_val = 100; let mut r = thread_rng(); let vals = (min_val..max_val).collect::>(); diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index a79fb684f47..8340652d19a 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -193,7 +193,7 @@ mod test { #[test] fn test_get_ref_method() { - let mut f = Future::from_value(22i); + let mut f = Future::from_value(22); assert_eq!(*f.get_ref(), 22); } diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 6a43eccbaba..b77631935b9 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -59,9 +59,9 @@ //! // Create a simple streaming channel //! let (tx, rx) = channel(); //! Thread::spawn(move|| { -//! tx.send(10i).unwrap(); +//! tx.send(10).unwrap(); //! }); -//! assert_eq!(rx.recv().unwrap(), 10i); +//! assert_eq!(rx.recv().unwrap(), 10); //! ``` //! //! Shared usage: @@ -74,14 +74,14 @@ //! // where tx is the sending half (tx for transmission), and rx is the receiving //! // half (rx for receiving). //! let (tx, rx) = channel(); -//! for i in 0i..10i { +//! for i in 0..10 { //! let tx = tx.clone(); //! Thread::spawn(move|| { //! tx.send(i).unwrap(); //! }); //! } //! -//! for _ in 0i..10i { +//! for _ in 0..10 { //! let j = rx.recv().unwrap(); //! assert!(0 <= j && j < 10); //! } @@ -514,15 +514,15 @@ pub fn channel() -> (Sender, Receiver) { /// let (tx, rx) = sync_channel(1); /// /// // this returns immediately -/// tx.send(1i).unwrap(); +/// tx.send(1).unwrap(); /// /// Thread::spawn(move|| { /// // this will block until the previous message has been received -/// tx.send(2i).unwrap(); +/// tx.send(2).unwrap(); /// }); /// -/// assert_eq!(rx.recv().unwrap(), 1i); -/// assert_eq!(rx.recv().unwrap(), 2i); +/// assert_eq!(rx.recv().unwrap(), 1); +/// assert_eq!(rx.recv().unwrap(), 2); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn sync_channel(bound: uint) -> (SyncSender, Receiver) { @@ -562,11 +562,11 @@ impl Sender { /// let (tx, rx) = channel(); /// /// // This send is always successful - /// tx.send(1i).unwrap(); + /// tx.send(1).unwrap(); /// /// // This send will fail because the receiver is gone /// drop(rx); - /// assert_eq!(tx.send(1i).err().unwrap().0, 1); + /// assert_eq!(tx.send(1).err().unwrap().0, 1); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn send(&self, t: T) -> Result<(), SendError> { @@ -1045,7 +1045,7 @@ mod test { #[test] fn drop_full() { let (tx, _rx) = channel(); - tx.send(box 1i).unwrap(); + tx.send(box 1).unwrap(); } #[test] @@ -1053,7 +1053,7 @@ mod test { let (tx, _rx) = channel(); drop(tx.clone()); drop(tx.clone()); - tx.send(box 1i).unwrap(); + tx.send(box 1).unwrap(); } #[test] @@ -1147,7 +1147,7 @@ mod test { fn stress() { let (tx, rx) = channel::(); let t = Thread::scoped(move|| { - for _ in 0u..10000 { tx.send(1i).unwrap(); } + for _ in 0u..10000 { tx.send(1).unwrap(); } }); for _ in 0u..10000 { assert_eq!(rx.recv().unwrap(), 1); @@ -1187,13 +1187,13 @@ mod test { let (tx2, rx2) = channel::(); let t1 = Thread::scoped(move|| { tx1.send(()).unwrap(); - for _ in 0i..40 { + for _ in 0..40 { assert_eq!(rx2.recv().unwrap(), 1); } }); rx1.recv().unwrap(); let t2 = Thread::scoped(move|| { - for _ in 0i..40 { + for _ in 0..40 { tx2.send(1).unwrap(); } }); @@ -1205,7 +1205,7 @@ mod test { fn recv_from_outside_runtime() { let (tx, rx) = channel::(); let t = Thread::scoped(move|| { - for _ in 0i..40 { + for _ in 0..40 { assert_eq!(rx.recv().unwrap(), 1); } }); @@ -1391,9 +1391,9 @@ mod test { for _ in 0..stress_factor() { let (tx, rx) = channel(); let _t = Thread::spawn(move|| { - tx.send(box 10i).unwrap(); + tx.send(box 10).unwrap(); }); - assert!(rx.recv().unwrap() == box 10i); + assert!(rx.recv().unwrap() == box 10); } } @@ -1429,8 +1429,8 @@ mod test { fn recv_a_lot() { // Regression test that we don't run out of stack in scheduler context let (tx, rx) = channel(); - for _ in 0i..10000 { tx.send(()).unwrap(); } - for _ in 0i..10000 { rx.recv().unwrap(); } + for _ in 0..10000 { tx.send(()).unwrap(); } + for _ in 0..10000 { rx.recv().unwrap(); } } #[test] @@ -1567,7 +1567,7 @@ mod sync_tests { #[test] fn drop_full() { let (tx, _rx) = sync_channel(1); - tx.send(box 1i).unwrap(); + tx.send(box 1).unwrap(); } #[test] @@ -1855,9 +1855,9 @@ mod sync_tests { for _ in 0..stress_factor() { let (tx, rx) = sync_channel::>(0); let _t = Thread::spawn(move|| { - tx.send(box 10i).unwrap(); + tx.send(box 10).unwrap(); }); - assert!(rx.recv().unwrap() == box 10i); + assert!(rx.recv().unwrap() == box 10); } } diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index 53eba131674..3980d2a1fef 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -165,8 +165,8 @@ mod tests { #[test] fn test_full() { let q = Queue::new(); - q.push(box 1i); - q.push(box 2i); + q.push(box 1); + q.push(box 2); } #[test] diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index f70e2dee8ee..85c7572404b 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -32,15 +32,15 @@ //! let (tx1, rx1) = channel(); //! let (tx2, rx2) = channel(); //! -//! tx1.send(1i).unwrap(); -//! tx2.send(2i).unwrap(); +//! tx1.send(1).unwrap(); +//! tx2.send(2).unwrap(); //! //! select! { //! val = rx1.recv() => { -//! assert_eq!(val.unwrap(), 1i); +//! assert_eq!(val.unwrap(), 1); //! }, //! val = rx2.recv() => { -//! assert_eq!(val.unwrap(), 2i); +//! assert_eq!(val.unwrap(), 2); //! } //! } //! ``` diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index 45503f0b58e..c80aa567173 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -253,9 +253,9 @@ mod test { fn smoke() { unsafe { let queue = Queue::new(0); - queue.push(1i); + queue.push(1); queue.push(2); - assert_eq!(queue.pop(), Some(1i)); + assert_eq!(queue.pop(), Some(1)); assert_eq!(queue.pop(), Some(2)); assert_eq!(queue.pop(), None); queue.push(3); @@ -270,7 +270,7 @@ mod test { fn peek() { unsafe { let queue = Queue::new(0); - queue.push(vec![1i]); + queue.push(vec![1]); // Ensure the borrowchecker works match queue.peek() { @@ -290,8 +290,8 @@ mod test { fn drop_full() { unsafe { let q = Queue::new(0); - q.push(box 1i); - q.push(box 2i); + q.push(box 1); + q.push(box 2); } } @@ -299,7 +299,7 @@ mod test { fn smoke_bound() { unsafe { let q = Queue::new(0); - q.push(1i); + q.push(1); q.push(2); assert_eq!(q.pop(), Some(1)); assert_eq!(q.pop(), Some(2)); @@ -328,7 +328,7 @@ mod test { for _ in 0u..100000 { loop { match q2.pop() { - Some(1i) => break, + Some(1) => break, Some(_) => panic!(), None => {} } @@ -336,7 +336,7 @@ mod test { } tx.send(()).unwrap(); }); - for _ in 0i..100000 { + for _ in 0..100000 { q.push(1); } rx.recv().unwrap(); diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index c31010c170d..7531d5b058d 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -428,7 +428,7 @@ mod test { #[test] fn test_arc_condvar_poison() { - let packet = Packet(Arc::new((Mutex::new(1i), Condvar::new()))); + let packet = Packet(Arc::new((Mutex::new(1), Condvar::new()))); let packet2 = Packet(packet.0.clone()); let (tx, rx) = channel(); @@ -457,7 +457,7 @@ mod test { #[test] fn test_mutex_arc_poison() { - let arc = Arc::new(Mutex::new(1i)); + let arc = Arc::new(Mutex::new(1)); let arc2 = arc.clone(); let _ = Thread::scoped(move|| { let lock = arc2.lock().unwrap(); @@ -470,7 +470,7 @@ mod test { fn test_mutex_arc_nested() { // Tests nested mutexes and access // to underlying data. - let arc = Arc::new(Mutex::new(1i)); + let arc = Arc::new(Mutex::new(1)); let arc2 = Arc::new(Mutex::new(arc)); let (tx, rx) = channel(); let _t = Thread::spawn(move|| { @@ -484,7 +484,7 @@ mod test { #[test] fn test_mutex_arc_access_in_unwind() { - let arc = Arc::new(Mutex::new(1i)); + let arc = Arc::new(Mutex::new(1)); let arc2 = arc.clone(); let _ = Thread::scoped(move|| -> () { struct Unwinder { diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 0604003cecd..2df211f3768 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -134,7 +134,7 @@ mod test { #[test] fn smoke_once() { static O: Once = ONCE_INIT; - let mut a = 0i; + let mut a = 0; O.call_once(|| a += 1); assert_eq!(a, 1); O.call_once(|| a += 1); diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index b5817ad64f6..95b570dd9c8 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -41,7 +41,7 @@ use sys_common::rwlock as sys; /// ``` /// use std::sync::RwLock; /// -/// let lock = RwLock::new(5i); +/// let lock = RwLock::new(5); /// /// // many reader locks can be held at once /// { @@ -437,7 +437,7 @@ mod tests { #[test] fn test_rw_arc_poison_wr() { - let arc = Arc::new(RwLock::new(1i)); + let arc = Arc::new(RwLock::new(1)); let arc2 = arc.clone(); let _: Result = Thread::scoped(move|| { let _lock = arc2.write().unwrap(); @@ -448,7 +448,7 @@ mod tests { #[test] fn test_rw_arc_poison_ww() { - let arc = Arc::new(RwLock::new(1i)); + let arc = Arc::new(RwLock::new(1)); let arc2 = arc.clone(); let _: Result = Thread::scoped(move|| { let _lock = arc2.write().unwrap(); @@ -459,7 +459,7 @@ mod tests { #[test] fn test_rw_arc_no_poison_rr() { - let arc = Arc::new(RwLock::new(1i)); + let arc = Arc::new(RwLock::new(1)); let arc2 = arc.clone(); let _: Result = Thread::scoped(move|| { let _lock = arc2.read().unwrap(); @@ -470,7 +470,7 @@ mod tests { } #[test] fn test_rw_arc_no_poison_rw() { - let arc = Arc::new(RwLock::new(1i)); + let arc = Arc::new(RwLock::new(1)); let arc2 = arc.clone(); let _: Result = Thread::scoped(move|| { let _lock = arc2.read().unwrap(); @@ -482,7 +482,7 @@ mod tests { #[test] fn test_rw_arc() { - let arc = Arc::new(RwLock::new(0i)); + let arc = Arc::new(RwLock::new(0)); let arc2 = arc.clone(); let (tx, rx) = channel(); @@ -520,7 +520,7 @@ mod tests { #[test] fn test_rw_arc_access_in_unwind() { - let arc = Arc::new(RwLock::new(1i)); + let arc = Arc::new(RwLock::new(1)); let arc2 = arc.clone(); let _ = Thread::scoped(move|| -> () { struct Unwinder { diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index 3fcca2f35e1..b004a47f8a3 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -509,7 +509,7 @@ impl Process { // which will wake up the other end at some point, so we just allow this // signal to be coalesced with the pending signals on the pipe. extern fn sigchld_handler(_signum: libc::c_int) { - let msg = 1i; + let msg = 1; match unsafe { libc::write(WRITE_FD, &msg as *const _ as *const libc::c_void, 1) } { diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index 2b5ced5085b..a526f3393f2 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -162,7 +162,7 @@ mod imp { pub static SIGSTKSZ: libc::size_t = 8192; - pub const SIG_DFL: sighandler_t = 0i as sighandler_t; + pub const SIG_DFL: sighandler_t = 0 as sighandler_t; // This definition is not as accurate as it could be, {si_addr} is // actually a giant union. Currently we're only interested in that field, @@ -214,7 +214,7 @@ mod imp { pub const SIGSTKSZ: libc::size_t = 131072; - pub const SIG_DFL: sighandler_t = 0i as sighandler_t; + pub const SIG_DFL: sighandler_t = 0 as sighandler_t; pub type sigset_t = u32; @@ -271,7 +271,7 @@ mod imp { } pub unsafe fn make_handler() -> super::Handler { - super::Handler { _data: 0i as *mut libc::c_void } + super::Handler { _data: 0 as *mut libc::c_void } } pub unsafe fn drop_handler(_handler: &mut super::Handler) { diff --git a/src/libstd/sys/windows/backtrace.rs b/src/libstd/sys/windows/backtrace.rs index a186465f234..1be1a412ffa 100644 --- a/src/libstd/sys/windows/backtrace.rs +++ b/src/libstd/sys/windows/backtrace.rs @@ -333,7 +333,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> { let _c = Cleanup { handle: process, SymCleanup: SymCleanup }; // And now that we're done with all the setup, do the stack walking! - let mut i = 0i; + let mut i = 0; try!(write!(w, "stack backtrace:\n")); while StackWalk64(image, process, thread, &mut frame, &mut context, ptr::null_mut(), diff --git a/src/libstd/sys/windows/stack_overflow.rs b/src/libstd/sys/windows/stack_overflow.rs index e8b447022cb..0cb4c573ae3 100644 --- a/src/libstd/sys/windows/stack_overflow.rs +++ b/src/libstd/sys/windows/stack_overflow.rs @@ -81,7 +81,7 @@ pub unsafe fn make_handler() -> Handler { panic!("failed to reserve stack space for exception handling"); } - Handler { _data: 0i as *mut libc::c_void } + Handler { _data: 0 as *mut libc::c_void } } pub struct EXCEPTION_RECORD { diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index 655195a3c28..0f8ceed39a6 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -235,7 +235,7 @@ unsafe extern "system" fn on_tls_callback(h: LPVOID, unsafe fn run_dtors() { let mut any_run = true; - for _ in 0..5i { + for _ in 0..5 { if !any_run { break } any_run = false; let dtors = { diff --git a/src/libstd/tuple.rs b/src/libstd/tuple.rs index 2a911557765..988b13cd160 100644 --- a/src/libstd/tuple.rs +++ b/src/libstd/tuple.rs @@ -35,9 +35,9 @@ //! let x = ("colorless", "green", "ideas", "sleep", "furiously"); //! assert_eq!(x.3, "sleep"); //! -//! let v = (3i, 3i); -//! let u = (1i, -5i); -//! assert_eq!(v.0 * u.0 + v.1 * u.1, -12i); +//! let v = (3, 3); +//! let u = (1, -5); +//! assert_eq!(v.0 * u.0 + v.1 * u.1, -12); //! ``` //! //! Using traits implemented for tuples: @@ -45,8 +45,8 @@ //! ``` //! use std::default::Default; //! -//! let a = (1i, 2i); -//! let b = (3i, 4i); +//! let a = (1, 2); +//! let b = (3, 4); //! assert!(a != b); //! //! let c = b.clone(); diff --git a/src/test/auxiliary/issue-11224.rs b/src/test/auxiliary/issue-11224.rs index d66cfe9bf63..560844332a1 100644 --- a/src/test/auxiliary/issue-11224.rs +++ b/src/test/auxiliary/issue-11224.rs @@ -21,6 +21,6 @@ mod inner { } pub fn foo() { - let a = &1i as &inner::Trait; + let a = &1 as &inner::Trait; a.f(); } diff --git a/src/test/auxiliary/issue-8044.rs b/src/test/auxiliary/issue-8044.rs index 7096146a43a..7bfd2e79641 100644 --- a/src/test/auxiliary/issue-8044.rs +++ b/src/test/auxiliary/issue-8044.rs @@ -21,5 +21,5 @@ pub fn leaf(value: V) -> TreeItem { } fn main() { - BTree:: { node: leaf(1i) }; + BTree:: { node: leaf(1) }; } diff --git a/src/test/auxiliary/issue-9906.rs b/src/test/auxiliary/issue-9906.rs index c0cb501735d..1e746bf39db 100644 --- a/src/test/auxiliary/issue-9906.rs +++ b/src/test/auxiliary/issue-9906.rs @@ -22,6 +22,6 @@ mod other { } pub fn foo(){ - 1i+1; + 1+1; } } diff --git a/src/test/auxiliary/macro_crate_test.rs b/src/test/auxiliary/macro_crate_test.rs index e3e91e05f55..d545a42ae19 100644 --- a/src/test/auxiliary/macro_crate_test.rs +++ b/src/test/auxiliary/macro_crate_test.rs @@ -25,9 +25,9 @@ use syntax::ptr::P; use rustc::plugin::Registry; #[macro_export] -macro_rules! exported_macro { () => (2i) } +macro_rules! exported_macro { () => (2) } -macro_rules! unexported_macro { () => (3i) } +macro_rules! unexported_macro { () => (3) } #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { @@ -47,7 +47,7 @@ fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) if !tts.is_empty() { cx.span_fatal(sp, "make_a_1 takes no arguments"); } - MacExpr::new(quote_expr!(cx, 1i)) + MacExpr::new(quote_expr!(cx, 1)) } // See Issue #15750 diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 6d12d84f652..388868eee70 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -62,7 +62,7 @@ fn maybe_run_test(argv: &[String], name: String, test: F) where F: FnOnce() { } fn shift_push() { - let mut v1 = repeat(1i).take(30000).collect::>(); + let mut v1 = repeat(1).take(30000).collect::>(); let mut v2 = Vec::new(); while v1.len() > 0 { diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index e6ef58cba35..11c471c40c5 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -150,16 +150,16 @@ fn mask(dy: int, dx: int, id: uint, p: &Vec<(int, int)>) -> Option { // (i/5, i%5). fn make_masks() -> Vec > > { let pieces = vec!( - vec!((0i,0i),(0,1),(0,2),(0,3),(1,3)), - vec!((0i,0i),(0,2),(0,3),(1,0),(1,1)), - vec!((0i,0i),(0,1),(0,2),(1,2),(2,1)), - vec!((0i,0i),(0,1),(0,2),(1,1),(2,1)), - vec!((0i,0i),(0,2),(1,0),(1,1),(2,1)), - vec!((0i,0i),(0,1),(0,2),(1,1),(1,2)), - vec!((0i,0i),(0,1),(1,1),(1,2),(2,1)), - vec!((0i,0i),(0,1),(0,2),(1,0),(1,2)), - vec!((0i,0i),(0,1),(0,2),(1,2),(1,3)), - vec!((0i,0i),(0,1),(0,2),(0,3),(1,2))); + vec!((0,0),(0,1),(0,2),(0,3),(1,3)), + vec!((0,0),(0,2),(0,3),(1,0),(1,1)), + vec!((0,0),(0,1),(0,2),(1,2),(2,1)), + vec!((0,0),(0,1),(0,2),(1,1),(2,1)), + vec!((0,0),(0,2),(1,0),(1,1),(2,1)), + vec!((0,0),(0,1),(0,2),(1,1),(1,2)), + vec!((0,0),(0,1),(1,1),(1,2),(2,1)), + vec!((0,0),(0,1),(0,2),(1,0),(1,2)), + vec!((0,0),(0,1),(0,2),(1,2),(1,3)), + vec!((0,0),(0,1),(0,2),(0,3),(1,2))); // To break the central symmetry of the problem, every // transformation must be taken except for one piece (piece 3 @@ -169,7 +169,7 @@ fn make_masks() -> Vec > > { .map(|(id, p)| transform(p, id != 3)) .collect(); - (0i..50).map(|yx| { + (0..50).map(|yx| { transforms.iter().enumerate().map(|(id, t)| { t.iter().filter_map(|p| mask(yx / 5, yx % 5, id, p)).collect() }).collect() diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 2f68262b608..dd3ae1699a9 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -66,9 +66,9 @@ fn parse_opts(argv: Vec ) -> Config { } fn stress_task(id: int) { - let mut i = 0i; + let mut i = 0; loop { - let n = 15i; + let n = 15; assert_eq!(fib(n), fib(n)); i += 1; println!("{}: Completed {} iterations", id, i); diff --git a/src/test/debuginfo/basic-types-metadata.rs b/src/test/debuginfo/basic-types-metadata.rs index 5e2497043da..3b016f287fb 100644 --- a/src/test/debuginfo/basic-types-metadata.rs +++ b/src/test/debuginfo/basic-types-metadata.rs @@ -67,7 +67,7 @@ fn main() { let f32: f32 = 2.5; let f64: f64 = 3.5; _zzz(); // #break - if 1i == 1 { _yyy(); } + if 1 == 1 { _yyy(); } } fn _zzz() {()} diff --git a/src/test/debuginfo/box.rs b/src/test/debuginfo/box.rs index 0439e3dc34d..6db3dce4668 100644 --- a/src/test/debuginfo/box.rs +++ b/src/test/debuginfo/box.rs @@ -36,8 +36,8 @@ #![omit_gdb_pretty_printer_section] fn main() { - let a = box 1i; - let b = box() (2i, 3.5f64); + let a = box 1; + let b = box() (2, 3.5f64); zzz(); // #break } diff --git a/src/test/debuginfo/closure-in-generic-function.rs b/src/test/debuginfo/closure-in-generic-function.rs index f8b12569400..59428a2c06f 100644 --- a/src/test/debuginfo/closure-in-generic-function.rs +++ b/src/test/debuginfo/closure-in-generic-function.rs @@ -60,8 +60,8 @@ fn some_generic_fun(a: T1, b: T2) -> (T2, T1) { } fn main() { - some_generic_fun(0.5f64, 10i); - some_generic_fun(&29i, box 110i); + some_generic_fun(0.5f64, 10); + some_generic_fun(&29, box 110); } fn zzz() { () } diff --git a/src/test/debuginfo/destructured-for-loop-variable.rs b/src/test/debuginfo/destructured-for-loop-variable.rs index 38f8f859d39..08062ce8966 100644 --- a/src/test/debuginfo/destructured-for-loop-variable.rs +++ b/src/test/debuginfo/destructured-for-loop-variable.rs @@ -202,7 +202,7 @@ fn main() { zzz(); // #break } - for i in 1234..1235i { + for i in 1234..1235 { zzz(); // #break } diff --git a/src/test/debuginfo/destructured-local.rs b/src/test/debuginfo/destructured-local.rs index 1fd598e18c1..22cc779aeca 100644 --- a/src/test/debuginfo/destructured-local.rs +++ b/src/test/debuginfo/destructured-local.rs @@ -278,7 +278,7 @@ fn main() { let Struct { a: k, b: l } = Struct { a: 12, b: 13 }; // ignored tuple element - let (m, _, n) = (14i, 15i, 16i); + let (m, _, n) = (14, 15, 16); // ignored struct field let Struct { b: o, .. } = Struct { a: 17, b: 18 }; @@ -291,25 +291,25 @@ fn main() { // complex nesting let ((u, v), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue) = - ((25i, 26i), ((27i, (28i, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33i); + ((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33); // reference - let &aa = &(34i, 35i); + let &aa = &(34, 35); // reference - let &bb = &(36i, 37i); + let &bb = &(36, 37); // contained reference - let (&cc, _) = (&38i, 39i); + let (&cc, _) = (&38, 39); // unique pointer - let box dd = box() (40i, 41i, 42i); + let box dd = box() (40, 41, 42); // ref binding - let ref ee = (43i, 44i, 45i); + let ref ee = (43, 44, 45); // ref binding in tuple - let (ref ff, gg) = (46i, (47i, 48i)); + let (ref ff, gg) = (46, (47, 48)); // ref binding in struct let Struct { b: ref hh, .. } = Struct { a: 49, b: 50 }; diff --git a/src/test/debuginfo/function-arg-initialization.rs b/src/test/debuginfo/function-arg-initialization.rs index 38875c7656e..f9a2b2fef34 100644 --- a/src/test/debuginfo/function-arg-initialization.rs +++ b/src/test/debuginfo/function-arg-initialization.rs @@ -245,7 +245,7 @@ fn non_immediate_args(a: BigStruct, b: BigStruct) { } fn binding(a: i64, b: u64, c: f64) { - let x = 0i; // #break + let x = 0; // #break ::std::old_io::print("") } diff --git a/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs b/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs index 4692318b98f..8d456f33432 100644 --- a/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs +++ b/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs @@ -270,7 +270,7 @@ fn non_immediate_args(a: BigStruct, b: BigStruct) { #[no_stack_check] fn binding(a: i64, b: u64, c: f64) { - let x = 0i; + let x = 0; ::std::old_io::print(""); } diff --git a/src/test/debuginfo/function-prologue-stepping-regular.rs b/src/test/debuginfo/function-prologue-stepping-regular.rs index 799352911f6..14433fbcd23 100644 --- a/src/test/debuginfo/function-prologue-stepping-regular.rs +++ b/src/test/debuginfo/function-prologue-stepping-regular.rs @@ -148,7 +148,7 @@ fn non_immediate_args(a: BigStruct, b: BigStruct) { } fn binding(a: i64, b: u64, c: f64) { - let x = 0i; + let x = 0; } fn assignment(mut a: u64, b: u64, c: f64) { diff --git a/src/test/debuginfo/generic-function.rs b/src/test/debuginfo/generic-function.rs index b2fdb708db5..b9a09867a00 100644 --- a/src/test/debuginfo/generic-function.rs +++ b/src/test/debuginfo/generic-function.rs @@ -86,9 +86,9 @@ fn dup_tup(t0: &T0, t1: &T1) -> ((T0, T1), (T1, T0)) { fn main() { - let _ = dup_tup(&1i, &2.5f64); + let _ = dup_tup(&1, &2.5f64); let _ = dup_tup(&3.5f64, &4_u16); - let _ = dup_tup(&5i, &Struct { a: 6, b: 7.5 }); + let _ = dup_tup(&5, &Struct { a: 6, b: 7.5 }); } fn zzz() {()} diff --git a/src/test/debuginfo/generic-functions-nested.rs b/src/test/debuginfo/generic-functions-nested.rs index 0f3fd556f18..9f6d8a45a99 100644 --- a/src/test/debuginfo/generic-functions-nested.rs +++ b/src/test/debuginfo/generic-functions-nested.rs @@ -74,7 +74,7 @@ #![omit_gdb_pretty_printer_section] fn outer(a: TA) { - inner(a.clone(), 1i); + inner(a.clone(), 1); inner(a.clone(), 2.5f64); fn inner(x: TX, y: TY) { @@ -83,7 +83,7 @@ fn outer(a: TA) { } fn main() { - outer(-1i); + outer(-1); outer(-2.5f64); } diff --git a/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs b/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs index bf755d379a6..61843a20d05 100644 --- a/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs +++ b/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs @@ -61,8 +61,8 @@ impl Enum { } fn main() { - Struct::static_method(1i, 2i); - Enum::static_method(-3i, 4.5f64, 5i); + Struct::static_method(1, 2); + Enum::static_method(-3, 4.5f64, 5); } fn zzz() {()} diff --git a/src/test/debuginfo/generic-struct-style-enum.rs b/src/test/debuginfo/generic-struct-style-enum.rs index 992e7417913..2faafbd7634 100644 --- a/src/test/debuginfo/generic-struct-style-enum.rs +++ b/src/test/debuginfo/generic-struct-style-enum.rs @@ -76,7 +76,7 @@ fn main() { // 0b01011001 = 89 let case3: Regular = Case3 { a: 0, b: 6438275382588823897 }; - let univariant = TheOnlyCase { a: -1i }; + let univariant = TheOnlyCase { a: -1 }; zzz(); // #break } diff --git a/src/test/debuginfo/generic-struct.rs b/src/test/debuginfo/generic-struct.rs index a81230599fa..0eb65f2d80f 100644 --- a/src/test/debuginfo/generic-struct.rs +++ b/src/test/debuginfo/generic-struct.rs @@ -51,12 +51,12 @@ struct AGenericStruct { fn main() { - let int_int = AGenericStruct { key: 0i, value: 1i }; - let int_float = AGenericStruct { key: 2i, value: 3.5f64 }; - let float_int = AGenericStruct { key: 4.5f64, value: 5i }; + let int_int = AGenericStruct { key: 0, value: 1 }; + let int_float = AGenericStruct { key: 2, value: 3.5f64 }; + let float_int = AGenericStruct { key: 4.5f64, value: 5 }; let float_int_float = AGenericStruct { key: 6.5f64, - value: AGenericStruct { key: 7i, value: 8.5f64 }, + value: AGenericStruct { key: 7, value: 8.5f64 }, }; zzz(); // #break diff --git a/src/test/debuginfo/lexical-scope-in-for-loop.rs b/src/test/debuginfo/lexical-scope-in-for-loop.rs index 3309ae13c9d..1fa54e47163 100644 --- a/src/test/debuginfo/lexical-scope-in-for-loop.rs +++ b/src/test/debuginfo/lexical-scope-in-for-loop.rs @@ -90,15 +90,15 @@ fn main() { - let range = [1i, 2, 3]; + let range = [1, 2, 3]; - let x = 1000000i; // wan meeeljen doollaars! + let x = 1000000; // wan meeeljen doollaars! for &x in range.iter() { zzz(); // #break sentinel(); - let x = -1i * x; + let x = -1 * x; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scope-in-if.rs b/src/test/debuginfo/lexical-scope-in-if.rs index bc3a6945243..c885bfce216 100644 --- a/src/test/debuginfo/lexical-scope-in-if.rs +++ b/src/test/debuginfo/lexical-scope-in-if.rs @@ -138,8 +138,8 @@ fn main() { - let x = 999i; - let y = -1i; + let x = 999; + let y = -1; zzz(); // #break sentinel(); @@ -148,13 +148,13 @@ fn main() { zzz(); // #break sentinel(); - let x = 1001i; + let x = 1001; zzz(); // #break sentinel(); - let x = 1002i; - let y = 1003i; + let x = 1002; + let y = 1003; zzz(); // #break sentinel(); } else { @@ -170,8 +170,8 @@ fn main() { zzz(); // #break sentinel(); - let x = 1004i; - let y = 1005i; + let x = 1004; + let y = 1005; zzz(); // #break sentinel(); } diff --git a/src/test/debuginfo/lexical-scope-in-match.rs b/src/test/debuginfo/lexical-scope-in-match.rs index 37976ab3996..c596253560e 100644 --- a/src/test/debuginfo/lexical-scope-in-match.rs +++ b/src/test/debuginfo/lexical-scope-in-match.rs @@ -135,13 +135,13 @@ struct Struct { fn main() { - let shadowed = 231i; - let not_shadowed = 232i; + let shadowed = 231; + let not_shadowed = 232; zzz(); // #break sentinel(); - match (233i, 234i) { + match (233, 234) { (shadowed, local_to_arm) => { zzz(); // #break @@ -149,7 +149,7 @@ fn main() { } } - match (235i, 236i) { + match (235, 236) { // with literal (235, shadowed) => { @@ -186,7 +186,7 @@ fn main() { _ => {} } - match (243i, 244i) { + match (243, 244) { (shadowed, ref local_to_arm) => { zzz(); // #break diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs index 107c5cb9782..5e04c81cefd 100644 --- a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs @@ -19,6 +19,6 @@ // Nothing to do here really, just make sure it compiles. See issue #8513. fn main() { let _ = |&:|(); - let _ = (1u..3).map(|_| 5i); + let _ = (1u..3).map(|_| 5); } diff --git a/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs b/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs index b295c6f37a7..6826bca695b 100644 --- a/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs +++ b/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs @@ -136,7 +136,7 @@ fn main() { - let mut x = 0i; + let mut x = 0; loop { if x >= 2 { @@ -160,7 +160,7 @@ fn main() { zzz(); // #break sentinel(); - let x = -987i; + let x = -987; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scope-in-while.rs b/src/test/debuginfo/lexical-scope-in-while.rs index c7a36ef9b82..40280b469f7 100644 --- a/src/test/debuginfo/lexical-scope-in-while.rs +++ b/src/test/debuginfo/lexical-scope-in-while.rs @@ -136,7 +136,7 @@ fn main() { - let mut x = 0i; + let mut x = 0; while x < 2 { zzz(); // #break @@ -156,7 +156,7 @@ fn main() { zzz(); // #break sentinel(); - let x = -987i; + let x = -987; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scope-with-macro.rs b/src/test/debuginfo/lexical-scope-with-macro.rs index 2aa31969a46..da941979fb6 100644 --- a/src/test/debuginfo/lexical-scope-with-macro.rs +++ b/src/test/debuginfo/lexical-scope-with-macro.rs @@ -123,7 +123,7 @@ macro_rules! no_new_scope { macro_rules! new_scope { () => ({ - let a = 890242i; + let a = 890242; zzz(); // #break sentinel(); }) @@ -151,8 +151,8 @@ macro_rules! dup_expr { fn main() { - let a = trivial!(10i); - let b = no_new_scope!(33i); + let a = trivial!(10); + let b = no_new_scope!(33); zzz(); // #break sentinel(); @@ -162,12 +162,12 @@ fn main() { zzz(); // #break sentinel(); - shadow_within_macro!(100i); + shadow_within_macro!(100); zzz(); // #break sentinel(); - let c = dup_expr!(10i * 20); + let c = dup_expr!(10 * 20); zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/lexical-scopes-in-block-expression.rs b/src/test/debuginfo/lexical-scopes-in-block-expression.rs index 2f8b11ac283..118d096d31b 100644 --- a/src/test/debuginfo/lexical-scopes-in-block-expression.rs +++ b/src/test/debuginfo/lexical-scopes-in-block-expression.rs @@ -364,8 +364,8 @@ fn a_function(x: int) -> int { fn main() { - let val = -1i; - let ten = 10i; + let val = -1; + let ten = 10; // surrounded by struct expression let point = Point { @@ -417,7 +417,7 @@ fn main() { sentinel(); val - }, 0i); + }, 0); zzz(); // #break sentinel(); @@ -492,7 +492,7 @@ fn main() { sentinel(); // index expression - let a_vector = [10i; 20]; + let a_vector = [10; 20]; let _ = a_vector[{ zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs index e1aec83714d..c8fe76fdbe5 100644 --- a/src/test/debuginfo/limited-debuginfo.rs +++ b/src/test/debuginfo/limited-debuginfo.rs @@ -47,7 +47,7 @@ fn zzz() {()} fn some_function(a: int, b: int) { let some_variable = Struct { a: 11, b: 22 }; - let some_other_variable = 23i; + let some_other_variable = 23; for x in 0..1 { zzz(); // #break diff --git a/src/test/debuginfo/multiple-functions-equal-var-names.rs b/src/test/debuginfo/multiple-functions-equal-var-names.rs index cb21c13426a..0b2f8ef8181 100644 --- a/src/test/debuginfo/multiple-functions-equal-var-names.rs +++ b/src/test/debuginfo/multiple-functions-equal-var-names.rs @@ -48,18 +48,18 @@ #![omit_gdb_pretty_printer_section] fn function_one() { - let abc = 10101i; + let abc = 10101; zzz(); // #break } fn function_two() { - let abc = 20202i; + let abc = 20202; zzz(); // #break } fn function_three() { - let abc = 30303i; + let abc = 30303; zzz(); // #break } diff --git a/src/test/debuginfo/multiple-functions.rs b/src/test/debuginfo/multiple-functions.rs index ef7c4ce2045..00698ae1dfb 100644 --- a/src/test/debuginfo/multiple-functions.rs +++ b/src/test/debuginfo/multiple-functions.rs @@ -48,18 +48,18 @@ #![omit_gdb_pretty_printer_section] fn function_one() { - let a = 10101i; + let a = 10101; zzz(); // #break } fn function_two() { - let b = 20202i; + let b = 20202; zzz(); // #break } fn function_three() { - let c = 30303i; + let c = 30303; zzz(); // #break } diff --git a/src/test/debuginfo/name-shadowing-and-scope-nesting.rs b/src/test/debuginfo/name-shadowing-and-scope-nesting.rs index d248c7e9819..8c1a5376dba 100644 --- a/src/test/debuginfo/name-shadowing-and-scope-nesting.rs +++ b/src/test/debuginfo/name-shadowing-and-scope-nesting.rs @@ -103,20 +103,20 @@ fn main() { zzz(); // #break sentinel(); - let x = 10i; + let x = 10; zzz(); // #break sentinel(); let x = 10.5f64; - let y = 20i; + let y = 20; zzz(); // #break sentinel(); { let x = true; - let y = 2220i; + let y = 2220; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/shadowed-argument.rs b/src/test/debuginfo/shadowed-argument.rs index c5c3664b07a..5b36d32e49f 100644 --- a/src/test/debuginfo/shadowed-argument.rs +++ b/src/test/debuginfo/shadowed-argument.rs @@ -65,13 +65,13 @@ fn a_function(x: bool, y: bool) { zzz(); // #break sentinel(); - let x = 10i; + let x = 10; zzz(); // #break sentinel(); let x = 10.5f64; - let y = 20i; + let y = 20; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/shadowed-variable.rs b/src/test/debuginfo/shadowed-variable.rs index f384b756da6..66fd656eaac 100644 --- a/src/test/debuginfo/shadowed-variable.rs +++ b/src/test/debuginfo/shadowed-variable.rs @@ -67,13 +67,13 @@ fn main() { zzz(); // #break sentinel(); - let x = 10i; + let x = 10; zzz(); // #break sentinel(); let x = 10.5f64; - let y = 20i; + let y = 20; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/simple-lexical-scope.rs b/src/test/debuginfo/simple-lexical-scope.rs index 5981c18494d..31441db20f1 100644 --- a/src/test/debuginfo/simple-lexical-scope.rs +++ b/src/test/debuginfo/simple-lexical-scope.rs @@ -91,7 +91,7 @@ fn main() { zzz(); // #break sentinel(); - let x = 10i; + let x = 10; zzz(); // #break sentinel(); diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs index 156e5f12ad5..24b6df4e8f1 100644 --- a/src/test/debuginfo/type-names.rs +++ b/src/test/debuginfo/type-names.rs @@ -288,15 +288,15 @@ fn main() { let slice2 = vec2.as_slice(); // Trait Objects - let box_trait = (box 0i) as Box; - let ref_trait = &0i as &Trait1; - let mut mut_int1 = 0i; + let box_trait = (box 0) as Box; + let ref_trait = &0 as &Trait1; + let mut mut_int1 = 0; let mut_ref_trait = (&mut mut_int1) as &mut Trait1; - let generic_box_trait = (box 0i) as Box>; - let generic_ref_trait = (&0i) as &Trait2; + let generic_box_trait = (box 0) as Box>; + let generic_ref_trait = (&0) as &Trait2; - let mut generic_mut_ref_trait_impl = 0i; + let mut generic_mut_ref_trait_impl = 0; let generic_mut_ref_trait = (&mut generic_mut_ref_trait_impl) as &mut Trait2>; diff --git a/src/test/debuginfo/vec.rs b/src/test/debuginfo/vec.rs index 92a490206b6..9ee18c0d77b 100644 --- a/src/test/debuginfo/vec.rs +++ b/src/test/debuginfo/vec.rs @@ -34,7 +34,7 @@ static mut VECT: [i32; 3] = [1, 2, 3]; fn main() { - let a = [1i, 2, 3]; + let a = [1, 2, 3]; unsafe { VECT[0] = 4; diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs index 1e286c236a5..c9cb72d8af7 100644 --- a/src/test/pretty/block-disambig.rs +++ b/src/test/pretty/block-disambig.rs @@ -15,9 +15,9 @@ use std::cell::Cell; -fn test1() { let val = &0i; { } *val; } +fn test1() { let val = &0; { } *val; } -fn test2() -> int { let val = &0i; { } *val } +fn test2() -> int { let val = &0; { } *val } #[derive(Copy)] struct S { eax: int } @@ -35,13 +35,13 @@ fn test5() -> (int, int) { { } (0, 1) } fn test6() -> bool { { } (true || false) && true } fn test7() -> uint { - let regs = &0i; + let regs = &0; match true { true => { } _ => { } } (*regs < 2) as uint } fn test8() -> int { - let val = &0i; + let val = &0; match true { true => { } _ => { } @@ -54,12 +54,12 @@ fn test8() -> int { } fn test9() { - let regs = &Cell::new(0i); + let regs = &Cell::new(0); match true { true => { } _ => { } } regs.set(regs.get() + 1); } fn test10() -> int { - let regs = vec!(0i); + let regs = vec!(0); match true { true => { } _ => { } } regs[0] } diff --git a/src/test/pretty/issue-929.rs b/src/test/pretty/issue-929.rs index 377f4669ffc..75a6b919342 100644 --- a/src/test/pretty/issue-929.rs +++ b/src/test/pretty/issue-929.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f() { if (1i == panic!()) { } else { } } +fn f() { if (1 == panic!()) { } else { } } fn main() { } diff --git a/src/test/pretty/match-block-expr.rs b/src/test/pretty/match-block-expr.rs index 44771a29bb4..7751f155da4 100644 --- a/src/test/pretty/match-block-expr.rs +++ b/src/test/pretty/match-block-expr.rs @@ -11,6 +11,6 @@ // pp-exact fn main() { - let x = match { 5i } { 1 => 5i, 2 => 6, _ => 7, }; + let x = match { 5 } { 1 => 5, 2 => 6, _ => 7, }; assert_eq!(x , 7); } diff --git a/src/test/pretty/match-naked-expr-medium.rs b/src/test/pretty/match-naked-expr-medium.rs index d2f8157ef62..39af19dbf6f 100644 --- a/src/test/pretty/match-naked-expr-medium.rs +++ b/src/test/pretty/match-naked-expr-medium.rs @@ -11,7 +11,7 @@ // pp-exact fn main() { - let x = Some(3i); + let x = Some(3); let _y = match x { Some(_) => diff --git a/src/test/pretty/match-naked-expr.rs b/src/test/pretty/match-naked-expr.rs index 6b4f579f9c5..02bbf667d96 100644 --- a/src/test/pretty/match-naked-expr.rs +++ b/src/test/pretty/match-naked-expr.rs @@ -11,7 +11,7 @@ // pp-exact fn main() { - let x = Some(3i); + let x = Some(3); let _y = match x { Some(_) => "some(_)".to_string(), diff --git a/src/test/pretty/path-type-bounds.rs b/src/test/pretty/path-type-bounds.rs index 382394b1407..e27a3365a41 100644 --- a/src/test/pretty/path-type-bounds.rs +++ b/src/test/pretty/path-type-bounds.rs @@ -19,6 +19,6 @@ fn foo<'a>(x: Box) -> Box { x } fn main() { let x: Box; - Box::new(1i) as Box; + Box::new(1) as Box; } diff --git a/src/test/pretty/unary-op-disambig.rs b/src/test/pretty/unary-op-disambig.rs index 850904fe53e..1592e010aaf 100644 --- a/src/test/pretty/unary-op-disambig.rs +++ b/src/test/pretty/unary-op-disambig.rs @@ -18,10 +18,10 @@ fn block_nosemi() -> int { ({ 0 }) - 1 } fn if_semi() -> int { if true { f() } else { f() }; -1 } -fn if_nosemi() -> int { (if true { 0i } else { 0i }) - 1 } +fn if_nosemi() -> int { (if true { 0 } else { 0 }) - 1 } fn alt_semi() -> int { match true { true => { f() } _ => { } }; -1 } fn alt_no_semi() -> int { (match true { true => { 0 } _ => { 1 } }) - 1 } -fn stmt() { { f() }; -1i; } +fn stmt() { { f() }; -1; } diff --git a/src/test/pretty/vec-comments.pp b/src/test/pretty/vec-comments.pp index 401c63efbc4..dc2dae1044d 100644 --- a/src/test/pretty/vec-comments.pp +++ b/src/test/pretty/vec-comments.pp @@ -15,25 +15,25 @@ fn main() { let _v1 = [ // Comment - 0i, + 0, // Comment - 1i, + 1, // Comment - 2i]; + 2]; let _v2 = - [0i, // Comment - 1i, // Comment - 2i]; // Comment + [0, // Comment + 1, // Comment + 2]; // Comment let _v3 = [ /* Comment */ - 0i, + 0, /* Comment */ - 1i, + 1, /* Comment */ - 2i]; + 2]; let _v4 = - [0i, /* Comment */ - 1i, /* Comment */ - 2i]; /* Comment */ + [0, /* Comment */ + 1, /* Comment */ + 2]; /* Comment */ } diff --git a/src/test/pretty/vec-comments.rs b/src/test/pretty/vec-comments.rs index 401c63efbc4..dc2dae1044d 100644 --- a/src/test/pretty/vec-comments.rs +++ b/src/test/pretty/vec-comments.rs @@ -15,25 +15,25 @@ fn main() { let _v1 = [ // Comment - 0i, + 0, // Comment - 1i, + 1, // Comment - 2i]; + 2]; let _v2 = - [0i, // Comment - 1i, // Comment - 2i]; // Comment + [0, // Comment + 1, // Comment + 2]; // Comment let _v3 = [ /* Comment */ - 0i, + 0, /* Comment */ - 1i, + 1, /* Comment */ - 2i]; + 2]; let _v4 = - [0i, /* Comment */ - 1i, /* Comment */ - 2i]; /* Comment */ + [0, /* Comment */ + 1, /* Comment */ + 2]; /* Comment */ } diff --git a/src/test/run-fail/assert-eq-macro-panic.rs b/src/test/run-fail/assert-eq-macro-panic.rs index 69ed025070b..fd6d69efb4f 100644 --- a/src/test/run-fail/assert-eq-macro-panic.rs +++ b/src/test/run-fail/assert-eq-macro-panic.rs @@ -11,5 +11,5 @@ // error-pattern:assertion failed: `(left == right) && (right == left)` (left: `14`, right: `15`) fn main() { - assert_eq!(14i,15i); + assert_eq!(14,15); } diff --git a/src/test/run-fail/assert-macro-fmt.rs b/src/test/run-fail/assert-macro-fmt.rs index 223c60d6ae4..78239a2217e 100644 --- a/src/test/run-fail/assert-macro-fmt.rs +++ b/src/test/run-fail/assert-macro-fmt.rs @@ -11,5 +11,5 @@ // error-pattern:panicked at 'test-assert-fmt 42 rust' fn main() { - assert!(false, "test-assert-fmt {} {}", 42i, "rust"); + assert!(false, "test-assert-fmt {} {}", 42, "rust"); } diff --git a/src/test/run-fail/bounds-check-no-overflow.rs b/src/test/run-fail/bounds-check-no-overflow.rs index df9050e2186..be4ad0781f2 100644 --- a/src/test/run-fail/bounds-check-no-overflow.rs +++ b/src/test/run-fail/bounds-check-no-overflow.rs @@ -14,6 +14,6 @@ use std::uint; use std::mem::size_of; fn main() { - let xs = [1i, 2, 3]; + let xs = [1, 2, 3]; xs[uint::MAX / size_of::() + 1]; } diff --git a/src/test/run-fail/divide-by-zero.rs b/src/test/run-fail/divide-by-zero.rs index c58d30f2729..de69b7b9fa6 100644 --- a/src/test/run-fail/divide-by-zero.rs +++ b/src/test/run-fail/divide-by-zero.rs @@ -10,6 +10,6 @@ // error-pattern:attempted to divide by zero fn main() { - let y = 0i; - let _z = 1i / y; + let y = 0; + let _z = 1 / y; } diff --git a/src/test/run-fail/dst-raw-slice.rs b/src/test/run-fail/dst-raw-slice.rs index 39bf899a023..77cec8b6327 100644 --- a/src/test/run-fail/dst-raw-slice.rs +++ b/src/test/run-fail/dst-raw-slice.rs @@ -12,7 +12,7 @@ // error-pattern:index out of bounds fn main() { - let a: *const [_] = &[1i, 2, 3]; + let a: *const [_] = &[1, 2, 3]; unsafe { let _b = (*a)[3]; } diff --git a/src/test/run-fail/explicit-panic-msg.rs b/src/test/run-fail/explicit-panic-msg.rs index ae6e72bdd4f..c9c04e5f2da 100644 --- a/src/test/run-fail/explicit-panic-msg.rs +++ b/src/test/run-fail/explicit-panic-msg.rs @@ -13,7 +13,7 @@ // error-pattern:wooooo fn main() { - let mut a = 1i; - if 1i == 1 { a = 2; } + let mut a = 1; + if 1 == 1 { a = 2; } panic!(format!("woooo{}", "o")); } diff --git a/src/test/run-fail/expr-if-panic.rs b/src/test/run-fail/expr-if-panic.rs index f04c94a3bf4..b6791271a11 100644 --- a/src/test/run-fail/expr-if-panic.rs +++ b/src/test/run-fail/expr-if-panic.rs @@ -10,4 +10,4 @@ // error-pattern:explicit panic -fn main() { let _x = if false { 0i } else if true { panic!() } else { 10i }; } +fn main() { let _x = if false { 0 } else if true { panic!() } else { 10 }; } diff --git a/src/test/run-fail/expr-match-panic.rs b/src/test/run-fail/expr-match-panic.rs index d5c005b7029..3a6bd59b3ac 100644 --- a/src/test/run-fail/expr-match-panic.rs +++ b/src/test/run-fail/expr-match-panic.rs @@ -10,4 +10,4 @@ // error-pattern:explicit panic -fn main() { let _x = match true { false => { 0i } true => { panic!() } }; } +fn main() { let _x = match true { false => { 0 } true => { panic!() } }; } diff --git a/src/test/run-fail/issue-12920.rs b/src/test/run-fail/issue-12920.rs index 8dbfc06152a..cbc92c640d2 100644 --- a/src/test/run-fail/issue-12920.rs +++ b/src/test/run-fail/issue-12920.rs @@ -11,5 +11,5 @@ // error-pattern:explicit panic pub fn main() { - panic!(); println!("{}", 1i); + panic!(); println!("{}", 1); } diff --git a/src/test/run-fail/issue-3029.rs b/src/test/run-fail/issue-3029.rs index 0846ba2e71a..4d048fe0fcf 100644 --- a/src/test/run-fail/issue-3029.rs +++ b/src/test/run-fail/issue-3029.rs @@ -16,7 +16,7 @@ // error-pattern:so long fn main() { let mut x = Vec::new(); - let y = vec!(3i); + let y = vec!(3); panic!("so long"); x.extend(y.into_iter()); } diff --git a/src/test/run-fail/mod-zero.rs b/src/test/run-fail/mod-zero.rs index 54415051708..76d4de7ecb0 100644 --- a/src/test/run-fail/mod-zero.rs +++ b/src/test/run-fail/mod-zero.rs @@ -10,6 +10,6 @@ // error-pattern:attempted remainder with a divisor of zero fn main() { - let y = 0i; - let _z = 1i % y; + let y = 0; + let _z = 1 % y; } diff --git a/src/test/run-fail/panic-macro-any.rs b/src/test/run-fail/panic-macro-any.rs index 231c57390b3..ce6a5d46cc7 100644 --- a/src/test/run-fail/panic-macro-any.rs +++ b/src/test/run-fail/panic-macro-any.rs @@ -14,5 +14,5 @@ #![feature(box_syntax)] fn main() { - panic!(box 413i as Box<::std::any::Any+Send>); + panic!(box 413 as Box<::std::any::Any+Send>); } diff --git a/src/test/run-fail/panic-macro-fmt.rs b/src/test/run-fail/panic-macro-fmt.rs index ac50f02cf33..50ad99c6747 100644 --- a/src/test/run-fail/panic-macro-fmt.rs +++ b/src/test/run-fail/panic-macro-fmt.rs @@ -11,5 +11,5 @@ // error-pattern:panicked at 'test-fail-fmt 42 rust' fn main() { - panic!("test-fail-fmt {} {}", 42i, "rust"); + panic!("test-fail-fmt {} {}", 42, "rust"); } diff --git a/src/test/run-fail/panic-task-name-none.rs b/src/test/run-fail/panic-task-name-none.rs index 9beee3b1843..816ee84a841 100644 --- a/src/test/run-fail/panic-task-name-none.rs +++ b/src/test/run-fail/panic-task-name-none.rs @@ -15,7 +15,7 @@ use std::thread::Thread; fn main() { let r: Result = Thread::scoped(move|| { panic!("test"); - 1i + 1 }).join(); assert!(r.is_ok()); } diff --git a/src/test/run-fail/panic-task-name-owned.rs b/src/test/run-fail/panic-task-name-owned.rs index 714cec6fb3d..d48d282c9eb 100644 --- a/src/test/run-fail/panic-task-name-owned.rs +++ b/src/test/run-fail/panic-task-name-owned.rs @@ -15,7 +15,7 @@ use std::thread::Builder; fn main() { let r: Result = Builder::new().name("owned name".to_string()).scoped(move|| { panic!("test"); - 1i + 1 }).join(); assert!(r.is_ok()); } diff --git a/src/test/run-fail/unwind-interleaved.rs b/src/test/run-fail/unwind-interleaved.rs index 5012ded28b5..91a33329a4f 100644 --- a/src/test/run-fail/unwind-interleaved.rs +++ b/src/test/run-fail/unwind-interleaved.rs @@ -15,8 +15,8 @@ fn a() { } fn b() { panic!(); } fn main() { - let _x = vec!(0i); + let _x = vec!(0); a(); - let _y = vec!(0i); + let _y = vec!(0); b(); } diff --git a/src/test/run-fail/unwind-unique.rs b/src/test/run-fail/unwind-unique.rs index f39ded8f98e..e1176b1bcdb 100644 --- a/src/test/run-fail/unwind-unique.rs +++ b/src/test/run-fail/unwind-unique.rs @@ -18,6 +18,6 @@ fn failfn() { } fn main() { - box 0i; + box 0; failfn(); } diff --git a/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs b/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs index f9dffdf8928..f7c581172e2 100644 --- a/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs +++ b/src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs @@ -23,7 +23,7 @@ fn main() { let main_file = tmpdir.join("broken.rs"); let _ = File::create(&main_file).unwrap() .write_str("pub fn main() { - let \x00name_0,ctxt_0\x00 = 3i; + let \x00name_0,ctxt_0\x00 = 3; println!(\"{}\", \x00name_0,ctxt_0\x00); }"); diff --git a/src/test/run-make/static-unwinding/main.rs b/src/test/run-make/static-unwinding/main.rs index bd88cb19aa7..6d10a247143 100644 --- a/src/test/run-make/static-unwinding/main.rs +++ b/src/test/run-make/static-unwinding/main.rs @@ -25,7 +25,7 @@ fn main() { Thread::scoped(move|| { let _a = A; lib::callback(|| panic!()); - 1i + 1 }).join().err().unwrap(); unsafe { diff --git a/src/test/run-pass-fulldeps/issue-16992.rs b/src/test/run-pass-fulldeps/issue-16992.rs index 563b8394963..9e3ad8ee283 100644 --- a/src/test/run-pass-fulldeps/issue-16992.rs +++ b/src/test/run-pass-fulldeps/issue-16992.rs @@ -19,8 +19,8 @@ use syntax::ext::base::ExtCtxt; #[allow(dead_code)] fn foobar(cx: &mut ExtCtxt) { - quote_expr!(cx, 1i); - quote_expr!(cx, 2i); + quote_expr!(cx, 1); + quote_expr!(cx, 2); } fn main() { } diff --git a/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs b/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs index a8762234ad9..497afae6189 100644 --- a/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs +++ b/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs @@ -20,9 +20,9 @@ extern crate macro_crate_test; fn main() { - let x = 3i; + let x = 3; assert_eq!(3, identity!(x)); assert_eq!(6, identity!(x+x)); - let x = 4i; + let x = 4; assert_eq!(4, identity!(x)); } diff --git a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs index 2d5bbd43e82..848ea738ed7 100644 --- a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs +++ b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs @@ -19,7 +19,7 @@ extern crate syntax; use syntax::ext::base::ExtCtxt; fn test(cx: &mut ExtCtxt) { - let foo = 10i; + let foo = 10; let _e = quote_expr!(cx, $foo); } diff --git a/src/test/run-pass/assert-eq-macro-success.rs b/src/test/run-pass/assert-eq-macro-success.rs index 8771ed7a742..e55a2d39cbf 100644 --- a/src/test/run-pass/assert-eq-macro-success.rs +++ b/src/test/run-pass/assert-eq-macro-success.rs @@ -15,7 +15,7 @@ struct Point { x : int } pub fn main() { - assert_eq!(14i,14i); + assert_eq!(14,14); assert_eq!("abc".to_string(),"abc".to_string()); assert_eq!(box Point{x:34},box Point{x:34}); assert_eq!(&Point{x:34},&Point{x:34}); diff --git a/src/test/run-pass/associated-types-binding-in-where-clause.rs b/src/test/run-pass/associated-types-binding-in-where-clause.rs index caf7d31a5fd..2f9a0b328b5 100644 --- a/src/test/run-pass/associated-types-binding-in-where-clause.rs +++ b/src/test/run-pass/associated-types-binding-in-where-clause.rs @@ -37,7 +37,7 @@ fn foo_uint>(x: I) -> uint { } pub fn main() { - let a = 42i; + let a = 42; foo_uint(a); let a = 'a'; diff --git a/src/test/run-pass/associated-types-bound.rs b/src/test/run-pass/associated-types-bound.rs index c34a19e1d82..9f97d69ce3f 100644 --- a/src/test/run-pass/associated-types-bound.rs +++ b/src/test/run-pass/associated-types-bound.rs @@ -8,44 +8,44 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test equality constraints on associated types in a where clause. +// Test equality constrai32s on associated types in a where clause. -pub trait ToInt { - fn to_int(&self) -> int; +pub trait ToI32 { + fn to_i32(&self) -> i32; } -impl ToInt for int { - fn to_int(&self) -> int { *self } +impl ToI32 for i32 { + fn to_i32(&self) -> i32 { *self } } -impl ToInt for uint { - fn to_int(&self) -> int { *self as int } +impl ToI32 for u32 { + fn to_i32(&self) -> i32 { *self as i32 } } -pub trait GetToInt +pub trait GetToI32 { - type R : ToInt; + type R : ToI32; - fn get(&self) -> ::R; + fn get(&self) -> ::R; } -impl GetToInt for int { - type R = int; - fn get(&self) -> int { *self } +impl GetToI32 for i32 { + type R = i32; + fn get(&self) -> i32 { *self } } -impl GetToInt for uint { - type R = uint; - fn get(&self) -> uint { *self } +impl GetToI32 for u32 { + type R = u32; + fn get(&self) -> u32 { *self } } -fn foo(g: G) -> int - where G : GetToInt +fn foo(g: G) -> i32 + where G : GetToI32 { - ToInt::to_int(&g.get()) + ToI32::to_i32(&g.get()) } pub fn main() { - assert_eq!(foo(22i), 22i); - assert_eq!(foo(22u), 22i); + assert_eq!(foo(22i32), 22); + assert_eq!(foo(22u32), 22); } diff --git a/src/test/run-pass/associated-types-cc.rs b/src/test/run-pass/associated-types-cc.rs index 58aa351ba9c..948192f4fc0 100644 --- a/src/test/run-pass/associated-types-cc.rs +++ b/src/test/run-pass/associated-types-cc.rs @@ -22,5 +22,5 @@ fn foo(b: B) -> ::T { } fn main() { - println!("{}", foo(3i)); + println!("{}", foo(3)); } diff --git a/src/test/run-pass/associated-types-nested-projections.rs b/src/test/run-pass/associated-types-nested-projections.rs index a907b9fcde5..e3227613159 100644 --- a/src/test/run-pass/associated-types-nested-projections.rs +++ b/src/test/run-pass/associated-types-nested-projections.rs @@ -45,6 +45,6 @@ fn bar(x: X) where } fn main() { - foo(&[0i, 1, 2]); - bar(&[0i, 1, 2]); + foo(&[0, 1, 2]); + bar(&[0, 1, 2]); } diff --git a/src/test/run-pass/associated-types-ref-in-struct-literal.rs b/src/test/run-pass/associated-types-ref-in-struct-literal.rs index b51d44a0c24..022c8f4cd01 100644 --- a/src/test/run-pass/associated-types-ref-in-struct-literal.rs +++ b/src/test/run-pass/associated-types-ref-in-struct-literal.rs @@ -24,6 +24,6 @@ struct Thing { } fn main() { - let thing = Thing{a: 1i, b: 2i}; + let thing = Thing{a: 1, b: 2}; assert_eq!(thing.a + 1, thing.b); } diff --git a/src/test/run-pass/associated-types-return.rs b/src/test/run-pass/associated-types-return.rs index b9b6d14f8a0..72290921854 100644 --- a/src/test/run-pass/associated-types-return.rs +++ b/src/test/run-pass/associated-types-return.rs @@ -42,11 +42,11 @@ fn foo2(x: I) -> ::A { } pub fn main() { - let a = 42i; + let a = 42; assert!(foo2(a) == 42u); let a = Bar; - assert!(foo2(a) == 43i); + assert!(foo2(a) == 43); let a = 'a'; foo1(a); diff --git a/src/test/run-pass/associated-types-sugar-path.rs b/src/test/run-pass/associated-types-sugar-path.rs index 880554b61b2..ea1df6658fd 100644 --- a/src/test/run-pass/associated-types-sugar-path.rs +++ b/src/test/run-pass/associated-types-sugar-path.rs @@ -40,5 +40,5 @@ impl C for B { } pub fn main() { - let z: uint = bar(2i, 4u); + let z: uint = bar(2, 4u); } diff --git a/src/test/run-pass/auto-instantiate.rs b/src/test/run-pass/auto-instantiate.rs index 0e2f6ef056e..cd4c66cb321 100644 --- a/src/test/run-pass/auto-instantiate.rs +++ b/src/test/run-pass/auto-instantiate.rs @@ -15,6 +15,6 @@ struct Triple { x: int, y: int, z: int } fn f(x: T, y: U) -> Pair { return Pair {a: x, b: y}; } pub fn main() { - println!("{}", f(Triple {x: 3, y: 4, z: 5}, 4i).a.x); - println!("{}", f(5i, 6i).a); + println!("{}", f(Triple {x: 3, y: 4, z: 5}, 4).a.x); + println!("{}", f(5, 6).a); } diff --git a/src/test/run-pass/auto-loop.rs b/src/test/run-pass/auto-loop.rs index 88884dfeb50..e5f4d078749 100644 --- a/src/test/run-pass/auto-loop.rs +++ b/src/test/run-pass/auto-loop.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let mut sum = 0i; + let mut sum = 0; let xs = vec!(1, 2, 3, 4, 5); for x in xs.iter() { sum += *x; diff --git a/src/test/run-pass/auto-ref-sliceable.rs b/src/test/run-pass/auto-ref-sliceable.rs index fd3ede07e21..652f21c2ae3 100644 --- a/src/test/run-pass/auto-ref-sliceable.rs +++ b/src/test/run-pass/auto-ref-sliceable.rs @@ -20,7 +20,7 @@ impl Pushable for Vec { } pub fn main() { - let mut v = vec!(1i); + let mut v = vec!(1); v.push_val(2); v.push_val(3); assert_eq!(v, vec!(1, 2, 3)); diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index af1cc3b1f4d..e9a3ab6be35 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -21,7 +21,7 @@ use std::ops::{Drop, FnMut, FnOnce}; #[inline(never)] fn foo() { - let _v = vec![1i, 2, 3]; + let _v = vec![1, 2, 3]; if os::getenv("IS_TEST").is_some() { panic!() } @@ -77,7 +77,7 @@ fn runtest(me: &str) { assert!(!out.status.success()); let s = str::from_utf8(out.error.as_slice()).unwrap(); let mut i = 0; - for _ in 0i..2 { + for _ in 0..2 { i += s[i + 10..].find_str("stack backtrace").unwrap() + 10; } assert!(s[i + 10..].find_str("stack backtrace").is_none(), diff --git a/src/test/run-pass/binary-minus-without-space.rs b/src/test/run-pass/binary-minus-without-space.rs index 8235b91273b..dc3b142f233 100644 --- a/src/test/run-pass/binary-minus-without-space.rs +++ b/src/test/run-pass/binary-minus-without-space.rs @@ -11,6 +11,6 @@ // Check that issue #954 stays fixed pub fn main() { - match -1i { -1 => {}, _ => panic!("wat") } - assert_eq!(1i-1, 0i); + match -1 { -1 => {}, _ => panic!("wat") } + assert_eq!(1-1, 0); } diff --git a/src/test/run-pass/bitv-perf-test.rs b/src/test/run-pass/bitv-perf-test.rs index 167d0ace159..b6d428924e3 100644 --- a/src/test/run-pass/bitv-perf-test.rs +++ b/src/test/run-pass/bitv-perf-test.rs @@ -22,5 +22,5 @@ fn bitv_test() { } pub fn main() { - for _ in 0i..10000 { bitv_test(); } + for _ in 0..10000 { bitv_test(); } } diff --git a/src/test/run-pass/bitwise.rs b/src/test/run-pass/bitwise.rs index 251804e214b..8a57279e866 100644 --- a/src/test/run-pass/bitwise.rs +++ b/src/test/run-pass/bitwise.rs @@ -33,7 +33,7 @@ fn general() { assert_eq!(0xf0i | 0xf, 0xff); assert_eq!(0xfi << 4, 0xf0); assert_eq!(0xf0i >> 4, 0xf); - assert_eq!(-16i >> 2, -4); + assert_eq!(-16 >> 2, -4); assert_eq!(0b1010_1010i | 0b0101_0101, 0xff); } diff --git a/src/test/run-pass/block-expr-precedence.rs b/src/test/run-pass/block-expr-precedence.rs index 31d0d52f8b4..ace372dd2d3 100644 --- a/src/test/run-pass/block-expr-precedence.rs +++ b/src/test/run-pass/block-expr-precedence.rs @@ -58,9 +58,9 @@ pub fn main() { let num = 12; - assert_eq!(if (true) { 12i } else { 12 } - num, 0); - assert_eq!(12i - if (true) { 12i } else { 12 }, 0); - if (true) { 12i; } {-num}; - if (true) { 12i; }; {-num}; - if (true) { 12i; };;; -num; + assert_eq!(if (true) { 12 } else { 12 } - num, 0); + assert_eq!(12 - if (true) { 12 } else { 12 }, 0); + if (true) { 12; } {-num}; + if (true) { 12; }; {-num}; + if (true) { 12; };;; -num; } diff --git a/src/test/run-pass/block-iter-1.rs b/src/test/run-pass/block-iter-1.rs index 972bde5f29a..b5bd4d90c2e 100644 --- a/src/test/run-pass/block-iter-1.rs +++ b/src/test/run-pass/block-iter-1.rs @@ -11,8 +11,8 @@ fn iter_vec(v: Vec , mut f: F) where F: FnMut(&T) { for x in v.iter() { f(x); } } pub fn main() { - let v = vec!(1i, 2, 3, 4, 5, 6, 7); - let mut odds = 0i; + let v = vec![1i32, 2, 3, 4, 5, 6, 7]; + let mut odds = 0i32; iter_vec(v, |i| { if *i % 2 == 1 { odds += 1; diff --git a/src/test/run-pass/block-iter-2.rs b/src/test/run-pass/block-iter-2.rs index 1032fb486a1..348d9df6e7e 100644 --- a/src/test/run-pass/block-iter-2.rs +++ b/src/test/run-pass/block-iter-2.rs @@ -11,7 +11,7 @@ fn iter_vec(v: Vec, mut f: F) where F: FnMut(&T) { for x in v.iter() { f(x); } } pub fn main() { - let v = vec!(1i, 2, 3, 4, 5); + let v = vec![1i32, 2, 3, 4, 5]; let mut sum = 0; iter_vec(v.clone(), |i| { iter_vec(v.clone(), |j| { diff --git a/src/test/run-pass/borrow-tuple-fields.rs b/src/test/run-pass/borrow-tuple-fields.rs index a151a837f77..2e5688d8b74 100644 --- a/src/test/run-pass/borrow-tuple-fields.rs +++ b/src/test/run-pass/borrow-tuple-fields.rs @@ -11,13 +11,13 @@ struct Foo(int, int); fn main() { - let x = (1i, 2i); + let x = (1, 2); let a = &x.0; let b = &x.0; assert_eq!(*a, 1); assert_eq!(*b, 1); - let mut x = (1i, 2i); + let mut x = (1, 2); { let a = &x.0; let b = &mut x.1; @@ -28,13 +28,13 @@ fn main() { assert_eq!(x.1, 5); - let x = Foo(1i, 2i); + let x = Foo(1, 2); let a = &x.0; let b = &x.0; assert_eq!(*a, 1); assert_eq!(*b, 1); - let mut x = Foo(1i, 2i); + let mut x = Foo(1, 2); { let a = &x.0; let b = &mut x.1; diff --git a/src/test/run-pass/borrowck-closures-two-imm.rs b/src/test/run-pass/borrowck-closures-two-imm.rs index 33e4294366f..df8dbdd03c7 100644 --- a/src/test/run-pass/borrowck-closures-two-imm.rs +++ b/src/test/run-pass/borrowck-closures-two-imm.rs @@ -14,28 +14,28 @@ // that the main function can read the variable too while // the closures are in scope. Issue #6801. -fn a() -> int { - let mut x = 3i; +fn a() -> i32 { + let mut x = 3i32; x += 1; let c1 = |&:| x * 4; let c2 = |&:| x * 5; c1() * c2() * x } -fn get(x: &int) -> int { +fn get(x: &i32) -> i32 { *x * 4 } -fn b() -> int { - let mut x = 3; +fn b() -> i32 { + let mut x = 3i32; x += 1; let c1 = |&:| get(&x); let c2 = |&:| get(&x); c1() * c2() * x } -fn c() -> int { - let mut x = 3; +fn c() -> i32 { + let mut x = 3i32; x += 1; let c1 = |&:| x * 5; let c2 = |&:| get(&x); diff --git a/src/test/run-pass/borrowck-fixed-length-vecs.rs b/src/test/run-pass/borrowck-fixed-length-vecs.rs index 71c8936570a..ee561fdb0be 100644 --- a/src/test/run-pass/borrowck-fixed-length-vecs.rs +++ b/src/test/run-pass/borrowck-fixed-length-vecs.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = [22i]; + let x = [22]; let y = &x[0]; assert_eq!(*y, 22); } diff --git a/src/test/run-pass/borrowck-freeze-frozen-mut.rs b/src/test/run-pass/borrowck-freeze-frozen-mut.rs index 21f5d0e6c14..30a921c9bd2 100644 --- a/src/test/run-pass/borrowck-freeze-frozen-mut.rs +++ b/src/test/run-pass/borrowck-freeze-frozen-mut.rs @@ -19,7 +19,7 @@ fn get<'a, T>(ms: &'a MutSlice<'a, T>, index: uint) -> &'a T { } pub fn main() { - let mut data = [1i, 2, 3]; + let mut data = [1, 2, 3]; { let slice = MutSlice { data: &mut data }; slice.data[0] += 4; diff --git a/src/test/run-pass/borrowck-pat-reassign-no-binding.rs b/src/test/run-pass/borrowck-pat-reassign-no-binding.rs index 6136bc90fd4..4ccbf6b5b0f 100644 --- a/src/test/run-pass/borrowck-pat-reassign-no-binding.rs +++ b/src/test/run-pass/borrowck-pat-reassign-no-binding.rs @@ -14,7 +14,7 @@ pub fn main() { None => { // It is ok to reassign x here, because there is in // fact no outstanding loan of x! - x = Some(0i); + x = Some(0); } Some(_) => { } } diff --git a/src/test/run-pass/borrowed-ptr-pattern-infallible.rs b/src/test/run-pass/borrowed-ptr-pattern-infallible.rs index 55ae6d3bebf..e57c001ea05 100644 --- a/src/test/run-pass/borrowed-ptr-pattern-infallible.rs +++ b/src/test/run-pass/borrowed-ptr-pattern-infallible.rs @@ -10,7 +10,7 @@ pub fn main() { - let (&x, &y) = (&3i, &'a'); + let (&x, &y) = (&3, &'a'); assert_eq!(x, 3); assert_eq!(y, 'a'); } diff --git a/src/test/run-pass/borrowed-ptr-pattern.rs b/src/test/run-pass/borrowed-ptr-pattern.rs index 3636d4d769d..7ccb40c8e7b 100644 --- a/src/test/run-pass/borrowed-ptr-pattern.rs +++ b/src/test/run-pass/borrowed-ptr-pattern.rs @@ -15,6 +15,6 @@ fn foo(x: &T) -> T{ } pub fn main() { - assert_eq!(foo(&3i), 3i); + assert_eq!(foo(&3), 3); assert_eq!(foo(&'a'), 'a'); } diff --git a/src/test/run-pass/break.rs b/src/test/run-pass/break.rs index 89745bd167c..bcfb8f6f914 100644 --- a/src/test/run-pass/break.rs +++ b/src/test/run-pass/break.rs @@ -9,12 +9,12 @@ // except according to those terms. pub fn main() { - let mut i = 0i; + let mut i = 0; while i < 20 { i += 1; if i == 10 { break; } } assert_eq!(i, 10); loop { i += 1; if i == 20 { break; } } assert_eq!(i, 20); - let xs = [1i, 2, 3, 4, 5, 6]; + let xs = [1, 2, 3, 4, 5, 6]; for x in xs.iter() { if *x == 3 { break; } assert!((*x <= 3)); } @@ -25,7 +25,7 @@ pub fn main() { i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); if i >= 10 { break; } } - let ys = vec!(1i, 2, 3, 4, 5, 6); + let ys = vec!(1, 2, 3, 4, 5, 6); for x in ys.iter() { if *x % 2 == 0 { continue; } assert!((*x % 2 != 0)); diff --git a/src/test/run-pass/bug-7183-generics.rs b/src/test/run-pass/bug-7183-generics.rs index bf8d303f341..a3bb02d1d00 100644 --- a/src/test/run-pass/bug-7183-generics.rs +++ b/src/test/run-pass/bug-7183-generics.rs @@ -34,11 +34,11 @@ impl Speak for Option { pub fn main() { - assert_eq!(3i.hi(), "hello: 3".to_string()); - assert_eq!(Some(Some(3i)).hi(), + assert_eq!(3.hi(), "hello: 3".to_string()); + assert_eq!(Some(Some(3)).hi(), "something!something!hello: 3".to_string()); assert_eq!(None::.hi(), "hello - none".to_string()); assert_eq!(Some(None::).hi(), "something!hello - none".to_string()); - assert_eq!(Some(3i).hi(), "something!hello: 3".to_string()); + assert_eq!(Some(3).hi(), "something!hello: 3".to_string()); } diff --git a/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs b/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs index 365670db6f9..3df9dd25d86 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs @@ -28,6 +28,6 @@ fn foo(val: T, chan: Sender) { pub fn main() { let (tx, rx) = channel(); - foo(31337i, tx); - assert!(rx.recv().unwrap() == 31337i); + foo(31337, tx); + assert!(rx.recv().unwrap() == 31337); } diff --git a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs index 126088d7f9d..52b826393e9 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs @@ -31,6 +31,6 @@ fn foo(val: T, chan: Sender) { pub fn main() { let (tx, rx): (Sender>, Receiver>) = channel(); - foo(X(31337i), tx); - assert!(rx.recv().unwrap() == X(31337i)); + foo(X(31337), tx); + assert!(rx.recv().unwrap() == X(31337)); } diff --git a/src/test/run-pass/builtin-superkinds-capabilities.rs b/src/test/run-pass/builtin-superkinds-capabilities.rs index 7f4a2398f54..034e5ff2d3a 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities.rs @@ -24,6 +24,6 @@ fn foo(val: T, chan: Sender) { pub fn main() { let (tx, rx): (Sender, Receiver) = channel(); - foo(31337i, tx); - assert!(rx.recv().unwrap() == 31337i); + foo(31337, tx); + assert!(rx.recv().unwrap() == 31337); } diff --git a/src/test/run-pass/builtin-superkinds-self-type.rs b/src/test/run-pass/builtin-superkinds-self-type.rs index d0db2542ccc..1b3070ba3b0 100644 --- a/src/test/run-pass/builtin-superkinds-self-type.rs +++ b/src/test/run-pass/builtin-superkinds-self-type.rs @@ -23,6 +23,6 @@ impl Foo for T { } pub fn main() { let (tx, rx) = channel(); - 1193182i.foo(tx); - assert!(rx.recv().unwrap() == 1193182i); + 1193182.foo(tx); + assert!(rx.recv().unwrap() == 1193182); } diff --git a/src/test/run-pass/cci_iter_exe.rs b/src/test/run-pass/cci_iter_exe.rs index 7191d5078b8..e4b26ba74be 100644 --- a/src/test/run-pass/cci_iter_exe.rs +++ b/src/test/run-pass/cci_iter_exe.rs @@ -15,7 +15,7 @@ extern crate cci_iter_lib; pub fn main() { //let bt0 = sys::rusti::frame_address(1u32); //println!("%?", bt0); - cci_iter_lib::iter(&[1i, 2, 3], |i| { + cci_iter_lib::iter(&[1, 2, 3], |i| { println!("{}", *i); //assert!(bt0 == sys::rusti::frame_address(2u32)); }) diff --git a/src/test/run-pass/class-poly-methods.rs b/src/test/run-pass/class-poly-methods.rs index d94547a4dda..4f94673a2c0 100644 --- a/src/test/run-pass/class-poly-methods.rs +++ b/src/test/run-pass/class-poly-methods.rs @@ -36,7 +36,7 @@ pub fn main() { let mut kitty = cat(1000u, 2, vec!("tabby".to_string())); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); - nyan.speak(vec!(1i,2,3)); + nyan.speak(vec!(1,2,3)); assert_eq!(nyan.meow_count(), 55u); kitty.speak(vec!("meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string())); assert_eq!(kitty.meow_count(), 1004u); diff --git a/src/test/run-pass/cleanup-rvalue-scopes.rs b/src/test/run-pass/cleanup-rvalue-scopes.rs index bbfe0e6a18d..b39a4d7f685 100644 --- a/src/test/run-pass/cleanup-rvalue-scopes.rs +++ b/src/test/run-pass/cleanup-rvalue-scopes.rs @@ -110,7 +110,7 @@ pub fn main() { end_of_block!(ref _x, AddFlags(1)); end_of_block!(AddFlags { bits: ref _x }, AddFlags(1)); end_of_block!(&AddFlags { bits }, &AddFlags(1)); - end_of_block!((_, ref _y), (AddFlags(1), 22i)); + end_of_block!((_, ref _y), (AddFlags(1), 22)); end_of_block!(box ref _x, box AddFlags(1)); end_of_block!(box _x, box AddFlags(1)); end_of_block!(_, { { check_flags(0); &AddFlags(1) } }); @@ -120,7 +120,7 @@ pub fn main() { // LHS does not create a ref binding, so temporary lives as long // as statement, and we do not move the AddFlags out: end_of_stmt!(_, AddFlags(1)); - end_of_stmt!((_, _), (AddFlags(1), 22i)); + end_of_stmt!((_, _), (AddFlags(1), 22)); // `&` operator appears inside an arg to a function, // so it is not prolonged: diff --git a/src/test/run-pass/closure-inference2.rs b/src/test/run-pass/closure-inference2.rs index 03b10b881f7..c0877568b72 100644 --- a/src/test/run-pass/closure-inference2.rs +++ b/src/test/run-pass/closure-inference2.rs @@ -12,6 +12,6 @@ pub fn main() { let f = {|&: i| i}; - assert_eq!(f(2i), 2i); - assert_eq!(f(5i), 5i); + assert_eq!(f(2), 2); + assert_eq!(f(5), 5); } diff --git a/src/test/run-pass/coerce-match-calls.rs b/src/test/run-pass/coerce-match-calls.rs index 0ff28b471a3..34c9875f1de 100644 --- a/src/test/run-pass/coerce-match-calls.rs +++ b/src/test/run-pass/coerce-match-calls.rs @@ -13,9 +13,9 @@ use std::boxed::Box; pub fn main() { - let _: Box<[int]> = if true { Box::new([1i, 2, 3]) } else { Box::new([1i]) }; + let _: Box<[int]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) }; - let _: Box<[int]> = match true { true => Box::new([1i, 2, 3]), false => Box::new([1i]) }; + let _: Box<[int]> = match true { true => Box::new([1, 2, 3]), false => Box::new([1]) }; // Check we don't get over-keen at propagating coercions in the case of casts. let x = if true { 42 } else { 42u8 } as u16; diff --git a/src/test/run-pass/coerce-match.rs b/src/test/run-pass/coerce-match.rs index 0992ee97d06..098a08b0787 100644 --- a/src/test/run-pass/coerce-match.rs +++ b/src/test/run-pass/coerce-match.rs @@ -14,9 +14,9 @@ #![feature(box_syntax)] pub fn main() { - let _: Box<[int]> = if true { box [1i, 2, 3] } else { box [1i] }; + let _: Box<[int]> = if true { box [1, 2, 3] } else { box [1] }; - let _: Box<[int]> = match true { true => box [1i, 2, 3], false => box [1i] }; + let _: Box<[int]> = match true { true => box [1, 2, 3], false => box [1] }; // Check we don't get over-keen at propagating coercions in the case of casts. let x = if true { 42 } else { 42u8 } as u16; diff --git a/src/test/run-pass/complex.rs b/src/test/run-pass/complex.rs index 34292453ec4..f8c8ac20d72 100644 --- a/src/test/run-pass/complex.rs +++ b/src/test/run-pass/complex.rs @@ -35,8 +35,8 @@ fn foo(x: int) -> int { } pub fn main() { - let x: int = 2i + 2; + let x: int = 2 + 2; println!("{}", x); println!("hello, world"); - println!("{}", 10i); + println!("{}", 10); } diff --git a/src/test/run-pass/concat.rs b/src/test/run-pass/concat.rs index d78f948edc5..2a8443167d0 100644 --- a/src/test/run-pass/concat.rs +++ b/src/test/run-pass/concat.rs @@ -15,12 +15,12 @@ pub fn main() { assert_eq!(concat!("qux", "quux",).to_string(), "quxquux".to_string()); assert_eq!( - concat!(1, 2i, 3u, 4f32, 4.0, 'a', true), + concat!(1, 2, 3u, 4f32, 4.0, 'a', true), "12344.0atrue" ); assert!(match "12344.0atrue" { - concat!(1, 2i, 3u, 4f32, 4.0, 'a', true) => true, + concat!(1, 2, 3u, 4f32, 4.0, 'a', true) => true, _ => false }) } diff --git a/src/test/run-pass/const-binops.rs b/src/test/run-pass/const-binops.rs index 11590ceb19d..1268fc4e435 100644 --- a/src/test/run-pass/const-binops.rs +++ b/src/test/run-pass/const-binops.rs @@ -52,27 +52,27 @@ static V: int = 1 << 3; static W: int = 1024 >> 4; static X: uint = 1024 >> 4; -static Y: bool = 1i == 1; +static Y: bool = 1 == 1; static Z: bool = 1.0f64 == 1.0; -static AA: bool = 1i <= 2; -static AB: bool = -1i <= 2; +static AA: bool = 1 <= 2; +static AB: bool = -1 <= 2; static AC: bool = 1.0f64 <= 2.0; -static AD: bool = 1i < 2; -static AE: bool = -1i < 2; +static AD: bool = 1 < 2; +static AE: bool = -1 < 2; static AF: bool = 1.0f64 < 2.0; -static AG: bool = 1i != 2; -static AH: bool = -1i != 2; +static AG: bool = 1 != 2; +static AH: bool = -1 != 2; static AI: bool = 1.0f64 != 2.0; -static AJ: bool = 2i >= 1; -static AK: bool = 2i >= -2; +static AJ: bool = 2 >= 1; +static AK: bool = 2 >= -2; static AL: bool = 1.0f64 >= -2.0; -static AM: bool = 2i > 1; -static AN: bool = 2i > -2; +static AM: bool = 2 > 1; +static AN: bool = 2 > -2; static AO: bool = 1.0f64 > -2.0; pub fn main() { diff --git a/src/test/run-pass/const-bound.rs b/src/test/run-pass/const-bound.rs index 3a6973fe61c..e6a280a91d7 100644 --- a/src/test/run-pass/const-bound.rs +++ b/src/test/run-pass/const-bound.rs @@ -25,5 +25,5 @@ pub fn main() { foo(F{field: 42}); foo((1, 2u)); foo(@1);*/ - foo(box 1i); + foo(box 1); } diff --git a/src/test/run-pass/const-expr-in-vec-repeat.rs b/src/test/run-pass/const-expr-in-vec-repeat.rs index d692f3a87e4..0b097c0b060 100644 --- a/src/test/run-pass/const-expr-in-vec-repeat.rs +++ b/src/test/run-pass/const-expr-in-vec-repeat.rs @@ -13,6 +13,6 @@ pub fn main() { const FOO: uint = 2; - let _v = [0i; FOO*3*2/2]; + let _v = [0; FOO*3*2/2]; } diff --git a/src/test/run-pass/consts-in-patterns.rs b/src/test/run-pass/consts-in-patterns.rs index 87b7fcad385..e8f4948a165 100644 --- a/src/test/run-pass/consts-in-patterns.rs +++ b/src/test/run-pass/consts-in-patterns.rs @@ -12,11 +12,11 @@ const FOO: int = 10; const BAR: int = 3; pub fn main() { - let x: int = 3i; + let x: int = 3; let y = match x { - FOO => 1i, - BAR => 2i, - _ => 3i + FOO => 1, + BAR => 2, + _ => 3 }; assert_eq!(y, 2); } diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs index ead0683b870..41c74250b3b 100644 --- a/src/test/run-pass/deref-lval.rs +++ b/src/test/run-pass/deref-lval.rs @@ -14,7 +14,7 @@ use std::cell::Cell; pub fn main() { - let x = box Cell::new(5i); - x.set(1000i); + let x = box Cell::new(5); + x.set(1000); println!("{}", x.get()); } diff --git a/src/test/run-pass/deref-rc.rs b/src/test/run-pass/deref-rc.rs index 03697875d56..fbb8a3a1720 100644 --- a/src/test/run-pass/deref-rc.rs +++ b/src/test/run-pass/deref-rc.rs @@ -11,6 +11,6 @@ use std::rc::Rc; fn main() { - let x = Rc::new([1i, 2, 3, 4]); + let x = Rc::new([1, 2, 3, 4]); assert!(*x == [1, 2, 3, 4]); } diff --git a/src/test/run-pass/deriving-clone-generic-enum.rs b/src/test/run-pass/deriving-clone-generic-enum.rs index e8e65dcb8a9..e174ffae75d 100644 --- a/src/test/run-pass/deriving-clone-generic-enum.rs +++ b/src/test/run-pass/deriving-clone-generic-enum.rs @@ -16,5 +16,5 @@ enum E { } pub fn main() { - let _ = E::A::(1i).clone(); + let _ = E::A::(1).clone(); } diff --git a/src/test/run-pass/deriving-clone-generic-struct.rs b/src/test/run-pass/deriving-clone-generic-struct.rs index d340fe9d3fb..329c7dab3eb 100644 --- a/src/test/run-pass/deriving-clone-generic-struct.rs +++ b/src/test/run-pass/deriving-clone-generic-struct.rs @@ -16,5 +16,5 @@ struct S { } pub fn main() { - let _ = S { foo: (), bar: (), baz: 1i }.clone(); + let _ = S { foo: (), bar: (), baz: 1 }.clone(); } diff --git a/src/test/run-pass/deriving-clone-generic-tuple-struct.rs b/src/test/run-pass/deriving-clone-generic-tuple-struct.rs index ecf1fdc6e5f..bb07b08859f 100644 --- a/src/test/run-pass/deriving-clone-generic-tuple-struct.rs +++ b/src/test/run-pass/deriving-clone-generic-tuple-struct.rs @@ -12,5 +12,5 @@ struct S(T, ()); pub fn main() { - let _ = S(1i, ()).clone(); + let _ = S(1, ()).clone(); } diff --git a/src/test/run-pass/deriving-cmp-generic-enum.rs b/src/test/run-pass/deriving-cmp-generic-enum.rs index 04cb3b7c076..b3194d5820a 100644 --- a/src/test/run-pass/deriving-cmp-generic-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-enum.rs @@ -19,10 +19,10 @@ enum E { pub fn main() { let e0 = E::E0; - let e11 = E::E1(1i); - let e12 = E::E1(2i); - let e21 = E::E2(1i, 1i); - let e22 = E::E2(1i, 2i); + let e11 = E::E1(1); + let e12 = E::E1(2); + let e21 = E::E2(1, 1); + let e22 = E::E2(1, 2); // in order for both PartialOrd and Ord let es = [e0, e11, e12, e21, e22]; diff --git a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs index dbac7fa5bca..8b54536f3ab 100644 --- a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs @@ -19,15 +19,15 @@ enum ES { pub fn main() { let (es11, es12, es21, es22) = (ES::ES1 { - x: 1i + x: 1 }, ES::ES1 { - x: 2i + x: 2 }, ES::ES2 { - x: 1i, - y: 1i + x: 1, + y: 1 }, ES::ES2 { - x: 1i, - y: 2i + x: 1, + y: 2 }); // in order for both PartialOrd and Ord diff --git a/src/test/run-pass/deriving-cmp-generic-struct.rs b/src/test/run-pass/deriving-cmp-generic-struct.rs index cd2cbb2d0a9..86887c3411f 100644 --- a/src/test/run-pass/deriving-cmp-generic-struct.rs +++ b/src/test/run-pass/deriving-cmp-generic-struct.rs @@ -17,8 +17,8 @@ struct S { } pub fn main() { - let s1 = S {x: 1i, y: 1i}; - let s2 = S {x: 1i, y: 2i}; + let s1 = S {x: 1, y: 1}; + let s2 = S {x: 1, y: 2}; // in order for both PartialOrd and Ord let ss = [s1, s2]; diff --git a/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs b/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs index 0a45b73755e..c7d7f8ded83 100644 --- a/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs +++ b/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs @@ -15,8 +15,8 @@ struct TS(T,T); pub fn main() { - let ts1 = TS(1i, 1i); - let ts2 = TS(1i, 2i); + let ts1 = TS(1, 1); + let ts2 = TS(1, 2); // in order for both PartialOrd and Ord let tss = [ts1, ts2]; diff --git a/src/test/run-pass/deriving-rand.rs b/src/test/run-pass/deriving-rand.rs index 36b6b3cbeea..d6e5fedf182 100644 --- a/src/test/run-pass/deriving-rand.rs +++ b/src/test/run-pass/deriving-rand.rs @@ -31,7 +31,7 @@ enum D { pub fn main() { // check there's no segfaults - for _ in 0i..20 { + for _ in 0..20 { rand::random::(); rand::random::(); rand::random::(); diff --git a/src/test/run-pass/drop-trait-generic.rs b/src/test/run-pass/drop-trait-generic.rs index 9a93873f538..4ba3aa70dfc 100644 --- a/src/test/run-pass/drop-trait-generic.rs +++ b/src/test/run-pass/drop-trait-generic.rs @@ -22,5 +22,5 @@ impl ::std::ops::Drop for S { } pub fn main() { - let _x = S { x: 1i }; + let _x = S { x: 1 }; } diff --git a/src/test/run-pass/dst-raw.rs b/src/test/run-pass/dst-raw.rs index d3d2e3581aa..226025cd80e 100644 --- a/src/test/run-pass/dst-raw.rs +++ b/src/test/run-pass/dst-raw.rs @@ -45,7 +45,7 @@ pub fn main() { assert!(r == 42); // raw slice - let a: *const [_] = &[1i, 2, 3]; + let a: *const [_] = &[1, 2, 3]; unsafe { let b = (*a)[2]; assert!(b == 3); @@ -54,7 +54,7 @@ pub fn main() { } // raw slice with explicit cast - let a = &[1i, 2, 3] as *const [_]; + let a = &[1, 2, 3] as *const [_]; unsafe { let b = (*a)[2]; assert!(b == 3); @@ -63,7 +63,7 @@ pub fn main() { } // raw DST struct with slice - let c: *const Foo<[_]> = &Foo {f: [1i, 2, 3]}; + let c: *const Foo<[_]> = &Foo {f: [1, 2, 3]}; unsafe { let b = (&*c).f[0]; assert!(b == 1); @@ -86,7 +86,7 @@ pub fn main() { }; assert!(r == 42); - let a: *mut [_] = &mut [1i, 2, 3]; + let a: *mut [_] = &mut [1, 2, 3]; unsafe { let b = (*a)[2]; assert!(b == 3); @@ -94,7 +94,7 @@ pub fn main() { assert!(len == 3); } - let a = &mut [1i, 2, 3] as *mut [_]; + let a = &mut [1, 2, 3] as *mut [_]; unsafe { let b = (*a)[2]; assert!(b == 3); @@ -102,7 +102,7 @@ pub fn main() { assert!(len == 3); } - let c: *mut Foo<[_]> = &mut Foo {f: [1i, 2, 3]}; + let c: *mut Foo<[_]> = &mut Foo {f: [1, 2, 3]}; unsafe { let b = (&*c).f[0]; assert!(b == 1); diff --git a/src/test/run-pass/dst-struct.rs b/src/test/run-pass/dst-struct.rs index fa2af29431c..ee5193adbc6 100644 --- a/src/test/run-pass/dst-struct.rs +++ b/src/test/run-pass/dst-struct.rs @@ -115,7 +115,7 @@ pub fn main() { foo3(f5); // Box. - let f1 = box [1i, 2, 3]; + let f1 = box [1, 2, 3]; assert!((*f1)[1] == 2); let f2: Box<[int]> = f1; assert!((*f2)[1] == 2); diff --git a/src/test/run-pass/early-ret-binop-add.rs b/src/test/run-pass/early-ret-binop-add.rs index b9efdeb3bed..97e873e9aff 100644 --- a/src/test/run-pass/early-ret-binop-add.rs +++ b/src/test/run-pass/early-ret-binop-add.rs @@ -8,5 +8,5 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn wsucc(n: int) -> int { 0i + { return n + 1 } } +fn wsucc(n: int) -> int { 0 + { return n + 1 } } pub fn main() { } diff --git a/src/test/run-pass/early-vtbl-resolution.rs b/src/test/run-pass/early-vtbl-resolution.rs index 70030c66ca2..89fee7358a1 100644 --- a/src/test/run-pass/early-vtbl-resolution.rs +++ b/src/test/run-pass/early-vtbl-resolution.rs @@ -19,5 +19,5 @@ fn foo_func>(x: B) -> Option { x.foo() } struct A { a: int } pub fn main() { - let _x: Option = foo_func(0i); + let _x: Option = foo_func(0); } diff --git a/src/test/run-pass/else-if.rs b/src/test/run-pass/else-if.rs index 63f32ae702b..476d3f42d6e 100644 --- a/src/test/run-pass/else-if.rs +++ b/src/test/run-pass/else-if.rs @@ -11,20 +11,20 @@ pub fn main() { - if 1i == 2 { + if 1 == 2 { assert!((false)); - } else if 2i == 3 { + } else if 2 == 3 { assert!((false)); - } else if 3i == 4 { assert!((false)); } else { assert!((true)); } - if 1i == 2 { assert!((false)); } else if 2i == 2 { assert!((true)); } - if 1i == 2 { + } else if 3 == 4 { assert!((false)); } else { assert!((true)); } + if 1 == 2 { assert!((false)); } else if 2 == 2 { assert!((true)); } + if 1 == 2 { assert!((false)); - } else if 2i == 2 { - if 1i == 1 { + } else if 2 == 2 { + if 1 == 1 { assert!((true)); - } else { if 2i == 1 { assert!((false)); } else { assert!((false)); } } + } else { if 2 == 1 { assert!((false)); } else { assert!((false)); } } } - if 1i == 2 { + if 1 == 2 { assert!((false)); - } else { if 1i == 2 { assert!((false)); } else { assert!((true)); } } + } else { if 1 == 2 { assert!((false)); } else { assert!((true)); } } } diff --git a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs index 81713657202..468e5f5f4b3 100644 --- a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs +++ b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs @@ -19,8 +19,8 @@ enum List { Nil, Cons(X, Box>) } pub fn main() { - match List::Cons(10i, box List::Nil) { - List::Cons(10i, _) => {} + match List::Cons(10, box List::Nil) { + List::Cons(10, _) => {} List::Nil => {} _ => panic!() } diff --git a/src/test/run-pass/enum-vec-initializer.rs b/src/test/run-pass/enum-vec-initializer.rs index d436916c279..86a998100b0 100644 --- a/src/test/run-pass/enum-vec-initializer.rs +++ b/src/test/run-pass/enum-vec-initializer.rs @@ -16,9 +16,9 @@ const BAR:uint = Flopsy::Bunny as uint; const BAR2:uint = BAR; pub fn main() { - let _v = [0i; Flopsy::Bunny as uint]; - let _v = [0i; BAR]; - let _v = [0i; BAR2]; + let _v = [0; Flopsy::Bunny as uint]; + let _v = [0; BAR]; + let _v = [0; BAR2]; const BAR3:uint = BAR2; - let _v = [0i; BAR3]; + let _v = [0; BAR3]; } diff --git a/src/test/run-pass/explicit-i-suffix.rs b/src/test/run-pass/explicit-i-suffix.rs index 45cfee76fb8..96c58b106f3 100644 --- a/src/test/run-pass/explicit-i-suffix.rs +++ b/src/test/run-pass/explicit-i-suffix.rs @@ -9,11 +9,11 @@ // except according to those terms. pub fn main() { - let x: int = 8i; - let y = 9i; + let x: int = 8; + let y = 9; x + y; - let q: int = -8i; - let r = -9i; + let q: int = -8; + let r = -9; q + r; } diff --git a/src/test/run-pass/expr-block-unique.rs b/src/test/run-pass/expr-block-unique.rs index d934ce677d1..d10b209965f 100644 --- a/src/test/run-pass/expr-block-unique.rs +++ b/src/test/run-pass/expr-block-unique.rs @@ -12,4 +12,4 @@ #![allow(unknown_features)] #![feature(box_syntax)] -pub fn main() { let x = { box 100i }; assert!((*x == 100)); } +pub fn main() { let x = { box 100 }; assert!((*x == 100)); } diff --git a/src/test/run-pass/expr-block.rs b/src/test/run-pass/expr-block.rs index 7af9e790504..ee1d955b0d3 100644 --- a/src/test/run-pass/expr-block.rs +++ b/src/test/run-pass/expr-block.rs @@ -20,7 +20,7 @@ struct RS { v1: int, v2: int } fn test_rec() { let rs = { RS {v1: 10, v2: 20} }; assert!((rs.v2 == 20)); } fn test_filled_with_stuff() { - let rs = { let mut a = 0i; while a < 10 { a += 1; } a }; + let rs = { let mut a = 0; while a < 10 { a += 1; } a }; assert_eq!(rs, 10); } diff --git a/src/test/run-pass/expr-empty-ret.rs b/src/test/run-pass/expr-empty-ret.rs index 7b08251967e..afc7dfaf9b4 100644 --- a/src/test/run-pass/expr-empty-ret.rs +++ b/src/test/run-pass/expr-empty-ret.rs @@ -12,7 +12,7 @@ fn f() { let _x = match true { - true => { 10i } + true => { 10 } false => { return } }; } diff --git a/src/test/run-pass/expr-fn.rs b/src/test/run-pass/expr-fn.rs index 8172c16abf2..0ea1f3fcdaf 100644 --- a/src/test/run-pass/expr-fn.rs +++ b/src/test/run-pass/expr-fn.rs @@ -22,7 +22,7 @@ fn test_vec() { fn test_generic() { fn f(t: T) -> T { t } - assert_eq!(f(10i), 10); + assert_eq!(f(10), 10); } fn test_alt() { diff --git a/src/test/run-pass/expr-if-panic-all.rs b/src/test/run-pass/expr-if-panic-all.rs index 0dd7ddc3f84..52ccee05817 100644 --- a/src/test/run-pass/expr-if-panic-all.rs +++ b/src/test/run-pass/expr-if-panic-all.rs @@ -12,7 +12,7 @@ // expression results in panic. pub fn main() { let _x = if true { - 10i + 10 } else { if true { panic!() } else { panic!() } }; diff --git a/src/test/run-pass/expr-if-panic.rs b/src/test/run-pass/expr-if-panic.rs index aa4240c60f1..87c7954fa49 100644 --- a/src/test/run-pass/expr-if-panic.rs +++ b/src/test/run-pass/expr-if-panic.rs @@ -9,18 +9,18 @@ // except according to those terms. fn test_if_panic() { - let x = if false { panic!() } else { 10i }; + let x = if false { panic!() } else { 10 }; assert!((x == 10)); } fn test_else_panic() { - let x = if true { 10i } else { panic!() }; - assert_eq!(x, 10i); + let x = if true { 10 } else { panic!() }; + assert_eq!(x, 10); } fn test_elseif_panic() { - let x = if false { 0i } else if false { panic!() } else { 10i }; - assert_eq!(x, 10i); + let x = if false { 0 } else if false { panic!() } else { 10 }; + assert_eq!(x, 10); } pub fn main() { test_if_panic(); test_else_panic(); test_elseif_panic(); } diff --git a/src/test/run-pass/expr-if-unique.rs b/src/test/run-pass/expr-if-unique.rs index 5294d05401c..317e5434930 100644 --- a/src/test/run-pass/expr-if-unique.rs +++ b/src/test/run-pass/expr-if-unique.rs @@ -15,8 +15,8 @@ // Tests for if as expressions returning boxed types fn test_box() { - let rs = if true { box 100i } else { box 101i }; - assert_eq!(*rs, 100i); + let rs = if true { box 100 } else { box 101 }; + assert_eq!(*rs, 100); } pub fn main() { test_box(); } diff --git a/src/test/run-pass/expr-match-panic-all.rs b/src/test/run-pass/expr-match-panic-all.rs index 3b33c18bbbd..3a8955917d6 100644 --- a/src/test/run-pass/expr-match-panic-all.rs +++ b/src/test/run-pass/expr-match-panic-all.rs @@ -16,7 +16,7 @@ pub fn main() { let _x = match true { - true => { 10i } + true => { 10 } false => { match true { true => { panic!() } false => { panic!() } } } }; } diff --git a/src/test/run-pass/expr-match-panic.rs b/src/test/run-pass/expr-match-panic.rs index d8ee21dfdc6..da24d4c57cc 100644 --- a/src/test/run-pass/expr-match-panic.rs +++ b/src/test/run-pass/expr-match-panic.rs @@ -15,8 +15,8 @@ fn test_simple() { } fn test_box() { - let r = match true { true => { vec!(10i) } false => { panic!() } }; - assert_eq!(r[0], 10i); + let r = match true { true => { vec!(10) } false => { panic!() } }; + assert_eq!(r[0], 10); } pub fn main() { test_simple(); test_box(); } diff --git a/src/test/run-pass/expr-match-unique.rs b/src/test/run-pass/expr-match-unique.rs index 7958f4927da..57ccfe1d5e0 100644 --- a/src/test/run-pass/expr-match-unique.rs +++ b/src/test/run-pass/expr-match-unique.rs @@ -13,8 +13,8 @@ // Tests for match as expressions resulting in boxed types fn test_box() { - let res = match true { true => { box 100i }, _ => panic!() }; - assert_eq!(*res, 100i); + let res = match true { true => { box 100 }, _ => panic!() }; + assert_eq!(*res, 100); } pub fn main() { test_box(); } diff --git a/src/test/run-pass/fat-arrow-match.rs b/src/test/run-pass/fat-arrow-match.rs index 929d1c8e63d..004e6d48e37 100644 --- a/src/test/run-pass/fat-arrow-match.rs +++ b/src/test/run-pass/fat-arrow-match.rs @@ -17,8 +17,8 @@ enum color { pub fn main() { println!("{}", match color::red { - color::red => { 1i } - color::green => { 2i } - color::blue => { 3i } + color::red => { 1 } + color::green => { 2 } + color::blue => { 3 } }); } diff --git a/src/test/run-pass/fixed_length_copy.rs b/src/test/run-pass/fixed_length_copy.rs index dc34cec7fa2..bbd7b9130e7 100644 --- a/src/test/run-pass/fixed_length_copy.rs +++ b/src/test/run-pass/fixed_length_copy.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let arr = [1i,2i,3i]; + let arr = [1,2,3]; let arr2 = arr; - assert_eq!(arr[1], 2i); - assert_eq!(arr2[2], 3i); + assert_eq!(arr[1], 2); + assert_eq!(arr2[2], 3); } diff --git a/src/test/run-pass/fn-type-infer.rs b/src/test/run-pass/fn-type-infer.rs index ae22ff5cce0..785abbe449b 100644 --- a/src/test/run-pass/fn-type-infer.rs +++ b/src/test/run-pass/fn-type-infer.rs @@ -13,6 +13,6 @@ pub fn main() { // We should be able to type infer inside of ||s. let _f = |&:| { - let i = 10i; + let i = 10; }; } diff --git a/src/test/run-pass/for-loop-goofiness.rs b/src/test/run-pass/for-loop-goofiness.rs index 73f4cdd252e..ae509dc0862 100644 --- a/src/test/run-pass/for-loop-goofiness.rs +++ b/src/test/run-pass/for-loop-goofiness.rs @@ -16,7 +16,7 @@ enum BogusOption { type Iterator = int; pub fn main() { - let x = [ 3i, 3, 3 ]; + let x = [ 3, 3, 3 ]; for i in x.iter() { assert_eq!(*i, 3); } diff --git a/src/test/run-pass/foreach-external-iterators-break.rs b/src/test/run-pass/foreach-external-iterators-break.rs index 5f7770e97a9..9cbb4f4107a 100644 --- a/src/test/run-pass/foreach-external-iterators-break.rs +++ b/src/test/run-pass/foreach-external-iterators-break.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let x = [1i; 100]; - let mut y = 0i; + let x = [1; 100]; + let mut y = 0; for i in x.iter() { if y > 10 { break; diff --git a/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs b/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs index 4305ae95698..d16a964ea79 100644 --- a/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs +++ b/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs @@ -18,7 +18,7 @@ use std::collections::HashMap; pub fn main() { let mut h = HashMap::new(); - let kvs = [(1i, 10i), (2i, 20i), (3i, 30i)]; + let kvs = [(1, 10), (2, 20), (3, 30)]; for &(k,v) in kvs.iter() { h.insert(k,v); } diff --git a/src/test/run-pass/foreach-external-iterators-hashmap.rs b/src/test/run-pass/foreach-external-iterators-hashmap.rs index ab20f9f9778..1878997de5a 100644 --- a/src/test/run-pass/foreach-external-iterators-hashmap.rs +++ b/src/test/run-pass/foreach-external-iterators-hashmap.rs @@ -14,12 +14,12 @@ use std::collections::HashMap; pub fn main() { let mut h = HashMap::new(); - let kvs = [(1i, 10i), (2i, 20i), (3i, 30i)]; + let kvs = [(1, 10), (2, 20), (3, 30)]; for &(k,v) in kvs.iter() { h.insert(k,v); } - let mut x = 0i; - let mut y = 0i; + let mut x = 0; + let mut y = 0; for (&k,&v) in h.iter() { x += k; y += v; diff --git a/src/test/run-pass/foreach-external-iterators-loop.rs b/src/test/run-pass/foreach-external-iterators-loop.rs index d8c6dd6a93d..d9abed50123 100644 --- a/src/test/run-pass/foreach-external-iterators-loop.rs +++ b/src/test/run-pass/foreach-external-iterators-loop.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let x = [1i; 100]; - let mut y = 0i; + let x = [1; 100]; + let mut y = 0; for (n,i) in x.iter().enumerate() { if n < 10 { continue; diff --git a/src/test/run-pass/foreach-external-iterators-nested.rs b/src/test/run-pass/foreach-external-iterators-nested.rs index 20ea9c440a1..75471991620 100644 --- a/src/test/run-pass/foreach-external-iterators-nested.rs +++ b/src/test/run-pass/foreach-external-iterators-nested.rs @@ -9,10 +9,10 @@ // except according to those terms. pub fn main() { - let x = [1i; 100]; - let y = [2i; 100]; - let mut p = 0i; - let mut q = 0i; + let x = [1; 100]; + let y = [2; 100]; + let mut p = 0; + let mut q = 0; for i in x.iter() { for j in y.iter() { p += *j; diff --git a/src/test/run-pass/foreach-external-iterators.rs b/src/test/run-pass/foreach-external-iterators.rs index 0ac642cc449..ef4692b2b51 100644 --- a/src/test/run-pass/foreach-external-iterators.rs +++ b/src/test/run-pass/foreach-external-iterators.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let x = [1i; 100]; - let mut y = 0i; + let x = [1; 100]; + let mut y = 0; for i in x.iter() { y += *i } diff --git a/src/test/run-pass/foreign-call-no-runtime.rs b/src/test/run-pass/foreign-call-no-runtime.rs index c1df9d53ad4..f99d3eb1c7d 100644 --- a/src/test/run-pass/foreign-call-no-runtime.rs +++ b/src/test/run-pass/foreign-call-no-runtime.rs @@ -22,7 +22,7 @@ extern { pub fn main() { unsafe { Thread::scoped(move|| { - let i = &100i; + let i = &100; rust_dbg_call(callback, mem::transmute(i)); }).join(); } @@ -31,6 +31,6 @@ pub fn main() { extern fn callback(data: libc::uintptr_t) { unsafe { let data: *const int = mem::transmute(data); - assert_eq!(*data, 100i); + assert_eq!(*data, 100); } } diff --git a/src/test/run-pass/generic-alias-unique.rs b/src/test/run-pass/generic-alias-unique.rs index 34b7f15e4c6..db468ba1802 100644 --- a/src/test/run-pass/generic-alias-unique.rs +++ b/src/test/run-pass/generic-alias-unique.rs @@ -14,7 +14,7 @@ fn id(t: T) -> T { return t; } pub fn main() { - let expected = box 100i; + let expected = box 100; let actual = id::>(expected.clone()); println!("{}", *actual); assert_eq!(*expected, *actual); diff --git a/src/test/run-pass/generic-fn-unique.rs b/src/test/run-pass/generic-fn-unique.rs index be83cb04f2c..6599aa74124 100644 --- a/src/test/run-pass/generic-fn-unique.rs +++ b/src/test/run-pass/generic-fn-unique.rs @@ -13,4 +13,4 @@ fn f(x: Box) -> Box { return x; } -pub fn main() { let x = f(box 3i); println!("{}", *x); } +pub fn main() { let x = f(box 3); println!("{}", *x); } diff --git a/src/test/run-pass/generic-ivec-leak.rs b/src/test/run-pass/generic-ivec-leak.rs index 48b61bf745d..eb0546063f7 100644 --- a/src/test/run-pass/generic-ivec-leak.rs +++ b/src/test/run-pass/generic-ivec-leak.rs @@ -10,4 +10,4 @@ enum wrapper { wrapped(T), } -pub fn main() { let _w = wrapper::wrapped(vec!(1i, 2, 3, 4, 5)); } +pub fn main() { let _w = wrapper::wrapped(vec!(1, 2, 3, 4, 5)); } diff --git a/src/test/run-pass/generic-newtype-struct.rs b/src/test/run-pass/generic-newtype-struct.rs index f87e11cbb61..4e3c8204052 100644 --- a/src/test/run-pass/generic-newtype-struct.rs +++ b/src/test/run-pass/generic-newtype-struct.rs @@ -11,5 +11,5 @@ struct S(T); pub fn main() { - let _s = S(2i); + let _s = S(2); } diff --git a/src/test/run-pass/generic-static-methods.rs b/src/test/run-pass/generic-static-methods.rs index f992847e4e9..90a6349385d 100644 --- a/src/test/run-pass/generic-static-methods.rs +++ b/src/test/run-pass/generic-static-methods.rs @@ -24,5 +24,5 @@ impl vec_utils for Vec { } pub fn main() { - assert_eq!(vec_utils::map_(&vec!(1i,2i,3i), |&x| x+1), vec!(2i,3i,4i)); + assert_eq!(vec_utils::map_(&vec!(1,2,3), |&x| x+1), vec!(2,3,4)); } diff --git a/src/test/run-pass/generic-tag-local.rs b/src/test/run-pass/generic-tag-local.rs index cd8b13421c4..24c31ab4ee6 100644 --- a/src/test/run-pass/generic-tag-local.rs +++ b/src/test/run-pass/generic-tag-local.rs @@ -12,4 +12,4 @@ enum clam { a(T), } -pub fn main() { let _c = clam::a(3i); } +pub fn main() { let _c = clam::a(3); } diff --git a/src/test/run-pass/generic-tup.rs b/src/test/run-pass/generic-tup.rs index dc9a90f7025..cd0e344b89c 100644 --- a/src/test/run-pass/generic-tup.rs +++ b/src/test/run-pass/generic-tup.rs @@ -11,7 +11,7 @@ fn get_third(t: (T, T, T)) -> T { let (_, _, x) = t; return x; } pub fn main() { - println!("{}", get_third((1i, 2i, 3i))); - assert_eq!(get_third((1i, 2i, 3i)), 3); + println!("{}", get_third((1, 2, 3))); + assert_eq!(get_third((1, 2, 3)), 3); assert_eq!(get_third((5u8, 6u8, 7u8)), 7u8); } diff --git a/src/test/run-pass/guards.rs b/src/test/run-pass/guards.rs index e7031ae147e..188106ec107 100644 --- a/src/test/run-pass/guards.rs +++ b/src/test/run-pass/guards.rs @@ -13,14 +13,14 @@ struct Pair { x: int, y: int } pub fn main() { let a: int = - match 10i { x if x < 7 => { 1i } x if x < 11 => { 2i } 10 => { 3i } _ => { 4i } }; + match 10 { x if x < 7 => { 1 } x if x < 11 => { 2 } 10 => { 3 } _ => { 4 } }; assert_eq!(a, 2); let b: int = match (Pair {x: 10, y: 20}) { - x if x.x < 5 && x.y < 5 => { 1i } - Pair {x: x, y: y} if x == 10 && y == 20 => { 2i } - Pair {x: _x, y: _y} => { 3i } + x if x.x < 5 && x.y < 5 => { 1 } + Pair {x: x, y: y} if x == 10 && y == 20 => { 2 } + Pair {x: _x, y: _y} => { 3 } }; assert_eq!(b, 2); } diff --git a/src/test/run-pass/hygiene-dodging-1.rs b/src/test/run-pass/hygiene-dodging-1.rs index eb81f82a146..3969394a26b 100644 --- a/src/test/run-pass/hygiene-dodging-1.rs +++ b/src/test/run-pass/hygiene-dodging-1.rs @@ -14,7 +14,7 @@ mod x { pub fn main(){ // should *not* shadow the module x: - let x = 9i; + let x = 9; // use it to avoid warnings: x+3; assert_eq!(x::g(),14); diff --git a/src/test/run-pass/hygienic-labels-in-let.rs b/src/test/run-pass/hygienic-labels-in-let.rs index d8c08a0e4ef..cca0e5b163c 100644 --- a/src/test/run-pass/hygienic-labels-in-let.rs +++ b/src/test/run-pass/hygienic-labels-in-let.rs @@ -20,19 +20,19 @@ macro_rules! loop_x { macro_rules! while_true { ($e: expr) => { // $e shouldn't be able to interact with this 'x - 'x: while 1i + 1 == 2 { $e } + 'x: while 1 + 1 == 2 { $e } } } macro_rules! run_once { ($e: expr) => { // ditto - 'x: for _ in 0i..1 { $e } + 'x: for _ in 0..1 { $e } } } pub fn main() { - let mut i = 0i; + let mut i = 0; let j: int = { 'x: loop { @@ -42,35 +42,35 @@ pub fn main() { } i + 1 }; - assert_eq!(j, 1i); + assert_eq!(j, 1); let k: int = { - 'x: for _ in 0i..1 { + 'x: for _ in 0..1 { // ditto loop_x!(break 'x); i += 1; } i + 1 }; - assert_eq!(k, 1i); + assert_eq!(k, 1); let l: int = { - 'x: for _ in 0i..1 { + 'x: for _ in 0..1 { // ditto while_true!(break 'x); i += 1; } i + 1 }; - assert_eq!(l, 1i); + assert_eq!(l, 1); let n: int = { - 'x: for _ in 0i..1 { + 'x: for _ in 0..1 { // ditto run_once!(continue 'x); i += 1; } i + 1 }; - assert_eq!(n, 1i); + assert_eq!(n, 1); } diff --git a/src/test/run-pass/hygienic-labels.rs b/src/test/run-pass/hygienic-labels.rs index ff8f248a082..0d8da2a9348 100644 --- a/src/test/run-pass/hygienic-labels.rs +++ b/src/test/run-pass/hygienic-labels.rs @@ -18,19 +18,19 @@ macro_rules! loop_x { macro_rules! run_once { ($e: expr) => { // ditto - 'x: for _ in 0i..1 { $e } + 'x: for _ in 0..1 { $e } } } macro_rules! while_x { ($e: expr) => { // ditto - 'x: while 1i + 1 == 2 { $e } + 'x: while 1 + 1 == 2 { $e } } } pub fn main() { - 'x: for _ in 0i..1 { + 'x: for _ in 0..1 { // this 'x should refer to the outer loop, lexically loop_x!(break 'x); panic!("break doesn't act hygienically inside for loop"); @@ -42,12 +42,12 @@ pub fn main() { panic!("break doesn't act hygienically inside infinite loop"); } - 'x: while 1i + 1 == 2 { + 'x: while 1 + 1 == 2 { while_x!(break 'x); panic!("break doesn't act hygienically inside infinite while loop"); } - 'x: for _ in 0i..1 { + 'x: for _ in 0..1 { // ditto run_once!(continue 'x); panic!("continue doesn't act hygienically inside for loop"); diff --git a/src/test/run-pass/if-let.rs b/src/test/run-pass/if-let.rs index 4dff2ea55f1..5d97b886e8e 100644 --- a/src/test/run-pass/if-let.rs +++ b/src/test/run-pass/if-let.rs @@ -9,9 +9,9 @@ // except according to those terms. pub fn main() { - let x = Some(3i); + let x = Some(3); if let Some(y) = x { - assert_eq!(y, 3i); + assert_eq!(y, 3); } else { panic!("if-let panicked"); } @@ -32,9 +32,9 @@ pub fn main() { } assert_eq!(clause, 4u); - if 3i > 4 { + if 3 > 4 { panic!("bad math"); - } else if let 1 = 2i { + } else if let 1 = 2 { panic!("bad pattern match"); } @@ -44,7 +44,7 @@ pub fn main() { Three(String, int) } - let foo = Foo::Three("three".to_string(), 42i); + let foo = Foo::Three("three".to_string(), 42); if let Foo::One = foo { panic!("bad pattern match"); } else if let Foo::Two(_x) = foo { diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index 56de6726bfb..0acc70f6b5d 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -59,10 +59,10 @@ pub fn main() { // At least exercise all the formats t!(format!("{}", true), "true"); t!(format!("{}", '☃'), "☃"); - t!(format!("{}", 10i), "10"); + t!(format!("{}", 10), "10"); t!(format!("{}", 10u), "10"); t!(format!("{:?}", '☃'), "'\\u{2603}'"); - t!(format!("{:?}", 10i), "10"); + t!(format!("{:?}", 10), "10"); t!(format!("{:?}", 10u), "10"); t!(format!("{:?}", "true"), "\"true\""); t!(format!("{:?}", "foo\nbar"), "\"foo\\nbar\""); @@ -76,16 +76,16 @@ pub fn main() { t!(format!("{:x}", A), "aloha"); t!(format!("{:X}", B), "adios"); t!(format!("foo {} ☃☃☃☃☃☃", "bar"), "foo bar ☃☃☃☃☃☃"); - t!(format!("{1} {0}", 0i, 1i), "1 0"); - t!(format!("{foo} {bar}", foo=0i, bar=1is), "0 1"); + t!(format!("{1} {0}", 0, 1), "1 0"); + t!(format!("{foo} {bar}", foo=0, bar=1is), "0 1"); t!(format!("{foo} {1} {bar} {0}", 0is, 1is, foo=2is, bar=3is), "2 1 3 0"); t!(format!("{} {0}", "a"), "a a"); - t!(format!("{foo_bar}", foo_bar=1i), "1"); - t!(format!("{}", 5i + 5i), "10"); + t!(format!("{foo_bar}", foo_bar=1), "1"); + t!(format!("{}", 5 + 5), "10"); t!(format!("{:#4}", C), "☃123"); // FIXME(#20676) - // let a: &fmt::Debug = &1i; + // let a: &fmt::Debug = &1; // t!(format!("{:?}", a), "1"); @@ -146,7 +146,7 @@ pub fn main() { test_order(); // make sure that format! doesn't move out of local variables - let a = box 3i; + let a = box 3; format!("{}", a); format!("{}", a); @@ -169,10 +169,10 @@ pub fn main() { fn test_write() { use std::fmt::Writer; let mut buf = String::new(); - write!(&mut buf, "{}", 3i); + write!(&mut buf, "{}", 3); { let w = &mut buf; - write!(w, "{foo}", foo=4i); + write!(w, "{foo}", foo=4); write!(w, "{}", "hello"); writeln!(w, "{}", "line"); writeln!(w, "{foo}", foo="bar"); @@ -198,9 +198,9 @@ fn test_format_args() { let mut buf = String::new(); { let w = &mut buf; - write!(w, "{}", format_args!("{}", 1i)); + write!(w, "{}", format_args!("{}", 1)); write!(w, "{}", format_args!("test")); - write!(w, "{}", format_args!("{test}", test=3i)); + write!(w, "{}", format_args!("{test}", test=3)); } let s = buf; t!(s, "1test3"); diff --git a/src/test/run-pass/ignore-all-the-things.rs b/src/test/run-pass/ignore-all-the-things.rs index 1c87b6dad89..65fc24ae746 100644 --- a/src/test/run-pass/ignore-all-the-things.rs +++ b/src/test/run-pass/ignore-all-the-things.rs @@ -23,28 +23,28 @@ pub fn main() { //let (a, b, ..) = (5, 5, 5, 5); //let (.., c, d) = (5, 5, 5, 5); let Bar{b: b, ..} = Bar{a: 5, b: 5, c: 5, d: 5}; - match [5i, 5, 5, 5] { + match [5, 5, 5, 5] { [..] => { } } - match [5i, 5, 5, 5] { + match [5, 5, 5, 5] { [a, ..] => { } } - match [5i, 5, 5, 5] { + match [5, 5, 5, 5] { [.., b] => { } } - match [5i, 5, 5, 5] { + match [5, 5, 5, 5] { [a, .., b] => { } } - match [5i, 5, 5] { + match [5, 5, 5] { [..] => { } } - match [5i, 5, 5] { + match [5, 5, 5] { [a, ..] => { } } - match [5i, 5, 5] { + match [5, 5, 5] { [.., a] => { } } - match [5i, 5, 5] { + match [5, 5, 5] { [a, .., b] => { } } } diff --git a/src/test/run-pass/import-glob-crate.rs b/src/test/run-pass/import-glob-crate.rs index 24d90741bbc..f7874cc56fc 100644 --- a/src/test/run-pass/import-glob-crate.rs +++ b/src/test/run-pass/import-glob-crate.rs @@ -14,7 +14,7 @@ use std::mem::*; pub fn main() { assert_eq!(size_of::(), 1); - let (mut x, mut y) = (1i, 2i); + let (mut x, mut y) = (1, 2); swap(&mut x, &mut y); assert_eq!(x, 2); assert_eq!(y, 1); diff --git a/src/test/run-pass/import-in-block.rs b/src/test/run-pass/import-in-block.rs index 3c28354dedc..4567651e892 100644 --- a/src/test/run-pass/import-in-block.rs +++ b/src/test/run-pass/import-in-block.rs @@ -10,11 +10,11 @@ pub fn main() { use std::mem::replace; - let mut x = 5i; + let mut x = 5; replace(&mut x, 6); { use std::mem::*; - let mut y = 6i; + let mut y = 6; swap(&mut x, &mut y); } } diff --git a/src/test/run-pass/import4.rs b/src/test/run-pass/import4.rs index 0639d732089..44f6b6140fb 100644 --- a/src/test/run-pass/import4.rs +++ b/src/test/run-pass/import4.rs @@ -16,4 +16,4 @@ mod zed { pub fn bar() { println!("bar"); } } -pub fn main() { let _zed = 42i; bar(); } +pub fn main() { let _zed = 42; bar(); } diff --git a/src/test/run-pass/inferred-suffix-in-pattern-range.rs b/src/test/run-pass/inferred-suffix-in-pattern-range.rs index a104ee6baaa..be561dfffa6 100644 --- a/src/test/run-pass/inferred-suffix-in-pattern-range.rs +++ b/src/test/run-pass/inferred-suffix-in-pattern-range.rs @@ -9,14 +9,14 @@ // except according to those terms. pub fn main() { - let x = 2i; + let x = 2; let x_message = match x { 0 ... 1 => { "not many".to_string() } _ => { "lots".to_string() } }; assert_eq!(x_message, "lots".to_string()); - let y = 2i; + let y = 2; let y_message = match y { 0 ... 1 => { "not many".to_string() } _ => { "lots".to_string() } diff --git a/src/test/run-pass/init-res-into-things.rs b/src/test/run-pass/init-res-into-things.rs index eeae3f35cfc..ee793359fbc 100644 --- a/src/test/run-pass/init-res-into-things.rs +++ b/src/test/run-pass/init-res-into-things.rs @@ -37,7 +37,7 @@ fn r(i: &Cell) -> r { } fn test_rec() { - let i = &Cell::new(0i); + let i = &Cell::new(0); { let _a = BoxR {x: r(i)}; } @@ -49,7 +49,7 @@ fn test_tag() { t0(r<'a>), } - let i = &Cell::new(0i); + let i = &Cell::new(0); { let _a = t::t0(r(i)); } @@ -57,15 +57,15 @@ fn test_tag() { } fn test_tup() { - let i = &Cell::new(0i); + let i = &Cell::new(0); { - let _a = (r(i), 0i); + let _a = (r(i), 0); } assert_eq!(i.get(), 1); } fn test_unique() { - let i = &Cell::new(0i); + let i = &Cell::new(0); { let _a = box r(i); } @@ -73,7 +73,7 @@ fn test_unique() { } fn test_unique_rec() { - let i = &Cell::new(0i); + let i = &Cell::new(0); { let _a = box BoxR { x: r(i) diff --git a/src/test/run-pass/intrinsic-atomics.rs b/src/test/run-pass/intrinsic-atomics.rs index 0644fbbc99f..d3f62f9d04a 100644 --- a/src/test/run-pass/intrinsic-atomics.rs +++ b/src/test/run-pass/intrinsic-atomics.rs @@ -40,7 +40,7 @@ mod rusti { pub fn main() { unsafe { - let mut x = box 1i; + let mut x = box 1; assert_eq!(rusti::atomic_load(&*x), 1); *x = 5; diff --git a/src/test/run-pass/intrinsic-move-val.rs b/src/test/run-pass/intrinsic-move-val.rs index fb04f67e380..0daf661c2f6 100644 --- a/src/test/run-pass/intrinsic-move-val.rs +++ b/src/test/run-pass/intrinsic-move-val.rs @@ -23,7 +23,7 @@ mod rusti { pub fn main() { unsafe { - let x = box 1i; + let x = box 1; let mut y = rusti::init(); let mut z: *const uint = transmute(&x); rusti::move_val_init(&mut y, x); diff --git a/src/test/run-pass/issue-10626.rs b/src/test/run-pass/issue-10626.rs index 880a8b4d2e0..79a0a54f834 100644 --- a/src/test/run-pass/issue-10626.rs +++ b/src/test/run-pass/issue-10626.rs @@ -19,10 +19,10 @@ pub fn main () { let args = os::args(); let args = args.as_slice(); if args.len() > 1 && args[1].as_slice() == "child" { - for _ in 0i..1000i { + for _ in 0..1000 { println!("hello?"); } - for _ in 0i..1000i { + for _ in 0..1000 { println!("hello?"); } return; diff --git a/src/test/run-pass/issue-10638.rs b/src/test/run-pass/issue-10638.rs index a4ef77df311..bc77b4c5343 100644 --- a/src/test/run-pass/issue-10638.rs +++ b/src/test/run-pass/issue-10638.rs @@ -13,6 +13,6 @@ pub fn main() { ////////////////// still not a doc comment /////**** nope, me neither */ /*** And neither am I! */ - 5i; + 5; /*****! certainly not I */ } diff --git a/src/test/run-pass/issue-11205.rs b/src/test/run-pass/issue-11205.rs index 194208620a8..d7c6c1b1bb2 100644 --- a/src/test/run-pass/issue-11205.rs +++ b/src/test/run-pass/issue-11205.rs @@ -22,45 +22,45 @@ fn bar(_: [Box; 2]) {} fn bars(_: &[Box]) {} fn main() { - let x: [&Foo; 2] = [&1i, &2i]; + let x: [&Foo; 2] = [&1, &2]; foo(x); - foo([&1i, &2i]); + foo([&1, &2]); - let r = &1i; + let r = &1; let x: [&Foo; 2] = [r; 2]; foo(x); - foo([&1i; 2]); + foo([&1; 2]); - let x: &[&Foo] = &[&1i, &2i]; + let x: &[&Foo] = &[&1, &2]; foos(x); - foos(&[&1i, &2i]); + foos(&[&1, &2]); - let x: &[&Foo] = &[&1i, &2i]; - let r = &1i; + let x: &[&Foo] = &[&1, &2]; + let r = &1; foog(x, &[r]); - let x: [Box; 2] = [box 1i, box 2i]; + let x: [Box; 2] = [box 1, box 2]; bar(x); - bar([box 1i, box 2i]); + bar([box 1, box 2]); - let x: &[Box] = &[box 1i, box 2i]; + let x: &[Box] = &[box 1, box 2]; bars(x); - bars(&[box 1i, box 2i]); + bars(&[box 1, box 2]); - let x: &[Box] = &[box 1i, box 2i]; - foog(x, &[box 1i]); + let x: &[Box] = &[box 1, box 2]; + foog(x, &[box 1]); struct T<'a> { t: [&'a (Foo+'a); 2] } let _n = T { - t: [&1i, &2i] + t: [&1, &2] }; - let r = &1i; + let r = &1; let _n = T { t: [r; 2] }; - let x: [&Foo; 2] = [&1i, &2i]; + let x: [&Foo; 2] = [&1, &2]; let _n = T { t: x }; @@ -69,14 +69,14 @@ fn main() { t: &'b [&'b (Foo+'b)] } let _n = F { - t: &[&1i, &2i] + t: &[&1, &2] }; - let r = &1i; + let r = &1; let r: [&Foo; 2] = [r; 2]; let _n = F { t: &r }; - let x: [&Foo; 2] = [&1i, &2i]; + let x: [&Foo; 2] = [&1, &2]; let _n = F { t: &x }; @@ -85,9 +85,9 @@ fn main() { t: &'a [Box] } let _n = M { - t: &[box 1i, box 2i] + t: &[box 1, box 2] }; - let x: [Box; 2] = [box 1i, box 2i]; + let x: [Box; 2] = [box 1, box 2]; let _n = M { t: &x }; diff --git a/src/test/run-pass/issue-11225-1.rs b/src/test/run-pass/issue-11225-1.rs index 7d1c93fe9a4..a45d129ade2 100644 --- a/src/test/run-pass/issue-11225-1.rs +++ b/src/test/run-pass/issue-11225-1.rs @@ -13,5 +13,5 @@ extern crate "issue-11225-1" as foo; pub fn main() { - foo::foo(1i); + foo::foo(1); } diff --git a/src/test/run-pass/issue-11225-2.rs b/src/test/run-pass/issue-11225-2.rs index 7f36c38283b..f07957b30ec 100644 --- a/src/test/run-pass/issue-11225-2.rs +++ b/src/test/run-pass/issue-11225-2.rs @@ -13,5 +13,5 @@ extern crate "issue-11225-2" as foo; pub fn main() { - foo::foo(1i); + foo::foo(1); } diff --git a/src/test/run-pass/issue-11958.rs b/src/test/run-pass/issue-11958.rs index 13177880c5a..00613f35f17 100644 --- a/src/test/run-pass/issue-11958.rs +++ b/src/test/run-pass/issue-11958.rs @@ -19,6 +19,6 @@ use std::thunk::Thunk; pub fn main() { - let mut x = 1i; + let mut x = 1i32; let _thunk = Thunk::new(move|| { x = 2; }); } diff --git a/src/test/run-pass/issue-1257.rs b/src/test/run-pass/issue-1257.rs index ad3a050dde9..7d5bd9d6a74 100644 --- a/src/test/run-pass/issue-1257.rs +++ b/src/test/run-pass/issue-1257.rs @@ -10,7 +10,7 @@ pub fn main () { let mut line = "".to_string(); - let mut i = 0i; + let mut i = 0; while line != "exit".to_string() { line = if i == 9 { "exit".to_string() } else { "notexit".to_string() }; i += 1; diff --git a/src/test/run-pass/issue-12582.rs b/src/test/run-pass/issue-12582.rs index ab2abc094f4..4009d17139d 100644 --- a/src/test/run-pass/issue-12582.rs +++ b/src/test/run-pass/issue-12582.rs @@ -11,10 +11,10 @@ // ignore-lexer-test FIXME #15877 pub fn main() { - let x = 1i; - let y = 2i; + let x = 1; + let y = 2; - assert_eq!(3i, match (x, y) { + assert_eq!(3, match (x, y) { (1, 1) => 1, (2, 2) => 2, (1...2, 2) => 3, @@ -22,7 +22,7 @@ pub fn main() { }); // nested tuple - assert_eq!(3i, match ((x, y),) { + assert_eq!(3, match ((x, y),) { ((1, 1),) => 1, ((2, 2),) => 2, ((1...2, 2),) => 3, diff --git a/src/test/run-pass/issue-12744.rs b/src/test/run-pass/issue-12744.rs index ec929a9c792..2f7ba315aa1 100644 --- a/src/test/run-pass/issue-12744.rs +++ b/src/test/run-pass/issue-12744.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] fn main() { - fn test() -> Box { box 1i } + fn test() -> Box { box 1 } println!("{:?}", test()) } diff --git a/src/test/run-pass/issue-12909.rs b/src/test/run-pass/issue-12909.rs index dfdf979fcec..3075bae44fe 100644 --- a/src/test/run-pass/issue-12909.rs +++ b/src/test/run-pass/issue-12909.rs @@ -15,7 +15,7 @@ fn copy(&x: &T) -> T { } fn main() { - let arr = [(1i, 1u), (2, 2), (3, 3)]; + let arr = [(1, 1u), (2, 2), (3, 3)]; let v1: Vec<&_> = arr.iter().collect(); let v2: Vec<_> = arr.iter().map(copy).collect(); diff --git a/src/test/run-pass/issue-13027.rs b/src/test/run-pass/issue-13027.rs index 1f61da2f424..649cf63e84a 100644 --- a/src/test/run-pass/issue-13027.rs +++ b/src/test/run-pass/issue-13027.rs @@ -29,99 +29,99 @@ pub fn main() { } fn lit_shadow_range() { - assert_eq!(2i, match 1i { - 1 if false => 1i, + assert_eq!(2, match 1 { + 1 if false => 1, 1...2 => 2, _ => 3 }); - let x = 0i; - assert_eq!(2i, match x+1 { - 0 => 0i, + let x = 0; + assert_eq!(2, match x+1 { + 0 => 0, 1 if false => 1, 1...2 => 2, _ => 3 }); - assert_eq!(2i, match val() { - 1 if false => 1i, + assert_eq!(2, match val() { + 1 if false => 1, 1...2 => 2, _ => 3 }); - assert_eq!(2i, match CONST { - 0 => 0i, + assert_eq!(2, match CONST { + 0 => 0, 1 if false => 1, 1...2 => 2, _ => 3 }); // value is out of the range of second arm, should match wildcard pattern - assert_eq!(3i, match 3i { - 1 if false => 1i, + assert_eq!(3, match 3 { + 1 if false => 1, 1...2 => 2, _ => 3 }); } fn range_shadow_lit() { - assert_eq!(2i, match 1i { - 1...2 if false => 1i, + assert_eq!(2, match 1 { + 1...2 if false => 1, 1 => 2, _ => 3 }); - let x = 0i; - assert_eq!(2i, match x+1 { - 0 => 0i, + let x = 0; + assert_eq!(2, match x+1 { + 0 => 0, 1...2 if false => 1, 1 => 2, _ => 3 }); - assert_eq!(2i, match val() { - 1...2 if false => 1i, + assert_eq!(2, match val() { + 1...2 if false => 1, 1 => 2, _ => 3 }); - assert_eq!(2i, match CONST { - 0 => 0i, + assert_eq!(2, match CONST { + 0 => 0, 1...2 if false => 1, 1 => 2, _ => 3 }); // ditto - assert_eq!(3i, match 3i { - 1...2 if false => 1i, + assert_eq!(3, match 3 { + 1...2 if false => 1, 1 => 2, _ => 3 }); } fn range_shadow_range() { - assert_eq!(2i, match 1i { - 0...2 if false => 1i, + assert_eq!(2, match 1 { + 0...2 if false => 1, 1...3 => 2, _ => 3, }); - let x = 0i; - assert_eq!(2i, match x+1 { + let x = 0; + assert_eq!(2, match x+1 { 100 => 0, 0...2 if false => 1, 1...3 => 2, _ => 3, }); - assert_eq!(2i, match val() { + assert_eq!(2, match val() { 0...2 if false => 1, 1...3 => 2, _ => 3, }); - assert_eq!(2i, match CONST { + assert_eq!(2, match CONST { 100 => 0, 0...2 if false => 1, 1...3 => 2, @@ -129,16 +129,16 @@ fn range_shadow_range() { }); // ditto - assert_eq!(3i, match 5i { - 0...2 if false => 1i, + assert_eq!(3, match 5 { + 0...2 if false => 1, 1...3 => 2, _ => 3, }); } fn multi_pats_shadow_lit() { - assert_eq!(2i, match 1i { - 100 => 0i, + assert_eq!(2, match 1 { + 100 => 0, 0 | 1...10 if false => 1, 1 => 2, _ => 3, @@ -146,8 +146,8 @@ fn multi_pats_shadow_lit() { } fn multi_pats_shadow_range() { - assert_eq!(2i, match 1i { - 100 => 0i, + assert_eq!(2, match 1 { + 100 => 0, 0 | 1...10 if false => 1, 1...3 => 2, _ => 3, @@ -155,8 +155,8 @@ fn multi_pats_shadow_range() { } fn lit_shadow_multi_pats() { - assert_eq!(2i, match 1i { - 100 => 0i, + assert_eq!(2, match 1 { + 100 => 0, 1 if false => 1, 0 | 1...10 => 2, _ => 3, @@ -164,8 +164,8 @@ fn lit_shadow_multi_pats() { } fn range_shadow_multi_pats() { - assert_eq!(2i, match 1i { - 100 => 0i, + assert_eq!(2, match 1 { + 100 => 0, 1...3 if false => 1, 0 | 1...10 => 2, _ => 3, @@ -180,9 +180,9 @@ fn misc() { // which is a rare combination of vector patterns, multiple wild-card // patterns and guard functions. let r = match [Foo::Bar(0, false)].as_slice() { - [Foo::Bar(_, pred)] if pred => 1i, - [Foo::Bar(_, pred)] if !pred => 2i, - _ => 0i, + [Foo::Bar(_, pred)] if pred => 1, + [Foo::Bar(_, pred)] if !pred => 2, + _ => 0, }; - assert_eq!(2i, r); + assert_eq!(2, r); } diff --git a/src/test/run-pass/issue-13494.rs b/src/test/run-pass/issue-13494.rs index c10fd7328a1..5025d403468 100644 --- a/src/test/run-pass/issue-13494.rs +++ b/src/test/run-pass/issue-13494.rs @@ -24,7 +24,7 @@ fn main() { let (tx, rx) = channel(); let _t = Thread::spawn(move|| { helper(rx) }); let (snd, rcv) = channel::(); - for _ in 1i..100000i { + for _ in 1..100000 { snd.send(1i).unwrap(); let (tx2, rx2) = channel(); tx.send(tx2).unwrap(); diff --git a/src/test/run-pass/issue-13867.rs b/src/test/run-pass/issue-13867.rs index 00ff837b981..960884c4aa5 100644 --- a/src/test/run-pass/issue-13867.rs +++ b/src/test/run-pass/issue-13867.rs @@ -18,39 +18,39 @@ enum Foo { fn main() { let r = match (Foo::FooNullary, 'a') { - (Foo::FooUint(..), 'a'...'z') => 1i, - (Foo::FooNullary, 'x') => 2i, + (Foo::FooUint(..), 'a'...'z') => 1, + (Foo::FooNullary, 'x') => 2, _ => 0 }; assert_eq!(r, 0); let r = match (Foo::FooUint(0), 'a') { - (Foo::FooUint(1), 'a'...'z') => 1i, - (Foo::FooUint(..), 'x') => 2i, - (Foo::FooNullary, 'a') => 3i, + (Foo::FooUint(1), 'a'...'z') => 1, + (Foo::FooUint(..), 'x') => 2, + (Foo::FooNullary, 'a') => 3, _ => 0 }; assert_eq!(r, 0); let r = match ('a', Foo::FooUint(0)) { - ('a'...'z', Foo::FooUint(1)) => 1i, - ('x', Foo::FooUint(..)) => 2i, - ('a', Foo::FooNullary) => 3i, + ('a'...'z', Foo::FooUint(1)) => 1, + ('x', Foo::FooUint(..)) => 2, + ('a', Foo::FooNullary) => 3, _ => 0 }; assert_eq!(r, 0); let r = match ('a', 'a') { - ('a'...'z', 'b') => 1i, - ('x', 'a'...'z') => 2i, + ('a'...'z', 'b') => 1, + ('x', 'a'...'z') => 2, _ => 0 }; assert_eq!(r, 0); let r = match ('a', 'a') { - ('a'...'z', 'b') => 1i, - ('x', 'a'...'z') => 2i, - ('a', 'a') => 3i, + ('a'...'z', 'b') => 1, + ('x', 'a'...'z') => 2, + ('a', 'a') => 3, _ => 0 }; assert_eq!(r, 3); diff --git a/src/test/run-pass/issue-14308.rs b/src/test/run-pass/issue-14308.rs index 82a1a16ba57..0e4b4a2c9cf 100644 --- a/src/test/run-pass/issue-14308.rs +++ b/src/test/run-pass/issue-14308.rs @@ -13,12 +13,12 @@ struct B; fn main() { let x = match A(3) { - A(..) => 1i + A(..) => 1 }; assert_eq!(x, 1); let x = match A(4) { - A(1) => 1i, - A(..) => 2i + A(1) => 1, + A(..) => 2 }; assert_eq!(x, 2); @@ -26,7 +26,7 @@ fn main() { // There's no particularly good reason to support this, but it's currently allowed, // and this makes sure it doesn't ICE or break LLVM. let x = match B { - B(..) => 3i + B(..) => 3 }; assert_eq!(x, 3); } diff --git a/src/test/run-pass/issue-1460.rs b/src/test/run-pass/issue-1460.rs index 2091a5437c2..e7516639db0 100644 --- a/src/test/run-pass/issue-1460.rs +++ b/src/test/run-pass/issue-1460.rs @@ -10,5 +10,5 @@ pub fn main() { - {|&: i| if 1i == i { }}; + {|&: i| if 1 == i { }}; } diff --git a/src/test/run-pass/issue-14865.rs b/src/test/run-pass/issue-14865.rs index 53af0c8635c..c322346c2a6 100644 --- a/src/test/run-pass/issue-14865.rs +++ b/src/test/run-pass/issue-14865.rs @@ -15,14 +15,14 @@ enum X { fn main() { let x = match X::Foo(42) { - X::Foo(..) => 1i, + X::Foo(..) => 1, _ if true => 0, X::Bar(..) => panic!("Oh dear") }; assert_eq!(x, 1); let x = match X::Foo(42) { - _ if true => 0i, + _ if true => 0, X::Foo(..) => 1, X::Bar(..) => panic!("Oh dear") }; diff --git a/src/test/run-pass/issue-15080.rs b/src/test/run-pass/issue-15080.rs index 76b8463a417..9752b01e52b 100644 --- a/src/test/run-pass/issue-15080.rs +++ b/src/test/run-pass/issue-15080.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - let mut x: &[_] = &[1i, 2, 3, 4]; + let mut x: &[_] = &[1, 2, 3, 4]; let mut result = vec!(); loop { diff --git a/src/test/run-pass/issue-15221.rs b/src/test/run-pass/issue-15221.rs index e3c102e01ec..49e5b14aff8 100644 --- a/src/test/run-pass/issue-15221.rs +++ b/src/test/run-pass/issue-15221.rs @@ -17,7 +17,7 @@ macro_rules! outer { } fn main() { - let outer!(g1) = 13i; + let outer!(g1) = 13; g1; } diff --git a/src/test/run-pass/issue-15571.rs b/src/test/run-pass/issue-15571.rs index 6b273b5786a..7d53b672951 100644 --- a/src/test/run-pass/issue-15571.rs +++ b/src/test/run-pass/issue-15571.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] fn match_on_local() { - let mut foo = Some(box 5i); + let mut foo = Some(box 5); match foo { None => {}, Some(x) => { @@ -22,7 +22,7 @@ fn match_on_local() { println!("'{}'", foo.unwrap()); } -fn match_on_arg(mut foo: Option>) { +fn match_on_arg(mut foo: Option>) { match foo { None => {} Some(x) => { @@ -33,7 +33,7 @@ fn match_on_arg(mut foo: Option>) { } fn match_on_binding() { - match Some(box 7i) { + match Some(box 7) { mut foo => { match foo { None => {}, @@ -47,7 +47,7 @@ fn match_on_binding() { } fn match_on_upvar() { - let mut foo = Some(box 8i); + let mut foo = Some(box 8i32); let f = move|:| { match foo { None => {}, @@ -62,7 +62,7 @@ fn match_on_upvar() { fn main() { match_on_local(); - match_on_arg(Some(box 6i)); + match_on_arg(Some(box 6)); match_on_binding(); match_on_upvar(); } diff --git a/src/test/run-pass/issue-15763.rs b/src/test/run-pass/issue-15763.rs index f30991a1963..7bfd8e0ab71 100644 --- a/src/test/run-pass/issue-15763.rs +++ b/src/test/run-pass/issue-15763.rs @@ -87,12 +87,12 @@ fn main() { assert_eq!(cc().unwrap(), 3); assert_eq!(dd().unwrap(), 3); - let i = box 32i as Box; + let i = box 32 as Box; assert_eq!(i.aaa(), 3); - let i = box 32i as Box; + let i = box 32 as Box; assert_eq!(i.bbb(), 3); - let i = box 32i as Box; + let i = box 32 as Box; assert_eq!(i.ccc().unwrap(), 3); - let i = box 32i as Box; + let i = box 32 as Box; assert_eq!(i.ddd().unwrap(), 3); } diff --git a/src/test/run-pass/issue-15924.rs b/src/test/run-pass/issue-15924.rs index db9f1cc9df7..88b250af1c0 100644 --- a/src/test/run-pass/issue-15924.rs +++ b/src/test/run-pass/issue-15924.rs @@ -28,5 +28,5 @@ impl Drop for Foo { } fn main() { - let _ = Foo { v: 10i }; + let _ = Foo { v: 10 }; } diff --git a/src/test/run-pass/issue-16648.rs b/src/test/run-pass/issue-16648.rs index 7ddb20811a3..0b58df56b6f 100644 --- a/src/test/run-pass/issue-16648.rs +++ b/src/test/run-pass/issue-16648.rs @@ -9,12 +9,12 @@ // except according to those terms. fn main() { - let x: (int, &[int]) = (2i, &[1i, 2i]); + let x: (int, &[int]) = (2, &[1, 2]); assert_eq!(match x { (0, [_, _]) => 0, (1, _) => 1, (2, [_, _]) => 2, (2, _) => 3, _ => 4 - }, 2i); + }, 2); } diff --git a/src/test/run-pass/issue-16774.rs b/src/test/run-pass/issue-16774.rs index 175e2188811..d426f82f89f 100644 --- a/src/test/run-pass/issue-16774.rs +++ b/src/test/run-pass/issue-16774.rs @@ -45,7 +45,7 @@ impl DerefMut for X { fn main() { { - let mut test = X(box 5i); + let mut test = X(box 5); { let mut change = |&mut:| { *test = 10 }; change(); diff --git a/src/test/run-pass/issue-17074.rs b/src/test/run-pass/issue-17074.rs index d35c3a587c5..d367e0e908e 100644 --- a/src/test/run-pass/issue-17074.rs +++ b/src/test/run-pass/issue-17074.rs @@ -17,6 +17,6 @@ fn main() { assert_eq!(match 1 { X => unreachable!(), Y => unreachable!(), - _ => 1i + _ => 1 }, 1); } diff --git a/src/test/run-pass/issue-19244.rs b/src/test/run-pass/issue-19244.rs index 3ee5ce9bff9..9af4d30c4f6 100644 --- a/src/test/run-pass/issue-19244.rs +++ b/src/test/run-pass/issue-19244.rs @@ -13,8 +13,8 @@ const STRUCT: MyStruct = MyStruct { field: 42 }; const TUP: (uint,) = (43,); fn main() { - let a = [0i; STRUCT.field]; - let b = [0i; TUP.0]; + let a = [0; STRUCT.field]; + let b = [0; TUP.0]; assert!(a.len() == 42); assert!(b.len() == 43); diff --git a/src/test/run-pass/issue-19358.rs b/src/test/run-pass/issue-19358.rs index 37d05453914..ff657376ecc 100644 --- a/src/test/run-pass/issue-19358.rs +++ b/src/test/run-pass/issue-19358.rs @@ -23,7 +23,7 @@ struct Bar where T: Trait { impl Trait for int {} fn main() { - let a = Foo { foo: 12i }; - let b = Bar { bar: 12i }; + let a = Foo { foo: 12 }; + let b = Bar { bar: 12 }; println!("{:?} {:?}", a, b); } diff --git a/src/test/run-pass/issue-19367.rs b/src/test/run-pass/issue-19367.rs index 7db84d518ff..d5bb6ebb7de 100644 --- a/src/test/run-pass/issue-19367.rs +++ b/src/test/run-pass/issue-19367.rs @@ -16,7 +16,7 @@ struct S { // on field of struct or tuple which we reassign in the match body. fn main() { - let mut a = (0i, Some("right".to_string())); + let mut a = (0, Some("right".to_string())); let b = match a.1 { Some(v) => { a.1 = Some("wrong".to_string()); diff --git a/src/test/run-pass/issue-2216.rs b/src/test/run-pass/issue-2216.rs index 98e6e051343..c2f74a9d653 100644 --- a/src/test/run-pass/issue-2216.rs +++ b/src/test/run-pass/issue-2216.rs @@ -9,12 +9,12 @@ // except according to those terms. pub fn main() { - let mut x = 0i; + let mut x = 0; 'foo: loop { 'bar: loop { 'quux: loop { - if 1i == 2 { + if 1 == 2 { break 'foo; } else { diff --git a/src/test/run-pass/issue-2383.rs b/src/test/run-pass/issue-2383.rs index 94bff890820..b8136323df6 100644 --- a/src/test/run-pass/issue-2383.rs +++ b/src/test/run-pass/issue-2383.rs @@ -14,5 +14,5 @@ use std::collections::RingBuf; pub fn main() { let mut q = RingBuf::new(); - q.push_front(10i); + q.push_front(10); } diff --git a/src/test/run-pass/issue-2428.rs b/src/test/run-pass/issue-2428.rs index afa053de243..7ed26428be0 100644 --- a/src/test/run-pass/issue-2428.rs +++ b/src/test/run-pass/issue-2428.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let _foo = 100i; + let _foo = 100; const quux: int = 5; enum Stuff { diff --git a/src/test/run-pass/issue-2633-2.rs b/src/test/run-pass/issue-2633-2.rs index c146f8a7a9a..80e9ca47025 100644 --- a/src/test/run-pass/issue-2633-2.rs +++ b/src/test/run-pass/issue-2633-2.rs @@ -17,6 +17,6 @@ fn a_val(x: Box, y: Box) -> int { } pub fn main() { - let z = box 22i; + let z = box 22; a_val(z.clone(), z.clone()); } diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index 3e4cffe5dfa..7ca439a1a19 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -23,5 +23,5 @@ fn deadcode() { } pub fn main() { - let _ = perform_hax(box 42i); + let _ = perform_hax(box 42); } diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index cb376d0e439..962359537bf 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -23,5 +23,5 @@ fn deadcode() { } pub fn main() { - perform_hax(box 42i); + perform_hax(box 42); } diff --git a/src/test/run-pass/issue-2935.rs b/src/test/run-pass/issue-2935.rs index 295fd538de6..31599d0caad 100644 --- a/src/test/run-pass/issue-2935.rs +++ b/src/test/run-pass/issue-2935.rs @@ -24,9 +24,9 @@ impl it for t { } pub fn main() { - // let x = ({a: 4i} as it); - // let y = box ({a: 4i}); - // let z = box ({a: 4i} as it); + // let x = ({a: 4} as it); + // let y = box ({a: 4}); + // let z = box ({a: 4} as it); // let z = box ({a: true} as it); let z = box() (box true as Box); // x.f(); diff --git a/src/test/run-pass/issue-3091.rs b/src/test/run-pass/issue-3091.rs index 2e287e24e23..c4c2c2b7da8 100644 --- a/src/test/run-pass/issue-3091.rs +++ b/src/test/run-pass/issue-3091.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = 1i; - let y = 1i; + let x = 1; + let y = 1; assert_eq!(&x, &y); } diff --git a/src/test/run-pass/issue-3211.rs b/src/test/run-pass/issue-3211.rs index c908c073d4f..28c9bf1e83a 100644 --- a/src/test/run-pass/issue-3211.rs +++ b/src/test/run-pass/issue-3211.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let mut x = 0i; - for _ in 0i..4096 { x += 1; } + let mut x = 0; + for _ in 0..4096 { x += 1; } assert_eq!(x, 4096); println!("x = {}", x); } diff --git a/src/test/run-pass/issue-3290.rs b/src/test/run-pass/issue-3290.rs index a72b272abaa..c8d6e69801f 100644 --- a/src/test/run-pass/issue-3290.rs +++ b/src/test/run-pass/issue-3290.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut x = box 3i; + let mut x = box 3; x = x; assert_eq!(*x, 3); } diff --git a/src/test/run-pass/issue-333.rs b/src/test/run-pass/issue-333.rs index ef49d0a170f..1217f32826f 100644 --- a/src/test/run-pass/issue-333.rs +++ b/src/test/run-pass/issue-333.rs @@ -12,4 +12,4 @@ fn quux(x: T) -> T { let f = id::; return f(x); } fn id(x: T) -> T { return x; } -pub fn main() { assert!((quux(10i) == 10i)); } +pub fn main() { assert!((quux(10) == 10)); } diff --git a/src/test/run-pass/issue-3500.rs b/src/test/run-pass/issue-3500.rs index eb422c9a8b9..99def5476f9 100644 --- a/src/test/run-pass/issue-3500.rs +++ b/src/test/run-pass/issue-3500.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = &Some(1i); + let x = &Some(1); match x { &Some(_) => (), &None => (), diff --git a/src/test/run-pass/issue-3559.rs b/src/test/run-pass/issue-3559.rs index 0118fce4ec3..69a148d4108 100644 --- a/src/test/run-pass/issue-3559.rs +++ b/src/test/run-pass/issue-3559.rs @@ -22,8 +22,8 @@ fn check_strs(actual: &str, expected: &str) -> bool { pub fn main() { let mut table = HashMap::new(); - table.insert("one".to_string(), 1i); - table.insert("two".to_string(), 2i); + table.insert("one".to_string(), 1); + table.insert("two".to_string(), 2); assert!(check_strs(format!("{:?}", table).as_slice(), "HashMap {\"one\": 1, \"two\": 2}") || check_strs(format!("{:?}", table).as_slice(), "HashMap {\"two\": 2, \"one\": 1}")); } diff --git a/src/test/run-pass/issue-3878.rs b/src/test/run-pass/issue-3878.rs index 5434e44c173..c1d19f228db 100644 --- a/src/test/run-pass/issue-3878.rs +++ b/src/test/run-pass/issue-3878.rs @@ -13,6 +13,6 @@ #![feature(box_syntax)] pub fn main() { - let y = box 1i; + let y = box 1; y; } diff --git a/src/test/run-pass/issue-4387.rs b/src/test/run-pass/issue-4387.rs index 43948ef4a45..02601ba2f2a 100644 --- a/src/test/run-pass/issue-4387.rs +++ b/src/test/run-pass/issue-4387.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn main() { - let _foo = [0i; 2*4]; + let _foo = [0; 2*4]; } diff --git a/src/test/run-pass/issue-4401.rs b/src/test/run-pass/issue-4401.rs index a03253b8efb..e4fea724c79 100644 --- a/src/test/run-pass/issue-4401.rs +++ b/src/test/run-pass/issue-4401.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let mut count = 0i; - for _ in 0i..999_999 { count += 1; } + let mut count = 0; + for _ in 0..999_999 { count += 1; } assert_eq!(count, 999_999); println!("{}", count); } diff --git a/src/test/run-pass/issue-5708.rs b/src/test/run-pass/issue-5708.rs index 61ae273aef5..fd39bcc6b61 100644 --- a/src/test/run-pass/issue-5708.rs +++ b/src/test/run-pass/issue-5708.rs @@ -41,7 +41,7 @@ impl<'a> Outer<'a> { } pub fn main() { - let inner = 5i; + let inner = 5; let outer = Outer::new(&inner as &Inner); outer.inner.print(); } diff --git a/src/test/run-pass/issue-6117.rs b/src/test/run-pass/issue-6117.rs index 85de03dfe34..93edffdcb47 100644 --- a/src/test/run-pass/issue-6117.rs +++ b/src/test/run-pass/issue-6117.rs @@ -14,7 +14,7 @@ enum Either { Left(T), Right(U) } pub fn main() { - match Either::Left(box 17i) { + match Either::Left(box 17) { Either::Right(()) => {} _ => {} } diff --git a/src/test/run-pass/issue-6318.rs b/src/test/run-pass/issue-6318.rs index b9f1a8bda7b..1d8fe8bfce8 100644 --- a/src/test/run-pass/issue-6318.rs +++ b/src/test/run-pass/issue-6318.rs @@ -23,7 +23,7 @@ impl Foo for Struct {} pub fn main() { match Thing::A(box Struct as Box) { - Thing::A(_a) => 0i, + Thing::A(_a) => 0, }; } diff --git a/src/test/run-pass/issue-7178.rs b/src/test/run-pass/issue-7178.rs index 4acb4959724..6ef740b2a50 100644 --- a/src/test/run-pass/issue-7178.rs +++ b/src/test/run-pass/issue-7178.rs @@ -13,5 +13,5 @@ extern crate "issue-7178" as cross_crate_self; pub fn main() { - let _ = cross_crate_self::Foo::new(&1i); + let _ = cross_crate_self::Foo::new(&1); } diff --git a/src/test/run-pass/issue-7575.rs b/src/test/run-pass/issue-7575.rs index d60e5caee68..225213db6a4 100644 --- a/src/test/run-pass/issue-7575.rs +++ b/src/test/run-pass/issue-7575.rs @@ -20,5 +20,5 @@ impl Bar for int {} impl Foo for int {} fn main() { - assert!(1i.new()); + assert!(1.new()); } diff --git a/src/test/run-pass/issue-7784.rs b/src/test/run-pass/issue-7784.rs index 882ca00f1df..a61ee8c2a0b 100644 --- a/src/test/run-pass/issue-7784.rs +++ b/src/test/run-pass/issue-7784.rs @@ -20,7 +20,7 @@ fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] { } fn main() { - assert_eq!(foo([1i, 2i, 3i]), (1i, 3i, 6i)); + assert_eq!(foo([1, 2, 3]), (1, 3, 6)); let [a, b, c, d] = bar("foo", "bar"); assert_eq!(a, "foo"); diff --git a/src/test/run-pass/issue-8044.rs b/src/test/run-pass/issue-8044.rs index c50cf845d00..504441e3ba9 100644 --- a/src/test/run-pass/issue-8044.rs +++ b/src/test/run-pass/issue-8044.rs @@ -14,5 +14,5 @@ extern crate "issue-8044" as minimal; use minimal::{BTree, leaf}; pub fn main() { - BTree:: { node: leaf(1i) }; + BTree:: { node: leaf(1) }; } diff --git a/src/test/run-pass/issue-8391.rs b/src/test/run-pass/issue-8391.rs index 468e6563182..86c9b8c6964 100644 --- a/src/test/run-pass/issue-8391.rs +++ b/src/test/run-pass/issue-8391.rs @@ -9,9 +9,9 @@ // except according to those terms. fn main() { - let x = match Some(1i) { - ref _y @ Some(_) => 1i, - None => 2i, + let x = match Some(1) { + ref _y @ Some(_) => 1, + None => 2, }; assert_eq!(x, 1); } diff --git a/src/test/run-pass/issue-8460.rs b/src/test/run-pass/issue-8460.rs index 3ea6d5d4f2f..3944895460f 100644 --- a/src/test/run-pass/issue-8460.rs +++ b/src/test/run-pass/issue-8460.rs @@ -17,7 +17,7 @@ fn main() { assert!(Thread::scoped(move|| i16::MIN / -1).join().is_err()); assert!(Thread::scoped(move|| i32::MIN / -1).join().is_err()); assert!(Thread::scoped(move|| i64::MIN / -1).join().is_err()); - assert!(Thread::scoped(move|| 1i / 0).join().is_err()); + assert!(Thread::scoped(move|| 1 / 0).join().is_err()); assert!(Thread::scoped(move|| 1i8 / 0).join().is_err()); assert!(Thread::scoped(move|| 1i16 / 0).join().is_err()); assert!(Thread::scoped(move|| 1i32 / 0).join().is_err()); @@ -27,7 +27,7 @@ fn main() { assert!(Thread::scoped(move|| i16::MIN % -1).join().is_err()); assert!(Thread::scoped(move|| i32::MIN % -1).join().is_err()); assert!(Thread::scoped(move|| i64::MIN % -1).join().is_err()); - assert!(Thread::scoped(move|| 1i % 0).join().is_err()); + assert!(Thread::scoped(move|| 1 % 0).join().is_err()); assert!(Thread::scoped(move|| 1i8 % 0).join().is_err()); assert!(Thread::scoped(move|| 1i16 % 0).join().is_err()); assert!(Thread::scoped(move|| 1i32 % 0).join().is_err()); diff --git a/src/test/run-pass/issue-8498.rs b/src/test/run-pass/issue-8498.rs index 2a2ca4f0712..494b6217855 100644 --- a/src/test/run-pass/issue-8498.rs +++ b/src/test/run-pass/issue-8498.rs @@ -12,14 +12,14 @@ #![feature(box_syntax)] pub fn main() { - match &[(box 5i,box 7i)] { + match &[(box 5,box 7)] { ps => { let (ref y, _) = ps[0]; assert!(**y == 5); } } - match Some(&[(box 5i,)]) { + match Some(&[(box 5,)]) { Some(ps) => { let (ref y,) = ps[0]; assert!(**y == 5); @@ -27,7 +27,7 @@ pub fn main() { None => () } - match Some(&[(box 5i,box 7i)]) { + match Some(&[(box 5,box 7)]) { Some(ps) => { let (ref y, ref z) = ps[0]; assert!(**y == 5); diff --git a/src/test/run-pass/issue-868.rs b/src/test/run-pass/issue-868.rs index 72bdd1af746..b2ccc092358 100644 --- a/src/test/run-pass/issue-868.rs +++ b/src/test/run-pass/issue-868.rs @@ -11,7 +11,7 @@ fn f(g: F) -> T where F: FnOnce() -> T { g() } pub fn main() { - let _x = f( | | { 10i }); + let _x = f( | | { 10 }); // used to be: cannot determine a type for this expression f(| | { }); // ditto diff --git a/src/test/run-pass/issue-8827.rs b/src/test/run-pass/issue-8827.rs index 80beeb7275c..d7a86749546 100644 --- a/src/test/run-pass/issue-8827.rs +++ b/src/test/run-pass/issue-8827.rs @@ -49,7 +49,7 @@ fn main() { let ints = integers(); let threes = periodical(3); let fives = periodical(5); - for _ in 1i..100i { + for _ in 1..100 { match (ints.recv().unwrap(), threes.recv().unwrap(), fives.recv().unwrap()) { (_, true, true) => println!("FizzBuzz"), (_, true, false) => println!("Fizz"), diff --git a/src/test/run-pass/issue-8860.rs b/src/test/run-pass/issue-8860.rs index 35f713c4c2c..72e2a33b43e 100644 --- a/src/test/run-pass/issue-8860.rs +++ b/src/test/run-pass/issue-8860.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -static mut DROP: int = 0i; -static mut DROP_S: int = 0i; -static mut DROP_T: int = 0i; +static mut DROP: int = 0; +static mut DROP_S: int = 0; +static mut DROP_T: int = 0; struct S; impl Drop for S { diff --git a/src/test/run-pass/issue-9719.rs b/src/test/run-pass/issue-9719.rs index 4c6b9a3aaa0..8fc86eb49e7 100644 --- a/src/test/run-pass/issue-9719.rs +++ b/src/test/run-pass/issue-9719.rs @@ -17,7 +17,7 @@ mod a { impl X for int {} pub struct Z<'a>(Enum<&'a (X+'a)>); - fn foo() { let x = 42i; let z = Z(Enum::A(&x as &X)); let _ = z; } + fn foo() { let x = 42; let z = Z(Enum::A(&x as &X)); let _ = z; } } mod b { @@ -28,7 +28,7 @@ mod b { } fn bar() { - let x = 42i; + let x = 42; let _y = Y { x: Some(&x as &X) }; } } @@ -37,7 +37,7 @@ mod c { pub trait X { fn f(&self); } impl X for int { fn f(&self) {} } pub struct Z<'a>(Option<&'a (X+'a)>); - fn main() { let x = 42i; let z = Z(Some(&x as &X)); let _ = z; } + fn main() { let x = 42; let z = Z(Some(&x as &X)); let _ = z; } } pub fn main() {} diff --git a/src/test/run-pass/issue-9906.rs b/src/test/run-pass/issue-9906.rs index d8e28e449ee..921965b280b 100644 --- a/src/test/run-pass/issue-9906.rs +++ b/src/test/run-pass/issue-9906.rs @@ -14,5 +14,5 @@ extern crate "issue-9906" as testmod; pub fn main() { testmod::foo(); - testmod::FooBar::new(1i); + testmod::FooBar::new(1); } diff --git a/src/test/run-pass/issue-9942.rs b/src/test/run-pass/issue-9942.rs index 321e22cd19c..c7dea719986 100644 --- a/src/test/run-pass/issue-9942.rs +++ b/src/test/run-pass/issue-9942.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn main() { - const S: uint = 23 as uint; [0i; S]; () + const S: uint = 23 as uint; [0; S]; () } diff --git a/src/test/run-pass/keyword-changes-2012-07-31.rs b/src/test/run-pass/keyword-changes-2012-07-31.rs index 885f266ca3d..ff568b77f08 100644 --- a/src/test/run-pass/keyword-changes-2012-07-31.rs +++ b/src/test/run-pass/keyword-changes-2012-07-31.rs @@ -19,7 +19,7 @@ mod foo { } fn bar() -> int { - match 0i { - _ => { 0i } + match 0 { + _ => { 0 } } } diff --git a/src/test/run-pass/kindck-owned-trait-contains-1.rs b/src/test/run-pass/kindck-owned-trait-contains-1.rs index 999fb2c4b69..f05ac11d413 100644 --- a/src/test/run-pass/kindck-owned-trait-contains-1.rs +++ b/src/test/run-pass/kindck-owned-trait-contains-1.rs @@ -24,7 +24,7 @@ fn repeater(v: Box) -> Box+'static> { } pub fn main() { - let x = 3i; + let x = 3; let y = repeater(box x); assert_eq!(x, y.get()); } diff --git a/src/test/run-pass/labeled-break.rs b/src/test/run-pass/labeled-break.rs index ebfe1e353d8..30c2495d590 100644 --- a/src/test/run-pass/labeled-break.rs +++ b/src/test/run-pass/labeled-break.rs @@ -15,13 +15,13 @@ pub fn main() { } } - 'bar: for _ in 0i..100i { + 'bar: for _ in 0..100 { loop { break 'bar; } } - 'foobar: while 1i + 1 == 2 { + 'foobar: while 1 + 1 == 2 { loop { break 'foobar; } diff --git a/src/test/run-pass/last-use-in-cap-clause.rs b/src/test/run-pass/last-use-in-cap-clause.rs index 9be9f098264..0cdd4d3889c 100644 --- a/src/test/run-pass/last-use-in-cap-clause.rs +++ b/src/test/run-pass/last-use-in-cap-clause.rs @@ -17,7 +17,7 @@ struct A { a: Box } fn foo() -> Box int + 'static> { - let k = box 22i; + let k = box 22; let _u = A {a: k.clone()}; let result = |&mut:| 22; box result diff --git a/src/test/run-pass/last-use-is-capture.rs b/src/test/run-pass/last-use-is-capture.rs index 4a7e844268f..19a780d180f 100644 --- a/src/test/run-pass/last-use-is-capture.rs +++ b/src/test/run-pass/last-use-is-capture.rs @@ -17,7 +17,7 @@ struct A { a: Box } pub fn main() { fn invoke(f: F) where F: FnOnce() { f(); } - let k = box 22i; + let k = box 22; let _u = A {a: k.clone()}; invoke(|| println!("{}", k.clone()) ) } diff --git a/src/test/run-pass/lazy-and-or.rs b/src/test/run-pass/lazy-and-or.rs index 043961ce599..559c9e78945 100644 --- a/src/test/run-pass/lazy-and-or.rs +++ b/src/test/run-pass/lazy-and-or.rs @@ -11,7 +11,7 @@ fn incr(x: &mut int) -> bool { *x += 1; assert!((false)); return false; } pub fn main() { - let x = 1i == 2 || 3i == 3; + let x = 1 == 2 || 3 == 3; assert!((x)); let mut y: int = 10; println!("{}", x || incr(&mut y)); diff --git a/src/test/run-pass/lazy-init.rs b/src/test/run-pass/lazy-init.rs index cd8be550d51..60f7689ecfa 100644 --- a/src/test/run-pass/lazy-init.rs +++ b/src/test/run-pass/lazy-init.rs @@ -12,4 +12,4 @@ fn foo(x: int) { println!("{}", x); } -pub fn main() { let mut x: int; if 1i > 2 { x = 12; } else { x = 10; } foo(x); } +pub fn main() { let mut x: int; if 1 > 2 { x = 12; } else { x = 10; } foo(x); } diff --git a/src/test/run-pass/let-var-hygiene.rs b/src/test/run-pass/let-var-hygiene.rs index 2287cc48b66..d6409267eb6 100644 --- a/src/test/run-pass/let-var-hygiene.rs +++ b/src/test/run-pass/let-var-hygiene.rs @@ -10,10 +10,10 @@ // shouldn't affect evaluation of $ex: macro_rules! bad_macro { - ($ex:expr) => ({let _x = 9i; $ex}) + ($ex:expr) => ({let _x = 9; $ex}) } pub fn main() { - let _x = 8i; - assert_eq!(bad_macro!(_x),8i) + let _x = 8; + assert_eq!(bad_macro!(_x),8) } diff --git a/src/test/run-pass/linear-for-loop.rs b/src/test/run-pass/linear-for-loop.rs index 6a2140d49cd..eda14222e91 100644 --- a/src/test/run-pass/linear-for-loop.rs +++ b/src/test/run-pass/linear-for-loop.rs @@ -11,8 +11,8 @@ // no-pretty-expanded FIXME #15189 pub fn main() { - let x = vec!(1i, 2i, 3i); - let mut y = 0i; + let x = vec!(1, 2, 3); + let mut y = 0; for i in x.iter() { println!("{}", *i); y += *i; } println!("{}", y); assert_eq!(y, 6); diff --git a/src/test/run-pass/liveness-loop-break.rs b/src/test/run-pass/liveness-loop-break.rs index 6ad2be68e8f..0dba1830cbd 100644 --- a/src/test/run-pass/liveness-loop-break.rs +++ b/src/test/run-pass/liveness-loop-break.rs @@ -11,7 +11,7 @@ fn test() { let v; loop { - v = 3i; + v = 3; break; } println!("{}", v); diff --git a/src/test/run-pass/log-poly.rs b/src/test/run-pass/log-poly.rs index ce598c5d382..d8a69177caf 100644 --- a/src/test/run-pass/log-poly.rs +++ b/src/test/run-pass/log-poly.rs @@ -14,8 +14,8 @@ enum Numbers { } pub fn main() { - println!("{:?}", 1i); + println!("{:?}", 1); println!("{:?}", 2.0f64); println!("{:?}", Numbers::Three); - println!("{:?}", vec!(4i)); + println!("{:?}", vec!(4)); } diff --git a/src/test/run-pass/long-while.rs b/src/test/run-pass/long-while.rs index 7d30b22867c..cbe26844708 100644 --- a/src/test/run-pass/long-while.rs +++ b/src/test/run-pass/long-while.rs @@ -14,6 +14,6 @@ pub fn main() { let mut i: int = 0; while i < 1000000 { i += 1; - let x = 3i; + let x = 3; } } diff --git a/src/test/run-pass/loop-diverges.rs b/src/test/run-pass/loop-diverges.rs index 4fe73188b45..9c46ba2cb9b 100644 --- a/src/test/run-pass/loop-diverges.rs +++ b/src/test/run-pass/loop-diverges.rs @@ -16,5 +16,5 @@ fn forever() -> ! { } pub fn main() { - if (1i == 2) { forever(); } + if (1 == 2) { forever(); } } diff --git a/src/test/run-pass/loop-label-shadowing.rs b/src/test/run-pass/loop-label-shadowing.rs index 46d4fa460fe..cfe51fe7758 100644 --- a/src/test/run-pass/loop-label-shadowing.rs +++ b/src/test/run-pass/loop-label-shadowing.rs @@ -12,7 +12,7 @@ fn main() { let mut foo = Vec::new(); - 'foo: for i in [1i, 2, 3].iter() { + 'foo: for i in [1, 2, 3].iter() { foo.push(i); } } diff --git a/src/test/run-pass/loop-no-reinit-needed-post-bot.rs b/src/test/run-pass/loop-no-reinit-needed-post-bot.rs index 0f4dd881698..2582c2e6147 100644 --- a/src/test/run-pass/loop-no-reinit-needed-post-bot.rs +++ b/src/test/run-pass/loop-no-reinit-needed-post-bot.rs @@ -17,7 +17,7 @@ fn my_panic() -> ! { loop {} } pub fn step(f: bool) { let mut g = S; - let mut i = 0i; + let mut i = 0; loop { if i > 10 { break; } else { i += 1; } diff --git a/src/test/run-pass/loop-scope.rs b/src/test/run-pass/loop-scope.rs index 4b8ccad068c..1dc3700194c 100644 --- a/src/test/run-pass/loop-scope.rs +++ b/src/test/run-pass/loop-scope.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - let x = vec!(10i, 20i, 30i); - let mut sum = 0i; + let x = vec!(10, 20, 30); + let mut sum = 0; for x in x.iter() { sum += *x; } assert_eq!(sum, 60); } diff --git a/src/test/run-pass/macro-crate-def-only.rs b/src/test/run-pass/macro-crate-def-only.rs index 7505fa6e684..efee9ba963a 100644 --- a/src/test/run-pass/macro-crate-def-only.rs +++ b/src/test/run-pass/macro-crate-def-only.rs @@ -14,5 +14,5 @@ extern crate macro_crate_def_only; pub fn main() { - assert_eq!(5i, make_a_5!()); + assert_eq!(5, make_a_5!()); } diff --git a/src/test/run-pass/macro-export-inner-module.rs b/src/test/run-pass/macro-export-inner-module.rs index ef22410751c..1c7b2530b90 100644 --- a/src/test/run-pass/macro-export-inner-module.rs +++ b/src/test/run-pass/macro-export-inner-module.rs @@ -15,5 +15,5 @@ extern crate macro_export_inner_module; pub fn main() { - assert_eq!(1i, foo!()); + assert_eq!(1, foo!()); } diff --git a/src/test/run-pass/macro-pat.rs b/src/test/run-pass/macro-pat.rs index 07b75389cf4..30a74126b49 100644 --- a/src/test/run-pass/macro-pat.rs +++ b/src/test/run-pass/macro-pat.rs @@ -51,23 +51,23 @@ pub fn main() { assert_eq!(2u, f(Some('y'))); assert_eq!(3u, f(None)); - assert_eq!(1i, match Some('x') { - Some(char_x!()) => 1i, - _ => 2i, + assert_eq!(1, match Some('x') { + Some(char_x!()) => 1, + _ => 2, }); - assert_eq!(1i, match Some('x') { - some!(char_x!()) => 1i, - _ => 2i, + assert_eq!(1, match Some('x') { + some!(char_x!()) => 1, + _ => 2, }); - assert_eq!(1i, match Some('x') { - indirect!() => 1i, - _ => 2i, + assert_eq!(1, match Some('x') { + indirect!() => 1, + _ => 2, }); - assert_eq!(3i, { - let ident_pat!(x) = 2i; - x+1i + assert_eq!(3, { + let ident_pat!(x) = 2; + x+1 }); } diff --git a/src/test/run-pass/macro-stmt.rs b/src/test/run-pass/macro-stmt.rs index cb5370c8bcb..3aa02987098 100644 --- a/src/test/run-pass/macro-stmt.rs +++ b/src/test/run-pass/macro-stmt.rs @@ -26,17 +26,17 @@ pub fn main() { ) } - mylet!(y, 8i*2); - assert_eq!(y, 16i); + mylet!(y, 8*2); + assert_eq!(y, 16); myfn!(mult, (a,b), { a*b } ); assert_eq!(mult(2, add(4,4)), 16); macro_rules! actually_an_expr_macro { - () => ( 16i ) + () => ( 16 ) } - assert_eq!({ actually_an_expr_macro!() }, 16i); + assert_eq!({ actually_an_expr_macro!() }, 16); } diff --git a/src/test/run-pass/macro-with-attrs1.rs b/src/test/run-pass/macro-with-attrs1.rs index 3f9d07466cc..f180922a052 100644 --- a/src/test/run-pass/macro-with-attrs1.rs +++ b/src/test/run-pass/macro-with-attrs1.rs @@ -11,11 +11,11 @@ // compile-flags: --cfg foo #[cfg(foo)] -macro_rules! foo { () => (1i) } +macro_rules! foo { () => (1) } #[cfg(not(foo))] -macro_rules! foo { () => (2i) } +macro_rules! foo { () => (2) } pub fn main() { - assert_eq!(foo!(), 1i); + assert_eq!(foo!(), 1); } diff --git a/src/test/run-pass/macro-with-attrs2.rs b/src/test/run-pass/macro-with-attrs2.rs index f90a0dfa6b3..d683979462b 100644 --- a/src/test/run-pass/macro-with-attrs2.rs +++ b/src/test/run-pass/macro-with-attrs2.rs @@ -9,12 +9,12 @@ // except according to those terms. #[cfg(foo)] -macro_rules! foo { () => (1i) } +macro_rules! foo { () => (1) } #[cfg(not(foo))] -macro_rules! foo { () => (2i) } +macro_rules! foo { () => (2) } pub fn main() { - assert_eq!(foo!(), 2i); + assert_eq!(foo!(), 2); } diff --git a/src/test/run-pass/match-arm-statics.rs b/src/test/run-pass/match-arm-statics.rs index 1964bf4bd7d..dfefe84518c 100644 --- a/src/test/run-pass/match-arm-statics.rs +++ b/src/test/run-pass/match-arm-statics.rs @@ -84,7 +84,7 @@ fn issue_14576() { enum C { D = 3, E = 4 } const F : C = C::D; - assert_eq!(match C::D { F => 1i, _ => 2, }, 1); + assert_eq!(match C::D { F => 1, _ => 2, }, 1); } fn issue_13731() { @@ -113,14 +113,14 @@ fn issue_15393() { fn main() { assert_eq!(match (true, false) { - TRUE_TRUE => 1i, + TRUE_TRUE => 1, (false, false) => 2, (false, true) => 3, (true, false) => 4 }, 4); assert_eq!(match Some(Some(Direction::North)) { - Some(NONE) => 1i, + Some(NONE) => 1, Some(Some(Direction::North)) => 2, Some(Some(EAST)) => 3, Some(Some(Direction::South)) => 4, @@ -129,7 +129,7 @@ fn main() { }, 2); assert_eq!(match (Foo { bar: Some(Direction::West), baz: NewBool(true) }) { - Foo { bar: None, baz: NewBool(true) } => 1i, + Foo { bar: None, baz: NewBool(true) } => 1, Foo { bar: NONE, baz: NEW_FALSE } => 2, STATIC_FOO => 3, Foo { bar: _, baz: NEW_FALSE } => 4, @@ -140,7 +140,7 @@ fn main() { }, 5); assert_eq!(match (EnumWithStructVariants::Variant2 { dir: Direction::North }) { - EnumWithStructVariants::Variant1(true) => 1i, + EnumWithStructVariants::Variant1(true) => 1, EnumWithStructVariants::Variant1(false) => 2, EnumWithStructVariants::Variant2 { dir: Direction::West } => 3, VARIANT2_NORTH => 4, diff --git a/src/test/run-pass/match-bot-2.rs b/src/test/run-pass/match-bot-2.rs index 5b48d0ff508..949fad11344 100644 --- a/src/test/run-pass/match-bot-2.rs +++ b/src/test/run-pass/match-bot-2.rs @@ -9,5 +9,5 @@ // except according to those terms. // n.b. This was only ever failing with optimization disabled. -fn a() -> int { match return 1i { 2i => 3i, _ => panic!() } } +fn a() -> int { match return 1 { 2 => 3, _ => panic!() } } pub fn main() { a(); } diff --git a/src/test/run-pass/match-naked-record-expr.rs b/src/test/run-pass/match-naked-record-expr.rs index 170a3513a1a..433cf23626b 100644 --- a/src/test/run-pass/match-naked-record-expr.rs +++ b/src/test/run-pass/match-naked-record-expr.rs @@ -11,7 +11,7 @@ struct X { x: int } pub fn main() { - let _x = match 0i { + let _x = match 0 { _ => X { x: 0 }.x diff --git a/src/test/run-pass/match-naked-record.rs b/src/test/run-pass/match-naked-record.rs index 21c31b62183..fe12b7c1585 100644 --- a/src/test/run-pass/match-naked-record.rs +++ b/src/test/run-pass/match-naked-record.rs @@ -11,7 +11,7 @@ struct X { x: int } pub fn main() { - let _x = match 0i { + let _x = match 0 { _ => X { x: 0 } diff --git a/src/test/run-pass/match-pattern-bindings.rs b/src/test/run-pass/match-pattern-bindings.rs index e6ce94ec5d4..abb78fc8310 100644 --- a/src/test/run-pass/match-pattern-bindings.rs +++ b/src/test/run-pass/match-pattern-bindings.rs @@ -9,15 +9,15 @@ // except according to those terms. fn main() { - let value = Some(1i); + let value = Some(1); assert_eq!(match value { ref a @ Some(_) => a, ref b @ None => b - }, &Some(1i)); + }, &Some(1)); assert_eq!(match value { ref c @ Some(_) => c, ref b @ None => b - }, &Some(1i)); + }, &Some(1)); assert_eq!(match "foobarbaz" { b @ _ => b }, "foobarbaz"); diff --git a/src/test/run-pass/match-pipe-binding.rs b/src/test/run-pass/match-pipe-binding.rs index ed2f7c5cb47..bdf12d22edd 100644 --- a/src/test/run-pass/match-pipe-binding.rs +++ b/src/test/run-pass/match-pipe-binding.rs @@ -10,7 +10,7 @@ fn test1() { // from issue 6338 - match ((1i, "a".to_string()), (2i, "b".to_string())) { + match ((1, "a".to_string()), (2, "b".to_string())) { ((1, a), (2, b)) | ((2, b), (1, a)) => { assert_eq!(a, "a".to_string()); assert_eq!(b, "b".to_string()); @@ -20,7 +20,7 @@ fn test1() { } fn test2() { - match (1i, 2i, 3i) { + match (1, 2, 3) { (1, a, b) | (2, b, a) => { assert_eq!(a, 2); assert_eq!(b, 3); @@ -30,7 +30,7 @@ fn test2() { } fn test3() { - match (1i, 2i, 3i) { + match (1, 2, 3) { (1, ref a, ref b) | (2, ref b, ref a) => { assert_eq!(*a, 2); assert_eq!(*b, 3); @@ -40,7 +40,7 @@ fn test3() { } fn test4() { - match (1i, 2i, 3i) { + match (1, 2, 3) { (1, a, b) | (2, b, a) if a == 2 => { assert_eq!(a, 2); assert_eq!(b, 3); @@ -50,7 +50,7 @@ fn test4() { } fn test5() { - match (1i, 2i, 3i) { + match (1, 2, 3) { (1, ref a, ref b) | (2, ref b, ref a) if *a == 2 => { assert_eq!(*a, 2); assert_eq!(*b, 3); diff --git a/src/test/run-pass/match-range.rs b/src/test/run-pass/match-range.rs index 83066c126ce..b9ab0c85ec4 100644 --- a/src/test/run-pass/match-range.rs +++ b/src/test/run-pass/match-range.rs @@ -28,7 +28,7 @@ pub fn main() { 'a'...'z' => {} _ => panic!("should suppport char ranges") } - match -3i { + match -3 { -7...5 => {} _ => panic!("should match signed range") } diff --git a/src/test/run-pass/match-ref-binding-mut-option.rs b/src/test/run-pass/match-ref-binding-mut-option.rs index c983903ac18..8d1e483bcd8 100644 --- a/src/test/run-pass/match-ref-binding-mut-option.rs +++ b/src/test/run-pass/match-ref-binding-mut-option.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let mut v = Some(22i); + let mut v = Some(22); match v { None => {} Some(ref mut p) => { *p += 1; } diff --git a/src/test/run-pass/match-str.rs b/src/test/run-pass/match-str.rs index 544751754c6..60a5904cff3 100644 --- a/src/test/run-pass/match-str.rs +++ b/src/test/run-pass/match-str.rs @@ -23,7 +23,7 @@ pub fn main() { _ => panic!() } - let x = match "a" { "a" => 1i, "b" => 2i, _ => panic!() }; + let x = match "a" { "a" => 1, "b" => 2, _ => panic!() }; assert_eq!(x, 1); match "a" { "a" => { } "b" => { }, _ => panic!() } diff --git a/src/test/run-pass/match-unique-bind.rs b/src/test/run-pass/match-unique-bind.rs index ebe01a1d1f2..63817d42ae8 100644 --- a/src/test/run-pass/match-unique-bind.rs +++ b/src/test/run-pass/match-unique-bind.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - match box 100i { + match box 100 { box x => { println!("{}", x); assert_eq!(x, 100); diff --git a/src/test/run-pass/match-vec-alternatives.rs b/src/test/run-pass/match-vec-alternatives.rs index ae4fd1f1993..98b9d11ecdd 100644 --- a/src/test/run-pass/match-vec-alternatives.rs +++ b/src/test/run-pass/match-vec-alternatives.rs @@ -55,28 +55,28 @@ fn match_nested_vecs_snoc<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) - } fn main() { - assert_eq!(match_vecs(&[1i, 2], &[2i, 3]), "both non-empty"); - assert_eq!(match_vecs(&[], &[1i, 2, 3, 4]), "one empty"); + assert_eq!(match_vecs(&[1, 2], &[2, 3]), "both non-empty"); + assert_eq!(match_vecs(&[], &[1, 2, 3, 4]), "one empty"); assert_eq!(match_vecs::(&[], &[]), "both empty"); - assert_eq!(match_vecs(&[1i, 2, 3], &[]), "one empty"); + assert_eq!(match_vecs(&[1, 2, 3], &[]), "one empty"); - assert_eq!(match_vecs_cons(&[1i, 2], &[2i, 3]), "both non-empty"); - assert_eq!(match_vecs_cons(&[], &[1i, 2, 3, 4]), "one empty"); + assert_eq!(match_vecs_cons(&[1, 2], &[2, 3]), "both non-empty"); + assert_eq!(match_vecs_cons(&[], &[1, 2, 3, 4]), "one empty"); assert_eq!(match_vecs_cons::(&[], &[]), "both empty"); - assert_eq!(match_vecs_cons(&[1i, 2, 3], &[]), "one empty"); + assert_eq!(match_vecs_cons(&[1, 2, 3], &[]), "one empty"); - assert_eq!(match_vecs_snoc(&[1i, 2], &[2i, 3]), "both non-empty"); - assert_eq!(match_vecs_snoc(&[], &[1i, 2, 3, 4]), "one empty"); + assert_eq!(match_vecs_snoc(&[1, 2], &[2, 3]), "both non-empty"); + assert_eq!(match_vecs_snoc(&[], &[1, 2, 3, 4]), "one empty"); assert_eq!(match_vecs_snoc::(&[], &[]), "both empty"); - assert_eq!(match_vecs_snoc(&[1i, 2, 3], &[]), "one empty"); + assert_eq!(match_vecs_snoc(&[1, 2, 3], &[]), "one empty"); assert_eq!(match_nested_vecs_cons(None, Ok::<&[_], ()>(&[4u, 2u])), "None, Ok(at least two elements)"); assert_eq!(match_nested_vecs_cons::(None, Err(())), "None, Ok(less than one element)"); assert_eq!(match_nested_vecs_cons::(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])), "Some(empty), Ok(empty)"); - assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[1i]), Err(())), "Some(non-empty), any"); - assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[(42i, ())]), Ok::<&[_], ()>(&[(1i, ())])), + assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any"); + assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[(42, ())]), Ok::<&[_], ()>(&[(1, ())])), "Some(non-empty), any"); assert_eq!(match_nested_vecs_snoc(None, Ok::<&[_], ()>(&[4u, 2u])), @@ -84,7 +84,7 @@ fn main() { assert_eq!(match_nested_vecs_snoc::(None, Err(())), "None, Ok(less than one element)"); assert_eq!(match_nested_vecs_snoc::(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])), "Some(empty), Ok(empty)"); - assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[1i]), Err(())), "Some(non-empty), any"); - assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[(42i, ())]), Ok::<&[_], ()>(&[(1i, ())])), + assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any"); + assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[(42, ())]), Ok::<&[_], ()>(&[(1, ())])), "Some(non-empty), any"); } diff --git a/src/test/run-pass/match-vec-rvalue.rs b/src/test/run-pass/match-vec-rvalue.rs index 0f058086add..04a0204d206 100644 --- a/src/test/run-pass/match-vec-rvalue.rs +++ b/src/test/run-pass/match-vec-rvalue.rs @@ -12,7 +12,7 @@ pub fn main() { - match vec!(1i, 2i, 3i) { + match vec!(1, 2, 3) { x => { assert_eq!(x.len(), 3); assert_eq!(x[0], 1); diff --git a/src/test/run-pass/method-two-trait-defer-resolution-1.rs b/src/test/run-pass/method-two-trait-defer-resolution-1.rs index e4ae33c1c50..414b08b4335 100644 --- a/src/test/run-pass/method-two-trait-defer-resolution-1.rs +++ b/src/test/run-pass/method-two-trait-defer-resolution-1.rs @@ -12,28 +12,28 @@ // type that is (ultimately) inferred for `x`. trait foo { - fn foo(&self) -> int; + fn foo(&self) -> i32; } -impl foo for Vec { - fn foo(&self) -> int {1} +impl foo for Vec { + fn foo(&self) -> i32 {1} } -impl foo for Vec { - fn foo(&self) -> int {2} +impl foo for Vec { + fn foo(&self) -> i32 {2} } -fn call_foo_uint() -> int { +fn call_foo_uint() -> i32 { let mut x = Vec::new(); let y = x.foo(); - x.push(0u); + x.push(0u32); y } -fn call_foo_int() -> int { +fn call_foo_int() -> i32 { let mut x = Vec::new(); let y = x.foo(); - x.push(0i); + x.push(0i32); y } diff --git a/src/test/run-pass/method-two-trait-defer-resolution-2.rs b/src/test/run-pass/method-two-trait-defer-resolution-2.rs index b18c29dc3c1..7f498b2b578 100644 --- a/src/test/run-pass/method-two-trait-defer-resolution-2.rs +++ b/src/test/run-pass/method-two-trait-defer-resolution-2.rs @@ -41,7 +41,7 @@ fn call_foo_copy() -> int { fn call_foo_other() -> int { let mut x = Vec::new(); let y = x.foo(); - x.push(box 0i); + x.push(box 0); y } diff --git a/src/test/run-pass/method-where-clause.rs b/src/test/run-pass/method-where-clause.rs index 4361c22f55a..6337538a332 100644 --- a/src/test/run-pass/method-where-clause.rs +++ b/src/test/run-pass/method-where-clause.rs @@ -12,24 +12,24 @@ // where clause type, and not only type parameters. trait Foo { - fn foo(&self) -> int; + fn foo(&self) -> i32; } -impl Foo for Option +impl Foo for Option { - fn foo(&self) -> int { + fn foo(&self) -> i32 { self.unwrap_or(22) } } -impl Foo for Option +impl Foo for Option { - fn foo(&self) -> int { - self.unwrap_or(22) as int + fn foo(&self) -> i32 { + self.unwrap_or(22) as i32 } } -fn check(x: Option) -> (int, int) +fn check(x: Option) -> (i32, i32) where Option : Foo { let y: Option = None; @@ -37,6 +37,6 @@ fn check(x: Option) -> (int, int) } fn main() { - assert_eq!(check(Some(23u)), (23i, 22i)); - assert_eq!(check(Some(23i)), (23i, 22i)); + assert_eq!(check(Some(23u32)), (23, 22)); + assert_eq!(check(Some(23)), (23, 22)); } diff --git a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs index 4ebebc46018..eb17aa78bd9 100644 --- a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs +++ b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs @@ -32,9 +32,9 @@ impl Serializer for int { } pub fn main() { - let foo = F { a: 1i }; - foo.serialize(1i); + let foo = F { a: 1 }; + foo.serialize(1); - let bar = F { a: F {a: 1i } }; - bar.serialize(2i); + let bar = F { a: F {a: 1 } }; + bar.serialize(2); } diff --git a/src/test/run-pass/multi-let.rs b/src/test/run-pass/multi-let.rs index 201abeba073..eb1444be378 100644 --- a/src/test/run-pass/multi-let.rs +++ b/src/test/run-pass/multi-let.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = 10i; + let x = 10; let y = x; assert!((y == 10)); } diff --git a/src/test/run-pass/multiple-trait-bounds.rs b/src/test/run-pass/multiple-trait-bounds.rs index 10abe4ce710..7ce1afb52a2 100644 --- a/src/test/run-pass/multiple-trait-bounds.rs +++ b/src/test/run-pass/multiple-trait-bounds.rs @@ -12,5 +12,5 @@ fn f(_: T) { } pub fn main() { - f(3i); + f(3); } diff --git a/src/test/run-pass/mut-in-ident-patterns.rs b/src/test/run-pass/mut-in-ident-patterns.rs index ad9161f9bd4..8be200d3bf3 100644 --- a/src/test/run-pass/mut-in-ident-patterns.rs +++ b/src/test/run-pass/mut-in-ident-patterns.rs @@ -20,7 +20,7 @@ struct X; impl Foo for X {} pub fn main() { - let (a, mut b) = (23i, 4i); + let (a, mut b) = (23, 4); assert_eq!(a, 23); assert_eq!(b, 4); b = a + b; @@ -34,7 +34,7 @@ pub fn main() { Baz(f32, u8) } - let (x, mut y) = (32i, Bar::Foo(21)); + let (x, mut y) = (32, Bar::Foo(21)); match x { mut z @ 32 => { diff --git a/src/test/run-pass/mutability-inherits-through-fixed-length-vec.rs b/src/test/run-pass/mutability-inherits-through-fixed-length-vec.rs index bf926a6c48a..7d6bbbe4240 100644 --- a/src/test/run-pass/mutability-inherits-through-fixed-length-vec.rs +++ b/src/test/run-pass/mutability-inherits-through-fixed-length-vec.rs @@ -9,13 +9,13 @@ // except according to those terms. fn test1() { - let mut ints = [0i; 32]; + let mut ints = [0; 32]; ints[0] += 1; assert_eq!(ints[0], 1); } fn test2() { - let mut ints = [0i; 32]; + let mut ints = [0; 32]; for i in ints.iter_mut() { *i += 22; } for i in ints.iter() { assert!(*i == 22); } } diff --git a/src/test/run-pass/negative.rs b/src/test/run-pass/negative.rs index 4bf91bf7035..435382666f1 100644 --- a/src/test/run-pass/negative.rs +++ b/src/test/run-pass/negative.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - match -5i { + match -5 { -5 => {} _ => { panic!() } } diff --git a/src/test/run-pass/nested-matchs.rs b/src/test/run-pass/nested-matchs.rs index 55c1de2700f..b0ac9fb597a 100644 --- a/src/test/run-pass/nested-matchs.rs +++ b/src/test/run-pass/nested-matchs.rs @@ -14,7 +14,7 @@ fn foo() { match Some::(5) { Some::(_x) => { let mut bar; - match None:: { None:: => { bar = 5i; } _ => { baz(); } } + match None:: { None:: => { bar = 5; } _ => { baz(); } } println!("{}", bar); } None:: => { println!("hello"); } diff --git a/src/test/run-pass/new-box-syntax.rs b/src/test/run-pass/new-box-syntax.rs index 4ea51b3b409..3d4847a119a 100644 --- a/src/test/run-pass/new-box-syntax.rs +++ b/src/test/run-pass/new-box-syntax.rs @@ -24,8 +24,8 @@ struct Structure { } pub fn main() { - let x: Box = box(HEAP) 2i; - let y: Box = box 2i; - let b: Box = box()(1i + 2); - let c = box()(3i + 4); + let x: Box = box(HEAP) 2; + let y: Box = box 2; + let b: Box = box()(1 + 2); + let c = box()(3 + 4); } diff --git a/src/test/run-pass/newtype-polymorphic.rs b/src/test/run-pass/newtype-polymorphic.rs index 74487f5b57d..4b7dbdc9e5b 100644 --- a/src/test/run-pass/newtype-polymorphic.rs +++ b/src/test/run-pass/newtype-polymorphic.rs @@ -23,7 +23,7 @@ fn myvec_elt(mv: myvec) -> X { } pub fn main() { - let mv = myvec(vec!(1i, 2, 3)); + let mv = myvec(vec!(1, 2, 3)); let mv_clone = mv.clone(); let mv_clone = myvec_deref(mv_clone); assert_eq!(mv_clone[1], 2); diff --git a/src/test/run-pass/numeric-method-autoexport.rs b/src/test/run-pass/numeric-method-autoexport.rs index b4d079d79d6..140cf33cd1d 100644 --- a/src/test/run-pass/numeric-method-autoexport.rs +++ b/src/test/run-pass/numeric-method-autoexport.rs @@ -21,7 +21,7 @@ use std::num::ToPrimitive; pub fn main() { // ints // num - assert_eq!(15i.add(6), 21); + assert_eq!(15is.add(6is), 21is); assert_eq!(15i8.add(6i8), 21i8); assert_eq!(15i16.add(6i16), 21i16); assert_eq!(15i32.add(6i32), 21i32); @@ -29,7 +29,7 @@ pub fn main() { // uints // num - assert_eq!(15u.add(6u), 21u); + assert_eq!(15u.add(6us), 21us); assert_eq!(15u8.add(6u8), 21u8); assert_eq!(15u16.add(6u16), 21u16); assert_eq!(15u32.add(6u32), 21u32); diff --git a/src/test/run-pass/object-one-type-two-traits.rs b/src/test/run-pass/object-one-type-two-traits.rs index ebdf3c08a22..f8a3ce7cda0 100644 --- a/src/test/run-pass/object-one-type-two-traits.rs +++ b/src/test/run-pass/object-one-type-two-traits.rs @@ -35,7 +35,7 @@ fn is(x: &Any) -> bool { } fn main() { - let x = box 22i as Box; + let x = box 22 as Box; println!("x={}", x.get()); let y = x.wrap(); } diff --git a/src/test/run-pass/operator-associativity.rs b/src/test/run-pass/operator-associativity.rs index 8d45b8ecb08..bee6d23a27d 100644 --- a/src/test/run-pass/operator-associativity.rs +++ b/src/test/run-pass/operator-associativity.rs @@ -12,4 +12,4 @@ // Testcase for issue #130, operator associativity. -pub fn main() { assert!((3i * 5i / 2i == 7i)); } +pub fn main() { assert!((3 * 5 / 2 == 7)); } diff --git a/src/test/run-pass/out-of-stack-new-thread-no-split.rs b/src/test/run-pass/out-of-stack-new-thread-no-split.rs index 1ede5f546d7..c9e2f893c0f 100644 --- a/src/test/run-pass/out-of-stack-new-thread-no-split.rs +++ b/src/test/run-pass/out-of-stack-new-thread-no-split.rs @@ -28,7 +28,7 @@ pub fn black_box(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } } #[no_stack_check] fn recurse() { - let buf = [0i; 10]; + let buf = [0; 10]; black_box(buf); recurse(); } diff --git a/src/test/run-pass/out-of-stack-no-split.rs b/src/test/run-pass/out-of-stack-no-split.rs index adaa472c760..846fbd477e0 100644 --- a/src/test/run-pass/out-of-stack-no-split.rs +++ b/src/test/run-pass/out-of-stack-no-split.rs @@ -28,7 +28,7 @@ pub fn black_box(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } } #[no_stack_check] fn recurse() { - let buf = [0i; 10]; + let buf = [0; 10]; black_box(buf); recurse(); } diff --git a/src/test/run-pass/out-of-stack.rs b/src/test/run-pass/out-of-stack.rs index 9615cfab5c1..97539a076ff 100644 --- a/src/test/run-pass/out-of-stack.rs +++ b/src/test/run-pass/out-of-stack.rs @@ -22,7 +22,7 @@ use std::os; pub fn black_box(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } } fn silent_recurse() { - let buf = [0i; 1000]; + let buf = [0; 1000]; black_box(buf); silent_recurse(); } diff --git a/src/test/run-pass/overloaded-autoderef-indexing.rs b/src/test/run-pass/overloaded-autoderef-indexing.rs index de37173810f..4cb7ece4ab8 100644 --- a/src/test/run-pass/overloaded-autoderef-indexing.rs +++ b/src/test/run-pass/overloaded-autoderef-indexing.rs @@ -23,6 +23,6 @@ impl<'a, T> Deref for DerefArray<'a, T> { } pub fn main() { - let a = &[1i, 2i, 3i]; + let a = &[1, 2, 3]; assert_eq!(DerefArray {inner: a}[1], 2); } diff --git a/src/test/run-pass/overloaded-autoderef-order.rs b/src/test/run-pass/overloaded-autoderef-order.rs index 4c48b0ba710..d023a01f4b1 100644 --- a/src/test/run-pass/overloaded-autoderef-order.rs +++ b/src/test/run-pass/overloaded-autoderef-order.rs @@ -59,7 +59,7 @@ mod priv_test { } pub fn main() { - let nested = DerefWrapper {x: true, y: DerefWrapper {x: 0i, y: 1i}}; + let nested = DerefWrapper {x: true, y: DerefWrapper {x: 0, y: 1}}; // Use the first field that you can find. assert_eq!(nested.x, true); @@ -73,7 +73,7 @@ pub fn main() { // Also go through multiple levels of indirection. assert_eq!(Rc::new(nested).x, true); - let nested_priv = priv_test::DerefWrapperHideX::new(true, DerefWrapper {x: 0i, y: 1i}); + let nested_priv = priv_test::DerefWrapperHideX::new(true, DerefWrapper {x: 0, y: 1}); // FIXME(eddyb) #12808 should skip private fields. // assert_eq!(nested_priv.x, 0); assert_eq!((*nested_priv).x, 0); diff --git a/src/test/run-pass/overloaded-autoderef-xcrate.rs b/src/test/run-pass/overloaded-autoderef-xcrate.rs index 4f449b344e3..f8dd729ec67 100644 --- a/src/test/run-pass/overloaded-autoderef-xcrate.rs +++ b/src/test/run-pass/overloaded-autoderef-xcrate.rs @@ -13,5 +13,5 @@ extern crate overloaded_autoderef_xc; fn main() { - assert!(overloaded_autoderef_xc::check(5i, 5i)); + assert!(overloaded_autoderef_xc::check(5, 5)); } diff --git a/src/test/run-pass/overloaded-autoderef.rs b/src/test/run-pass/overloaded-autoderef.rs index 59e3a807d5a..baa9709eb76 100644 --- a/src/test/run-pass/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded-autoderef.rs @@ -28,7 +28,7 @@ pub fn main() { assert_eq!(point.x, 2); assert_eq!(point.y, 4); - let i = Rc::new(RefCell::new(2i)); + let i = Rc::new(RefCell::new(2)); let i_value = *i.borrow(); *i.borrow_mut() = 5; assert_eq!((i_value, *i.borrow()), (2, 5)); @@ -47,7 +47,7 @@ pub fn main() { p.borrow_mut().y += 3; assert_eq!(*p.borrow(), Point {x: 3, y: 5}); - let v = Rc::new(RefCell::new([1i, 2, 3])); + let v = Rc::new(RefCell::new([1, 2, 3])); v.borrow_mut()[0] = 3; v.borrow_mut()[1] += 3; assert_eq!((v.borrow()[0], v.borrow()[1], v.borrow()[2]), (3, 5, 3)); diff --git a/src/test/run-pass/overloaded-deref-count.rs b/src/test/run-pass/overloaded-deref-count.rs index 5cd76879798..03fa64fb87f 100644 --- a/src/test/run-pass/overloaded-deref-count.rs +++ b/src/test/run-pass/overloaded-deref-count.rs @@ -49,7 +49,7 @@ impl DerefMut for DerefCounter { } pub fn main() { - let mut n = DerefCounter::new(0i); + let mut n = DerefCounter::new(0); let mut v = DerefCounter::new(Vec::new()); let _ = *n; // Immutable deref + copy a POD. @@ -62,7 +62,7 @@ pub fn main() { assert_eq!(n.counts(), (2, 1)); assert_eq!(v.counts(), (1, 1)); let mut v2 = Vec::new(); - v2.push(1i); + v2.push(1); *n = 5; *v = v2; // Mutable deref + assignment. assert_eq!(n.counts(), (2, 2)); assert_eq!(v.counts(), (1, 2)); diff --git a/src/test/run-pass/overloaded-deref.rs b/src/test/run-pass/overloaded-deref.rs index d02951e981e..fdaddca091f 100644 --- a/src/test/run-pass/overloaded-deref.rs +++ b/src/test/run-pass/overloaded-deref.rs @@ -22,11 +22,11 @@ struct Point { } pub fn main() { - assert_eq!(*Rc::new(5i), 5); - assert_eq!(***Rc::new(box box 5i), 5); + assert_eq!(*Rc::new(5), 5); + assert_eq!(***Rc::new(box box 5), 5); assert_eq!(*Rc::new(Point {x: 2, y: 4}), Point {x: 2, y: 4}); - let i = Rc::new(RefCell::new(2i)); + let i = Rc::new(RefCell::new(2)); let i_value = *(*i).borrow(); *(*i).borrow_mut() = 5; assert_eq!((i_value, *(*i).borrow()), (2, 5)); @@ -46,7 +46,7 @@ pub fn main() { (*(*p).borrow_mut()).y += 3; assert_eq!(*(*p).borrow(), Point {x: 3, y: 5}); - let v = Rc::new(RefCell::new(vec!(1i, 2, 3))); + let v = Rc::new(RefCell::new(vec!(1, 2, 3))); (*(*v).borrow_mut())[0] = 3; (*(*v).borrow_mut())[1] += 3; assert_eq!(((*(*v).borrow())[0], diff --git a/src/test/run-pass/overloaded-index-assoc-list.rs b/src/test/run-pass/overloaded-index-assoc-list.rs index 5e0523d7041..7e3ff198c43 100644 --- a/src/test/run-pass/overloaded-index-assoc-list.rs +++ b/src/test/run-pass/overloaded-index-assoc-list.rs @@ -46,8 +46,8 @@ pub fn main() { let bar = "bar".to_string(); let mut list = AssociationList {pairs: Vec::new()}; - list.push(foo.clone(), 22i); - list.push(bar.clone(), 44i); + list.push(foo.clone(), 22); + list.push(bar.clone(), 44); assert!(list[foo] == 22); assert!(list[bar] == 44); diff --git a/src/test/run-pass/owned-implies-static.rs b/src/test/run-pass/owned-implies-static.rs index e784318fc76..2db6f7ffaaa 100644 --- a/src/test/run-pass/owned-implies-static.rs +++ b/src/test/run-pass/owned-implies-static.rs @@ -14,5 +14,5 @@ fn f(_x: T) {} pub fn main() { - f(box 5i); + f(box 5); } diff --git a/src/test/run-pass/paren-free.rs b/src/test/run-pass/paren-free.rs index 569023c4439..d9669812d2a 100644 --- a/src/test/run-pass/paren-free.rs +++ b/src/test/run-pass/paren-free.rs @@ -10,6 +10,6 @@ pub fn main() { let x = true; - if x { let mut i = 10i; while i > 0 { i -= 1; } } + if x { let mut i = 10; while i > 0 { i -= 1; } } match x { true => { println!("right"); } false => { println!("wrong"); } } } diff --git a/src/test/run-pass/parse-complex-macro-invoc-op.rs b/src/test/run-pass/parse-complex-macro-invoc-op.rs index e9ec624c13e..0995910fd4c 100644 --- a/src/test/run-pass/parse-complex-macro-invoc-op.rs +++ b/src/test/run-pass/parse-complex-macro-invoc-op.rs @@ -17,24 +17,24 @@ macro_rules! id { } fn foo() { - id!(1i) + 1; - id![1i] - 1; - id!(1i) * 1; - id![1i] / 1; - id!(1i) % 1; + id!(1) + 1; + id![1] - 1; + id!(1) * 1; + id![1] / 1; + id!(1) % 1; - id!(1i) & 1; - id![1i] | 1; - id!(1i) ^ 1; + id!(1) & 1; + id![1] | 1; + id!(1) ^ 1; - let mut x = 1i; + let mut x = 1; id![x] = 2; id!(x) += 1; id!(1f64).clone(); - id!([1i, 2, 3])[1]; - id![drop](1i); + id!([1, 2, 3])[1]; + id![drop](1); id!(true) && true; id![true] || true; diff --git a/src/test/run-pass/parse-panic.rs b/src/test/run-pass/parse-panic.rs index 0dbba3654b6..22b24ebb3b5 100644 --- a/src/test/run-pass/parse-panic.rs +++ b/src/test/run-pass/parse-panic.rs @@ -10,6 +10,6 @@ #![allow(unreachable_code)] -fn dont_call_me() { panic!(); println!("{}", 1i); } +fn dont_call_me() { panic!(); println!("{}", 1); } pub fn main() { } diff --git a/src/test/run-pass/priv-impl-prim-ty.rs b/src/test/run-pass/priv-impl-prim-ty.rs index a8cd5e789b1..679aa3d668f 100644 --- a/src/test/run-pass/priv-impl-prim-ty.rs +++ b/src/test/run-pass/priv-impl-prim-ty.rs @@ -13,6 +13,6 @@ extern crate "priv-impl-prim-ty" as bar; pub fn main() { - bar::frob(1i); + bar::frob(1); } diff --git a/src/test/run-pass/ptr-coercion.rs b/src/test/run-pass/ptr-coercion.rs index 1b77c1316ed..a6a8890101c 100644 --- a/src/test/run-pass/ptr-coercion.rs +++ b/src/test/run-pass/ptr-coercion.rs @@ -12,24 +12,24 @@ pub fn main() { // &mut -> & - let x: &mut int = &mut 42i; + let x: &mut int = &mut 42; let x: &int = x; - let x: &int = &mut 42i; + let x: &int = &mut 42; // & -> *const - let x: &int = &42i; + let x: &int = &42; let x: *const int = x; - let x: *const int = &42i; + let x: *const int = &42; // &mut -> *const - let x: &mut int = &mut 42i; + let x: &mut int = &mut 42; let x: *const int = x; - let x: *const int = &mut 42i; + let x: *const int = &mut 42; // *mut -> *const - let x: *mut int = &mut 42i; + let x: *mut int = &mut 42; let x: *const int = x; } diff --git a/src/test/run-pass/range.rs b/src/test/run-pass/range.rs index bfd3e43768f..11e8bfa48f6 100644 --- a/src/test/run-pass/range.rs +++ b/src/test/run-pass/range.rs @@ -45,9 +45,9 @@ pub fn main() { let _ = ..42u; // Test we can use two different types with a common supertype. - let x = &42i; + let x = &42; { - let y = 42i; + let y = 42; let _ = x..&y; } } diff --git a/src/test/run-pass/reexported-static-methods-cross-crate.rs b/src/test/run-pass/reexported-static-methods-cross-crate.rs index 0d0fdb13db3..5399f3cfd35 100644 --- a/src/test/run-pass/reexported-static-methods-cross-crate.rs +++ b/src/test/run-pass/reexported-static-methods-cross-crate.rs @@ -17,8 +17,8 @@ use reexported_static_methods::Boz; use reexported_static_methods::Bort; pub fn main() { - assert_eq!(42i, Foo::foo()); - assert_eq!(84i, Baz::bar()); - assert!(Boz::boz(1i)); + assert_eq!(42, Foo::foo()); + assert_eq!(84, Baz::bar()); + assert!(Boz::boz(1)); assert_eq!("bort()".to_string(), Bort::bort()); } diff --git a/src/test/run-pass/regions-copy-closure.rs b/src/test/run-pass/regions-copy-closure.rs index 0152793d96c..dc6f377e9b2 100644 --- a/src/test/run-pass/regions-copy-closure.rs +++ b/src/test/run-pass/regions-copy-closure.rs @@ -21,7 +21,7 @@ fn box_it<'a>(x: Box) -> closure_box<'a> { } pub fn main() { - let mut i = 3i; + let mut i = 3i32; assert_eq!(i, 3); { let cl = |&mut:| i += 1; diff --git a/src/test/run-pass/regions-early-bound-trait-param.rs b/src/test/run-pass/regions-early-bound-trait-param.rs index 3267ff2c7e0..6fcfaf58a02 100644 --- a/src/test/run-pass/regions-early-bound-trait-param.rs +++ b/src/test/run-pass/regions-early-bound-trait-param.rs @@ -81,7 +81,7 @@ impl<'s> Trait<'s> for (int,int) { } impl<'t> MakerTrait<'t> for Box+'static> { - fn mk() -> Box+'static> { box() (4i,5i) as Box } + fn mk() -> Box+'static> { box() (4,5) as Box } } enum List<'l> { @@ -111,7 +111,7 @@ impl<'t> RefMakerTrait<'t> for List<'t> { } pub fn main() { - let t = (2i,3i); + let t = (2,3); let o = &t as &Trait; let s1 = Struct1 { f: o }; let s2 = Struct2 { f: o }; diff --git a/src/test/run-pass/regions-early-bound-used-in-bound.rs b/src/test/run-pass/regions-early-bound-used-in-bound.rs index 73eb7ca7188..a3602c5fbec 100644 --- a/src/test/run-pass/regions-early-bound-used-in-bound.rs +++ b/src/test/run-pass/regions-early-bound-used-in-bound.rs @@ -32,6 +32,6 @@ fn add<'a,G:GetRef<'a, int>>(g1: G, g2: G) -> int { } pub fn main() { - let b1 = Box { t: &3i }; - assert_eq!(add(b1, b1), 6i); + let b1 = Box { t: &3 }; + assert_eq!(add(b1, b1), 6); } diff --git a/src/test/run-pass/regions-early-bound-used-in-type-param.rs b/src/test/run-pass/regions-early-bound-used-in-type-param.rs index e0d5e0a1c78..caef4e3fa9c 100644 --- a/src/test/run-pass/regions-early-bound-used-in-type-param.rs +++ b/src/test/run-pass/regions-early-bound-used-in-type-param.rs @@ -31,6 +31,6 @@ fn add<'a,G:Get<&'a int>>(g1: G, g2: G) -> int { } pub fn main() { - let b1 = Box { t: &3i }; - assert_eq!(add(b1, b1), 6i); + let b1 = Box { t: &3 }; + assert_eq!(add(b1, b1), 6); } diff --git a/src/test/run-pass/regions-infer-borrow-scope-view.rs b/src/test/run-pass/regions-infer-borrow-scope-view.rs index ce9edb5678a..d247f864571 100644 --- a/src/test/run-pass/regions-infer-borrow-scope-view.rs +++ b/src/test/run-pass/regions-infer-borrow-scope-view.rs @@ -12,7 +12,7 @@ fn view(x: &[T]) -> &[T] {x} pub fn main() { - let v = vec!(1i, 2, 3); + let v = vec!(1, 2, 3); let x = view(v.as_slice()); let y = view(x.as_slice()); assert!((v[0] == x[0]) && (v[0] == y[0])); diff --git a/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs b/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs index f397b5124ca..d07110fd721 100644 --- a/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs +++ b/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs @@ -14,7 +14,7 @@ fn borrow(x: &T) -> &T {x} pub fn main() { - let x = box 3i; + let x = box 3; loop { let y = borrow(&*x); assert_eq!(*x, *y); diff --git a/src/test/run-pass/regions-return-interior-of-option.rs b/src/test/run-pass/regions-return-interior-of-option.rs index 54458f0d0df..ee1d6687307 100644 --- a/src/test/run-pass/regions-return-interior-of-option.rs +++ b/src/test/run-pass/regions-return-interior-of-option.rs @@ -16,14 +16,14 @@ fn get(opt: &Option) -> &T { } pub fn main() { - let mut x = Some(23i); + let mut x = Some(23); { let y = get(&x); assert_eq!(*y, 23); } - x = Some(24i); + x = Some(24); { let y = get(&x); diff --git a/src/test/run-pass/regions-scope-chain-example.rs b/src/test/run-pass/regions-scope-chain-example.rs index 0388ffb7894..e5ef88006c7 100644 --- a/src/test/run-pass/regions-scope-chain-example.rs +++ b/src/test/run-pass/regions-scope-chain-example.rs @@ -31,7 +31,7 @@ struct Context<'a> { impl<'a> Context<'a> { fn foo(&mut self, scope: Scope) { - let link = if 1i < 2 { + let link = if 1 < 2 { let l = ScopeChain::Link(scope); self.take_scope(&l); l diff --git a/src/test/run-pass/repeated-vector-syntax.rs b/src/test/run-pass/repeated-vector-syntax.rs index d1d37ea5bb0..6048e0d8673 100644 --- a/src/test/run-pass/repeated-vector-syntax.rs +++ b/src/test/run-pass/repeated-vector-syntax.rs @@ -10,7 +10,7 @@ pub fn main() { let x = [ [true]; 512 ]; - let y = [ 0i; 1 ]; + let y = [ 0; 1 ]; print!("["); for xi in x.iter() { diff --git a/src/test/run-pass/resource-assign-is-not-copy.rs b/src/test/run-pass/resource-assign-is-not-copy.rs index ff38b02ae76..abc33e9f2e6 100644 --- a/src/test/run-pass/resource-assign-is-not-copy.rs +++ b/src/test/run-pass/resource-assign-is-not-copy.rs @@ -31,11 +31,11 @@ fn r(i: &Cell) -> r { } pub fn main() { - let i = &Cell::new(0i); + let i = &Cell::new(0); // Even though these look like copies, they are guaranteed not to be { let a = r(i); - let b = (a, 10i); + let b = (a, 10); let (c, _d) = b; println!("{:?}", c); } diff --git a/src/test/run-pass/self-re-assign.rs b/src/test/run-pass/self-re-assign.rs index 3092898d986..cf09737e32e 100644 --- a/src/test/run-pass/self-re-assign.rs +++ b/src/test/run-pass/self-re-assign.rs @@ -17,11 +17,11 @@ use std::rc::Rc; pub fn main() { - let mut x = box 3i; + let mut x = box 3; x = x; assert!(*x == 3); - let mut x = Rc::new(3i); + let mut x = Rc::new(3); x = x; assert!(*x == 3); } diff --git a/src/test/run-pass/seq-compare.rs b/src/test/run-pass/seq-compare.rs index 29729b15aa8..ef14e0ba931 100644 --- a/src/test/run-pass/seq-compare.rs +++ b/src/test/run-pass/seq-compare.rs @@ -13,13 +13,13 @@ pub fn main() { assert!(("hello".to_string() < "hellr".to_string())); assert!(("hello ".to_string() > "hello".to_string())); assert!(("hello".to_string() != "there".to_string())); - assert!((vec!(1i, 2, 3, 4) > vec!(1, 2, 3))); - assert!((vec!(1i, 2, 3) < vec!(1, 2, 3, 4))); - assert!((vec!(1i, 2, 4, 4) > vec!(1, 2, 3, 4))); - assert!((vec!(1i, 2, 3, 4) < vec!(1, 2, 4, 4))); - assert!((vec!(1i, 2, 3) <= vec!(1, 2, 3))); - assert!((vec!(1i, 2, 3) <= vec!(1, 2, 3, 3))); - assert!((vec!(1i, 2, 3, 4) > vec!(1, 2, 3))); - assert_eq!(vec!(1i, 2, 3), vec!(1, 2, 3)); - assert!((vec!(1i, 2, 3) != vec!(1, 1, 3))); + assert!((vec!(1, 2, 3, 4) > vec!(1, 2, 3))); + assert!((vec!(1, 2, 3) < vec!(1, 2, 3, 4))); + assert!((vec!(1, 2, 4, 4) > vec!(1, 2, 3, 4))); + assert!((vec!(1, 2, 3, 4) < vec!(1, 2, 4, 4))); + assert!((vec!(1, 2, 3) <= vec!(1, 2, 3))); + assert!((vec!(1, 2, 3) <= vec!(1, 2, 3, 3))); + assert!((vec!(1, 2, 3, 4) > vec!(1, 2, 3))); + assert_eq!(vec!(1, 2, 3), vec!(1, 2, 3)); + assert!((vec!(1, 2, 3) != vec!(1, 1, 3))); } diff --git a/src/test/run-pass/shadow.rs b/src/test/run-pass/shadow.rs index 06d707d3ab0..dbe73d1b94a 100644 --- a/src/test/run-pass/shadow.rs +++ b/src/test/run-pass/shadow.rs @@ -17,7 +17,7 @@ fn foo(c: Vec ) { t::some::(_) => { for _i in c.iter() { println!("{}", a); - let a = 17i; + let a = 17; b.push(a); } } @@ -27,4 +27,4 @@ fn foo(c: Vec ) { enum t { none, some(T), } -pub fn main() { let x = 10i; let x = x + 20; assert!((x == 30)); foo(Vec::new()); } +pub fn main() { let x = 10; let x = x + 20; assert!((x == 30)); foo(Vec::new()); } diff --git a/src/test/run-pass/shift.rs b/src/test/run-pass/shift.rs index d8a67eef3f6..2dbedc3a573 100644 --- a/src/test/run-pass/shift.rs +++ b/src/test/run-pass/shift.rs @@ -18,7 +18,7 @@ pub fn main() { } fn test_misc() { - assert_eq!(1i << 1 << 1 << 1 << 1 << 1, 32); + assert_eq!(1 << 1 << 1 << 1 << 1 << 1, 32); } fn test_expr() { diff --git a/src/test/run-pass/simple-infer.rs b/src/test/run-pass/simple-infer.rs index 4f6feb544f4..04c1af4326b 100644 --- a/src/test/run-pass/simple-infer.rs +++ b/src/test/run-pass/simple-infer.rs @@ -10,4 +10,4 @@ -pub fn main() { let mut n; n = 1i; println!("{}", n); } +pub fn main() { let mut n; n = 1; println!("{}", n); } diff --git a/src/test/run-pass/static-assert.rs b/src/test/run-pass/static-assert.rs index c695fa2b72e..f8fd81b9365 100644 --- a/src/test/run-pass/static-assert.rs +++ b/src/test/run-pass/static-assert.rs @@ -12,13 +12,13 @@ static b: bool = true; #[static_assert] -static c: bool = 1i == 1; +static c: bool = 1 == 1; #[static_assert] -static d: bool = 1i != 2; +static d: bool = 1 != 2; #[static_assert] -static f: bool = (4i/2) == 2; +static f: bool = (4/2) == 2; pub fn main() { } diff --git a/src/test/run-pass/static-fn-inline-xc.rs b/src/test/run-pass/static-fn-inline-xc.rs index dbe9221066f..efc374e25bb 100644 --- a/src/test/run-pass/static-fn-inline-xc.rs +++ b/src/test/run-pass/static-fn-inline-xc.rs @@ -15,5 +15,5 @@ extern crate "static_fn_inline_xc_aux" as mycore; use mycore::num; pub fn main() { - let _1: f64 = num::Num2::from_int2(1i); + let _1: f64 = num::Num2::from_int2(1); } diff --git a/src/test/run-pass/static-fn-trait-xc.rs b/src/test/run-pass/static-fn-trait-xc.rs index 5dd6b6dbc53..cb9f7c3da02 100644 --- a/src/test/run-pass/static-fn-trait-xc.rs +++ b/src/test/run-pass/static-fn-trait-xc.rs @@ -15,5 +15,5 @@ extern crate "static_fn_trait_xc_aux" as mycore; use mycore::num; pub fn main() { - let _1: f64 = num::Num2::from_int2(1i); + let _1: f64 = num::Num2::from_int2(1); } diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index 74c0663971e..44d77e440d1 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -61,10 +61,10 @@ pub fn main() { assert_eq!(10u.plus(), 30); assert_eq!(("hi".to_string()).plus(), 200); - assert_eq!((vec!(1i)).length_().str(), "1".to_string()); - let vect = vec!(3i, 4).map_(|a| *a + 4); + assert_eq!((vec!(1)).length_().str(), "1".to_string()); + let vect = vec!(3, 4).map_(|a| *a + 4); assert_eq!(vect[0], 7); - let vect = (vec!(3i, 4)).map_::(|a| *a as uint + 4u); + let vect = (vec!(3, 4)).map_::(|a| *a as uint + 4u); assert_eq!(vect[0], 7u); let mut x = 0u; 10u.multi(|_n| x += 2u ); diff --git a/src/test/run-pass/string-self-append.rs b/src/test/run-pass/string-self-append.rs index dc1e23ca09c..612483f6909 100644 --- a/src/test/run-pass/string-self-append.rs +++ b/src/test/run-pass/string-self-append.rs @@ -11,7 +11,7 @@ pub fn main() { // Make sure we properly handle repeated self-appends. let mut a: String = "A".to_string(); - let mut i = 20i; + let mut i = 20; let mut expected_len = 1u; while i > 0 { println!("{}", a.len()); diff --git a/src/test/run-pass/struct-lit-functional-no-fields.rs b/src/test/run-pass/struct-lit-functional-no-fields.rs index ebf2fbbe53c..c3b1ff0f057 100644 --- a/src/test/run-pass/struct-lit-functional-no-fields.rs +++ b/src/test/run-pass/struct-lit-functional-no-fields.rs @@ -16,8 +16,8 @@ struct Foo { pub fn main() { let foo = Foo { - bar: 0i, - baz: 1i + bar: 0, + baz: 1 }; let foo_ = foo.clone(); diff --git a/src/test/run-pass/structured-compare.rs b/src/test/run-pass/structured-compare.rs index d87ff64ebd9..12d8fe8f4c8 100644 --- a/src/test/run-pass/structured-compare.rs +++ b/src/test/run-pass/structured-compare.rs @@ -21,14 +21,14 @@ impl PartialEq for foo { } pub fn main() { - let a = (1i, 2i, 3i); - let b = (1i, 2i, 3i); + let a = (1, 2, 3); + let b = (1, 2, 3); assert_eq!(a, b); assert!((a != (1, 2, 4))); assert!((a < (1, 2, 4))); assert!((a <= (1, 2, 4))); - assert!(((1i, 2i, 4i) > a)); - assert!(((1i, 2i, 4i) >= a)); + assert!(((1, 2, 4) > a)); + assert!(((1, 2, 4) >= a)); let x = foo::large; let y = foo::small; assert!((x != y)); diff --git a/src/test/run-pass/supertrait-default-generics.rs b/src/test/run-pass/supertrait-default-generics.rs index f31d9ca186f..e158ae672aa 100644 --- a/src/test/run-pass/supertrait-default-generics.rs +++ b/src/test/run-pass/supertrait-default-generics.rs @@ -38,7 +38,7 @@ impl Positioned for Point { impl> Movable for Point {} pub fn main() { - let mut p = Point{ x: 1i, y: 2i}; + let mut p = Point{ x: 1, y: 2}; p.translate(3); assert_eq!(p.X(), 4); } diff --git a/src/test/run-pass/supported-cast.rs b/src/test/run-pass/supported-cast.rs index 7cba4533c7f..60431fbedd0 100644 --- a/src/test/run-pass/supported-cast.rs +++ b/src/test/run-pass/supported-cast.rs @@ -34,8 +34,8 @@ pub fn main() { println!("{:?}", 1 as u16); println!("{:?}", 1 as u32); println!("{:?}", 1 as u64); - println!("{:?}", 1i as f32); - println!("{:?}", 1i as f64); + println!("{:?}", 1 as f32); + println!("{:?}", 1 as f64); println!("{:?}", 1u as int); println!("{:?}", 1u as uint); diff --git a/src/test/run-pass/swap-1.rs b/src/test/run-pass/swap-1.rs index 9a77356d7eb..82a76512e08 100644 --- a/src/test/run-pass/swap-1.rs +++ b/src/test/run-pass/swap-1.rs @@ -11,7 +11,7 @@ use std::mem::swap; pub fn main() { - let mut x = 3i; let mut y = 7i; + let mut x = 3; let mut y = 7; swap(&mut x, &mut y); assert!((x == 7)); assert!((y == 3)); } diff --git a/src/test/run-pass/tag-variant-disr-type-mismatch.rs b/src/test/run-pass/tag-variant-disr-type-mismatch.rs index c04751d51b4..7e4bd9ab273 100644 --- a/src/test/run-pass/tag-variant-disr-type-mismatch.rs +++ b/src/test/run-pass/tag-variant-disr-type-mismatch.rs @@ -9,7 +9,7 @@ // except according to those terms. enum color { - red = 1i, + red = 1, blue = 2, } diff --git a/src/test/run-pass/terminate-in-initializer.rs b/src/test/run-pass/terminate-in-initializer.rs index bfd1f5f4a74..185edb02cca 100644 --- a/src/test/run-pass/terminate-in-initializer.rs +++ b/src/test/run-pass/terminate-in-initializer.rs @@ -16,7 +16,7 @@ use std::thread::Thread; fn test_break() { loop { let _x: Box = break; } } -fn test_cont() { let mut i = 0i; while i < 1 { i += 1; let _x: Box = continue; } } +fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: Box = continue; } } fn test_ret() { let _x: Box = return; } diff --git a/src/test/run-pass/trailing-comma.rs b/src/test/run-pass/trailing-comma.rs index 00e05064080..b5ae259bc63 100644 --- a/src/test/run-pass/trailing-comma.rs +++ b/src/test/run-pass/trailing-comma.rs @@ -28,16 +28,16 @@ enum Baz { #[allow(unused,)] pub fn main() { - f::(0i,); - let (_, _,) = (1i, 1i,); - let [_, _,] = [1i, 1,]; - let [_, _, .., _,] = [1i, 1, 1, 1,]; - let [_, _, _.., _,] = [1i, 1, 1, 1,]; + f::(0,); + let (_, _,) = (1, 1,); + let [_, _,] = [1, 1,]; + let [_, _, .., _,] = [1, 1, 1, 1,]; + let [_, _, _.., _,] = [1, 1, 1, 1,]; let x: Foo = Foo::; - Bar::f(0i,); - Bar.g(0i,); + Bar::f(0,); + Bar.g(0,); Bar.h(); let x = Baz::Qux(1,); diff --git a/src/test/run-pass/trait-default-method-bound-subst.rs b/src/test/run-pass/trait-default-method-bound-subst.rs index 6b0ab8910de..5f0e149eb28 100644 --- a/src/test/run-pass/trait-default-method-bound-subst.rs +++ b/src/test/run-pass/trait-default-method-bound-subst.rs @@ -13,14 +13,14 @@ trait A { fn g(&self, x: T, y: U) -> (T, U) { (x, y) } } -impl A for int { } -impl A for uint { } +impl A for i32 { } +impl A for u32 { } fn f>(i: V, j: T, k: U) -> (T, U) { i.g(j, k) } pub fn main () { - assert_eq!(f(0i, 1i, 2i), (1, 2)); - assert_eq!(f(0u, 1i, 2i), (1, 2)); + assert_eq!(f(0, 1, 2), (1, 2)); + assert_eq!(f(0, 1, 2), (1, 2)); } diff --git a/src/test/run-pass/trait-default-method-bound-subst2.rs b/src/test/run-pass/trait-default-method-bound-subst2.rs index d9ba9ca9220..1ea3879e7fa 100644 --- a/src/test/run-pass/trait-default-method-bound-subst2.rs +++ b/src/test/run-pass/trait-default-method-bound-subst2.rs @@ -20,5 +20,5 @@ fn f>(i: V, j: T) -> T { } pub fn main () { - assert_eq!(f(0i, 2i), 2); + assert_eq!(f(0, 2), 2); } diff --git a/src/test/run-pass/trait-default-method-bound-subst3.rs b/src/test/run-pass/trait-default-method-bound-subst3.rs index 43fb19a58ed..aff20ffe962 100644 --- a/src/test/run-pass/trait-default-method-bound-subst3.rs +++ b/src/test/run-pass/trait-default-method-bound-subst3.rs @@ -20,6 +20,6 @@ fn f(i: V, j: T, k: T) -> (T, T) { } pub fn main () { - assert_eq!(f(0i, 1i, 2i), (1, 2)); - assert_eq!(f(0i, 1u8, 2u8), (1u8, 2u8)); + assert_eq!(f(0, 1, 2), (1, 2)); + assert_eq!(f(0, 1u8, 2u8), (1u8, 2u8)); } diff --git a/src/test/run-pass/trait-default-method-bound.rs b/src/test/run-pass/trait-default-method-bound.rs index 1505d48839e..8a2f1b1743b 100644 --- a/src/test/run-pass/trait-default-method-bound.rs +++ b/src/test/run-pass/trait-default-method-bound.rs @@ -20,5 +20,5 @@ fn f(i: T) { } pub fn main () { - f(0i); + f(0); } diff --git a/src/test/run-pass/trait-default-method-xc-2.rs b/src/test/run-pass/trait-default-method-xc-2.rs index 1aa958dafc7..b28e8bd24aa 100644 --- a/src/test/run-pass/trait-default-method-xc-2.rs +++ b/src/test/run-pass/trait-default-method-xc-2.rs @@ -20,15 +20,15 @@ use aux2::{a_struct, welp}; pub fn main () { - let a = a_struct { x: 0i }; - let b = a_struct { x: 1i }; + let a = a_struct { x: 0 }; + let b = a_struct { x: 1 }; - assert_eq!(0i.g(), 10); + assert_eq!(0.g(), 10); assert_eq!(a.g(), 10); assert_eq!(a.h(), 11); assert_eq!(b.g(), 10); assert_eq!(b.h(), 11); assert_eq!(A::lurr(&a, &b), 21); - welp(&0i); + welp(&0); } diff --git a/src/test/run-pass/trait-default-method-xc.rs b/src/test/run-pass/trait-default-method-xc.rs index c4880e97c45..4745d057952 100644 --- a/src/test/run-pass/trait-default-method-xc.rs +++ b/src/test/run-pass/trait-default-method-xc.rs @@ -52,35 +52,35 @@ impl TestEquality for stuff::thing { pub fn main() { // Some tests of random things - f(0i); + f(0); - assert_eq!(A::lurr(&0i, &1i), 21); + assert_eq!(A::lurr(&0, &1), 21); let a = stuff::thing { x: 0 }; let b = stuff::thing { x: 1 }; let c = Something { x: 1 }; - assert_eq!(0i.g(), 10); + assert_eq!(0.g(), 10); assert_eq!(a.g(), 10); assert_eq!(a.h(), 11); assert_eq!(c.h(), 11); - assert_eq!(0i.thing(3.14f64, 1i), (3.14f64, 1i)); - assert_eq!(B::staticthing(&0i, 3.14f64, 1i), (3.14f64, 1i)); - assert_eq!(B::::staticthing::(&0i, 3.14, 1), (3.14, 1)); + assert_eq!(0.thing(3.14f64, 1), (3.14f64, 1)); + assert_eq!(B::staticthing(&0, 3.14f64, 1), (3.14f64, 1)); + assert_eq!(B::::staticthing::(&0, 3.14, 1), (3.14, 1)); - assert_eq!(g(0i, 3.14f64, 1i), (3.14f64, 1i)); - assert_eq!(g(false, 3.14f64, 1i), (3.14, 1)); + assert_eq!(g(0, 3.14f64, 1), (3.14f64, 1)); + assert_eq!(g(false, 3.14f64, 1), (3.14, 1)); // Trying out a real one - assert!(12i.test_neq(&10i)); - assert!(!10i.test_neq(&10i)); + assert!(12.test_neq(&10)); + assert!(!10.test_neq(&10)); assert!(a.test_neq(&b)); assert!(!a.test_neq(&a)); - assert!(neq(&12i, &10i)); - assert!(!neq(&10i, &10i)); + assert!(neq(&12, &10)); + assert!(!neq(&10, &10)); assert!(neq(&a, &b)); assert!(!neq(&a, &a)); } diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs index d4c1b688b47..e79b22f70cf 100644 --- a/src/test/run-pass/trait-generic.rs +++ b/src/test/run-pass/trait-generic.rs @@ -44,7 +44,7 @@ fn bar>(x: T) -> Vec { } pub fn main() { - assert_eq!(foo(vec!(1i)), vec!("hi".to_string())); + assert_eq!(foo(vec!(1)), vec!("hi".to_string())); assert_eq!(bar:: >(vec!(4, 5)), vec!("4".to_string(), "5".to_string())); assert_eq!(bar:: >(vec!("x".to_string(), "y".to_string())), vec!("x".to_string(), "y".to_string())); diff --git a/src/test/run-pass/trait-impl.rs b/src/test/run-pass/trait-impl.rs index 003686c0bbe..16ef315c206 100644 --- a/src/test/run-pass/trait-impl.rs +++ b/src/test/run-pass/trait-impl.rs @@ -33,7 +33,7 @@ struct Foo; impl<'a> Bar<'a> for Foo {} fn main() { - let x: &T = &42i; + let x: &T = &42; x.foo(); T::foo(x); diff --git a/src/test/run-pass/trait-inheritance-num.rs b/src/test/run-pass/trait-inheritance-num.rs index e606018feb9..9a30d51f4c5 100644 --- a/src/test/run-pass/trait-inheritance-num.rs +++ b/src/test/run-pass/trait-inheritance-num.rs @@ -16,7 +16,7 @@ pub trait NumExt: NumCast + PartialEq + PartialOrd {} pub trait FloatExt: NumExt {} -fn greater_than_one(n: &T) -> bool { *n > NumCast::from(1i).unwrap() } -fn greater_than_one_float(n: &T) -> bool { *n > NumCast::from(1i).unwrap() } +fn greater_than_one(n: &T) -> bool { *n > NumCast::from(1).unwrap() } +fn greater_than_one_float(n: &T) -> bool { *n > NumCast::from(1).unwrap() } pub fn main() {} diff --git a/src/test/run-pass/trait-inheritance-num0.rs b/src/test/run-pass/trait-inheritance-num0.rs index 42eaaa09fcd..d68b6a54f71 100644 --- a/src/test/run-pass/trait-inheritance-num0.rs +++ b/src/test/run-pass/trait-inheritance-num0.rs @@ -22,7 +22,7 @@ pub trait Num { pub trait NumExt: NumCast + PartialOrd { } fn greater_than_one(n: &T) -> bool { - n.gt(&NumCast::from(1i).unwrap()) + n.gt(&NumCast::from(1).unwrap()) } pub fn main() {} diff --git a/src/test/run-pass/trait-inheritance-num1.rs b/src/test/run-pass/trait-inheritance-num1.rs index 9407afbdd6b..15fb5df4626 100644 --- a/src/test/run-pass/trait-inheritance-num1.rs +++ b/src/test/run-pass/trait-inheritance-num1.rs @@ -14,7 +14,7 @@ use std::num::NumCast; pub trait NumExt: NumCast + PartialOrd { } fn greater_than_one(n: &T) -> bool { - *n > NumCast::from(1i).unwrap() + *n > NumCast::from(1).unwrap() } pub fn main() {} diff --git a/src/test/run-pass/trait-inheritance-num3.rs b/src/test/run-pass/trait-inheritance-num3.rs index bd93223093a..09015d983ea 100644 --- a/src/test/run-pass/trait-inheritance-num3.rs +++ b/src/test/run-pass/trait-inheritance-num3.rs @@ -16,7 +16,7 @@ pub trait NumExt: PartialEq + PartialOrd + NumCast {} impl NumExt for f32 {} fn num_eq_one(n: T) { - println!("{}", n == NumCast::from(1i).unwrap()) + println!("{}", n == NumCast::from(1).unwrap()) } pub fn main() { diff --git a/src/test/run-pass/trait-inheritance-num5.rs b/src/test/run-pass/trait-inheritance-num5.rs index 4c79600e2e9..a21026839a7 100644 --- a/src/test/run-pass/trait-inheritance-num5.rs +++ b/src/test/run-pass/trait-inheritance-num5.rs @@ -17,7 +17,7 @@ impl NumExt for f32 {} impl NumExt for int {} fn num_eq_one() -> T { - NumCast::from(1i).unwrap() + NumCast::from(1).unwrap() } pub fn main() { diff --git a/src/test/run-pass/trait-inheritance-visibility.rs b/src/test/run-pass/trait-inheritance-visibility.rs index dc84cbfb09a..3cdedd884a4 100644 --- a/src/test/run-pass/trait-inheritance-visibility.rs +++ b/src/test/run-pass/trait-inheritance-visibility.rs @@ -24,5 +24,5 @@ fn f(x: &T) { } pub fn main() { - f(&0i) + f(&0) } diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index 9b910d24bdc..ea8a5a28c34 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -31,15 +31,15 @@ impl to_str for Vec { pub fn main() { assert!(1.to_string_() == "1".to_string()); - assert!((vec!(2i, 3, 4)).to_string_() == "[2, 3, 4]".to_string()); + assert!((vec!(2, 3, 4)).to_string_() == "[2, 3, 4]".to_string()); fn indirect(x: T) -> String { format!("{}!", x.to_string_()) } - assert!(indirect(vec!(10i, 20)) == "[10, 20]!".to_string()); + assert!(indirect(vec!(10, 20)) == "[10, 20]!".to_string()); fn indirect2(x: T) -> String { indirect(x) } - assert!(indirect2(vec!(1i)) == "[1]!".to_string()); + assert!(indirect2(vec!(1)) == "[1]!".to_string()); } diff --git a/src/test/run-pass/traits-conditional-dispatch.rs b/src/test/run-pass/traits-conditional-dispatch.rs index 7e2b7ae0663..5af2d4ee806 100644 --- a/src/test/run-pass/traits-conditional-dispatch.rs +++ b/src/test/run-pass/traits-conditional-dispatch.rs @@ -35,5 +35,5 @@ fn main() { assert_eq!(get_it(&1_u32), 1_u32); assert_eq!(get_it(&1_u16), 1_u16); assert_eq!(get_it(&Some(1_u16)), Some(1_u16)); - assert_eq!(get_it(&box 1i), box 1i); + assert_eq!(get_it(&box 1), box 1); } diff --git a/src/test/run-pass/trivial-message.rs b/src/test/run-pass/trivial-message.rs index df8efb42e30..fd60c614638 100644 --- a/src/test/run-pass/trivial-message.rs +++ b/src/test/run-pass/trivial-message.rs @@ -17,7 +17,7 @@ use std::sync::mpsc::channel; pub fn main() { let (tx, rx) = channel(); - tx.send(42i); + tx.send(42); let r = rx.recv(); println!("{:?}", r); } diff --git a/src/test/run-pass/tuple-index-fat-types.rs b/src/test/run-pass/tuple-index-fat-types.rs index eccd841e357..924b861a911 100644 --- a/src/test/run-pass/tuple-index-fat-types.rs +++ b/src/test/run-pass/tuple-index-fat-types.rs @@ -11,11 +11,11 @@ struct Foo<'a>(&'a [int]); fn main() { - let x: &[int] = &[1i, 2, 3]; + let x: &[int] = &[1, 2, 3]; let y = (x,); assert_eq!(y.0, x); - let x: &[int] = &[1i, 2, 3]; + let x: &[int] = &[1, 2, 3]; let y = Foo(x); assert_eq!(y.0, x); } diff --git a/src/test/run-pass/tuple-index.rs b/src/test/run-pass/tuple-index.rs index 78e0cad4712..abdf6172779 100644 --- a/src/test/run-pass/tuple-index.rs +++ b/src/test/run-pass/tuple-index.rs @@ -24,7 +24,7 @@ fn main() { } assert_eq!(x.1, 0); - let mut x = (3i, 2i); + let mut x = (3, 2); assert_eq!(x.0, 3); assert_eq!(x.1, 2); x.0 += 5; diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index 3fcb04d6848..7d1fad5d281 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -33,12 +33,12 @@ pub fn main() { p_foo(r(10)); p_foo(box r(10)); - p_foo(box 10i); - p_foo(10i); + p_foo(box 10); + p_foo(10); - s_foo(box 10i); - s_foo(10i); + s_foo(box 10); + s_foo(10); - u_foo(box 10i); - u_foo(10i); + u_foo(box 10); + u_foo(10); } diff --git a/src/test/run-pass/typestate-cfg-nesting.rs b/src/test/run-pass/typestate-cfg-nesting.rs index f1e40cc3e58..37d06bf4f83 100644 --- a/src/test/run-pass/typestate-cfg-nesting.rs +++ b/src/test/run-pass/typestate-cfg-nesting.rs @@ -12,12 +12,12 @@ #![allow(unused_variable)] fn f() { - let x = 10i; let mut y = 11i; + let x = 10; let mut y = 11; if true { match x { _ => { y = x; } } } else { } } pub fn main() { - let x = 10i; - let mut y = 11i; + let x = 10; + let mut y = 11; if true { while false { y = x; } } else { } } diff --git a/src/test/run-pass/typestate-multi-decl.rs b/src/test/run-pass/typestate-multi-decl.rs index cbb0dcc8f2b..42910c47005 100644 --- a/src/test/run-pass/typestate-multi-decl.rs +++ b/src/test/run-pass/typestate-multi-decl.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let (x, y) = (10i, 20i); + let (x, y) = (10, 20); let z = x + y; assert!((z == 30)); } diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs index fdd85b71cd2..5bebc70ca54 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-bound.rs @@ -22,5 +22,5 @@ fn doit(val: T, f: &F) } pub fn main() { - doit(0i, &|&: x /*: int*/ | { x.to_int(); }); + doit(0, &|&: x /*: int*/ | { x.to_int(); }); } diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs index cce8cd64a14..a678c7a852f 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-from-expected-object-type.rs @@ -18,5 +18,5 @@ use std::num::ToPrimitive; fn doit(val: T, f: &Fn(T)) { f.call((val,)) } pub fn main() { - doit(0i, &|&: x /*: int*/ | { x.to_int(); }); + doit(0, &|&: x /*: int*/ | { x.to_int(); }); } diff --git a/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs b/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs index 8497bf7f987..6e0b3625a2e 100644 --- a/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures-infer-argument-types-with-bound-regions-from-expected-bound.rs @@ -22,5 +22,5 @@ fn doit(val: T, f: &F) } pub fn main() { - doit(0i, &|&: x /*: int*/ | { x.to_int(); }); + doit(0, &|&: x /*: int*/ | { x.to_int(); }); } diff --git a/src/test/run-pass/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures-prelude.rs index 915715727e8..f9fc5770a38 100644 --- a/src/test/run-pass/unboxed-closures-prelude.rs +++ b/src/test/run-pass/unboxed-closures-prelude.rs @@ -16,10 +16,10 @@ fn main() { let task: Box int> = box |&: x| x; - task.call((0i, )); + task.call((0, )); let mut task: Box int> = box |&mut: x| x; - task(0i); + task(0); call(|:x| x, 22); } diff --git a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs index 780a1e6cdf0..e4b35aada9f 100644 --- a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs +++ b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs @@ -12,6 +12,6 @@ fn main() { let onetime = |: x| x; - onetime(0i); + onetime(0); } diff --git a/src/test/run-pass/unique-assign-copy.rs b/src/test/run-pass/unique-assign-copy.rs index 9e3d9544d42..c19063fe464 100644 --- a/src/test/run-pass/unique-assign-copy.rs +++ b/src/test/run-pass/unique-assign-copy.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut i = box 1i; + let mut i = box 1; // Should be a copy let mut j; j = i.clone(); diff --git a/src/test/run-pass/unique-assign-drop.rs b/src/test/run-pass/unique-assign-drop.rs index 81c4b6ab7e5..241258f089c 100644 --- a/src/test/run-pass/unique-assign-drop.rs +++ b/src/test/run-pass/unique-assign-drop.rs @@ -13,8 +13,8 @@ #![feature(box_syntax)] pub fn main() { - let i = box 1i; - let mut j = box 2i; + let i = box 1; + let mut j = box 2; // Should drop the previous value of j j = i; assert_eq!(*j, 1); diff --git a/src/test/run-pass/unique-assign-generic.rs b/src/test/run-pass/unique-assign-generic.rs index 7c9bbd64171..c8abb080848 100644 --- a/src/test/run-pass/unique-assign-generic.rs +++ b/src/test/run-pass/unique-assign-generic.rs @@ -18,6 +18,6 @@ fn f(t: T) -> T { } pub fn main() { - let t = f(box 100i); - assert_eq!(t, box 100i); + let t = f(box 100); + assert_eq!(t, box 100); } diff --git a/src/test/run-pass/unique-assign.rs b/src/test/run-pass/unique-assign.rs index 199657fd995..cbcb6afb4c8 100644 --- a/src/test/run-pass/unique-assign.rs +++ b/src/test/run-pass/unique-assign.rs @@ -13,6 +13,6 @@ pub fn main() { let mut i; - i = box 1i; + i = box 1; assert_eq!(*i, 1); } diff --git a/src/test/run-pass/unique-autoderef-index.rs b/src/test/run-pass/unique-autoderef-index.rs index 1c7b4c534ed..30c4b2d7b56 100644 --- a/src/test/run-pass/unique-autoderef-index.rs +++ b/src/test/run-pass/unique-autoderef-index.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let i = box vec!(100i); - assert_eq!((*i)[0], 100i); + let i = box vec!(100); + assert_eq!((*i)[0], 100); } diff --git a/src/test/run-pass/unique-cmp.rs b/src/test/run-pass/unique-cmp.rs index dba4d8db849..a2962dc00d5 100644 --- a/src/test/run-pass/unique-cmp.rs +++ b/src/test/run-pass/unique-cmp.rs @@ -12,10 +12,10 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; - assert!(i == box 100i); - assert!(i < box 101i); - assert!(i <= box 100i); - assert!(i > box 99i); - assert!(i >= box 99i); + let i = box 100; + assert!(i == box 100); + assert!(i < box 101); + assert!(i <= box 100); + assert!(i > box 99); + assert!(i >= box 99); } diff --git a/src/test/run-pass/unique-create.rs b/src/test/run-pass/unique-create.rs index cec74d251b3..975f1e9da82 100644 --- a/src/test/run-pass/unique-create.rs +++ b/src/test/run-pass/unique-create.rs @@ -12,9 +12,9 @@ #![feature(box_syntax)] pub fn main() { - box 100i; + box 100; } fn vec() { - vec!(0i); + vec!(0); } diff --git a/src/test/run-pass/unique-decl-init-copy.rs b/src/test/run-pass/unique-decl-init-copy.rs index d0ad03b773c..3af38784add 100644 --- a/src/test/run-pass/unique-decl-init-copy.rs +++ b/src/test/run-pass/unique-decl-init-copy.rs @@ -12,11 +12,11 @@ #![feature(box_syntax)] pub fn main() { - let mut i = box 1i; + let mut i = box 1; // Should be a copy let mut j = i.clone(); - *i = 2i; - *j = 3i; - assert_eq!(*i, 2i); - assert_eq!(*j, 3i); + *i = 2; + *j = 3; + assert_eq!(*i, 2); + assert_eq!(*j, 3); } diff --git a/src/test/run-pass/unique-decl-init.rs b/src/test/run-pass/unique-decl-init.rs index d7c19eb6358..c9192748809 100644 --- a/src/test/run-pass/unique-decl-init.rs +++ b/src/test/run-pass/unique-decl-init.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let i = box 1i; + let i = box 1; let j = i; assert_eq!(*j, 1); } diff --git a/src/test/run-pass/unique-decl-move.rs b/src/test/run-pass/unique-decl-move.rs index 0acdc8f3b80..96dd9f51fbe 100644 --- a/src/test/run-pass/unique-decl-move.rs +++ b/src/test/run-pass/unique-decl-move.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; + let i = box 100; let j = i; assert_eq!(*j, 100); } diff --git a/src/test/run-pass/unique-deref.rs b/src/test/run-pass/unique-deref.rs index 752ea830aa5..41d3b87a003 100644 --- a/src/test/run-pass/unique-deref.rs +++ b/src/test/run-pass/unique-deref.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; + let i = box 100; assert_eq!(*i, 100); } diff --git a/src/test/run-pass/unique-drop-complex.rs b/src/test/run-pass/unique-drop-complex.rs index ec2c9f8c666..c5a0a4df275 100644 --- a/src/test/run-pass/unique-drop-complex.rs +++ b/src/test/run-pass/unique-drop-complex.rs @@ -12,5 +12,5 @@ #![feature(box_syntax)] pub fn main() { - let _x = box vec!(0i,0,0,0,0); + let _x = box vec!(0,0,0,0,0); } diff --git a/src/test/run-pass/unique-fn-arg-move.rs b/src/test/run-pass/unique-fn-arg-move.rs index 0e47d39e55f..1b3f7e72a4d 100644 --- a/src/test/run-pass/unique-fn-arg-move.rs +++ b/src/test/run-pass/unique-fn-arg-move.rs @@ -16,6 +16,6 @@ fn f(i: Box) { } pub fn main() { - let i = box 100i; + let i = box 100; f(i); } diff --git a/src/test/run-pass/unique-in-vec-copy.rs b/src/test/run-pass/unique-in-vec-copy.rs index 4620815e74e..3bde79fdce0 100644 --- a/src/test/run-pass/unique-in-vec-copy.rs +++ b/src/test/run-pass/unique-in-vec-copy.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut a = vec!(box 10i); + let mut a = vec!(box 10); let b = a.clone(); assert_eq!(*a[0], 10); diff --git a/src/test/run-pass/unique-in-vec.rs b/src/test/run-pass/unique-in-vec.rs index 389ca2c18b1..05b0c7244de 100644 --- a/src/test/run-pass/unique-in-vec.rs +++ b/src/test/run-pass/unique-in-vec.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let vect = vec!(box 100i); + let vect = vec!(box 100); assert!(vect[0] == box 100); } diff --git a/src/test/run-pass/unique-init.rs b/src/test/run-pass/unique-init.rs index b36d08364a2..d3f13f1609f 100644 --- a/src/test/run-pass/unique-init.rs +++ b/src/test/run-pass/unique-init.rs @@ -12,5 +12,5 @@ #![feature(box_syntax)] pub fn main() { - let _i = box 100i; + let _i = box 100; } diff --git a/src/test/run-pass/unique-kinds.rs b/src/test/run-pass/unique-kinds.rs index 56f7a3f7990..4c93c379b48 100644 --- a/src/test/run-pass/unique-kinds.rs +++ b/src/test/run-pass/unique-kinds.rs @@ -23,11 +23,11 @@ fn sendable() { assert!(i != j); } - let i = box 100i; - let j = box 100i; + let i = box 100; + let j = box 100; f(i, j); - let i = box 100i; - let j = box 101i; + let i = box 100; + let j = box 101; g(i, j); } @@ -41,11 +41,11 @@ fn copyable() { assert!(i != j); } - let i = box 100i; - let j = box 100i; + let i = box 100; + let j = box 100; f(i, j); - let i = box 100i; - let j = box 101i; + let i = box 100; + let j = box 101; g(i, j); } @@ -59,11 +59,11 @@ fn noncopyable() { assert!(i != j); } - let i = box 100i; - let j = box 100i; + let i = box 100; + let j = box 100; f(i, j); - let i = box 100i; - let j = box 101i; + let i = box 100; + let j = box 101; g(i, j); } diff --git a/src/test/run-pass/unique-log.rs b/src/test/run-pass/unique-log.rs index 05579796dab..4b21b949f88 100644 --- a/src/test/run-pass/unique-log.rs +++ b/src/test/run-pass/unique-log.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; + let i = box 100; println!("{}", i); } diff --git a/src/test/run-pass/unique-move-drop.rs b/src/test/run-pass/unique-move-drop.rs index 1388c6c5d2b..705b9d6e92c 100644 --- a/src/test/run-pass/unique-move-drop.rs +++ b/src/test/run-pass/unique-move-drop.rs @@ -13,8 +13,8 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; - let j = box 200i; + let i = box 100; + let j = box 200; let j = i; assert_eq!(*j, 100); } diff --git a/src/test/run-pass/unique-move-temp.rs b/src/test/run-pass/unique-move-temp.rs index af82d3e14ea..b6c24f5be28 100644 --- a/src/test/run-pass/unique-move-temp.rs +++ b/src/test/run-pass/unique-move-temp.rs @@ -13,6 +13,6 @@ pub fn main() { let mut i; - i = box 100i; + i = box 100; assert_eq!(*i, 100); } diff --git a/src/test/run-pass/unique-move.rs b/src/test/run-pass/unique-move.rs index 791c4799bf0..ed13bf6a5c4 100644 --- a/src/test/run-pass/unique-move.rs +++ b/src/test/run-pass/unique-move.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100i; + let i = box 100; let mut j; j = i; assert_eq!(*j, 100); diff --git a/src/test/run-pass/unique-mutable.rs b/src/test/run-pass/unique-mutable.rs index c4f860d930b..403b8bf18b8 100644 --- a/src/test/run-pass/unique-mutable.rs +++ b/src/test/run-pass/unique-mutable.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut i = box 0i; + let mut i = box 0; *i = 1; assert_eq!(*i, 1); } diff --git a/src/test/run-pass/unique-send.rs b/src/test/run-pass/unique-send.rs index 13728585455..2a462e9cdd8 100644 --- a/src/test/run-pass/unique-send.rs +++ b/src/test/run-pass/unique-send.rs @@ -15,7 +15,7 @@ use std::sync::mpsc::channel; pub fn main() { let (tx, rx) = channel(); - tx.send(box 100i).unwrap(); + tx.send(box 100).unwrap(); let v = rx.recv().unwrap(); - assert_eq!(v, box 100i); + assert_eq!(v, box 100); } diff --git a/src/test/run-pass/unique-swap.rs b/src/test/run-pass/unique-swap.rs index cd3b59a69ba..2adb9c22f60 100644 --- a/src/test/run-pass/unique-swap.rs +++ b/src/test/run-pass/unique-swap.rs @@ -14,9 +14,9 @@ use std::mem::swap; pub fn main() { - let mut i = box 100i; - let mut j = box 200i; + let mut i = box 100; + let mut j = box 200; swap(&mut i, &mut j); - assert_eq!(i, box 200i); - assert_eq!(j, box 100i); + assert_eq!(i, box 200); + assert_eq!(j, box 100); } diff --git a/src/test/run-pass/unreachable-code.rs b/src/test/run-pass/unreachable-code.rs index a9ac78c5d76..a28dc2c1f15 100644 --- a/src/test/run-pass/unreachable-code.rs +++ b/src/test/run-pass/unreachable-code.rs @@ -24,7 +24,7 @@ fn call_id_2() { id(true) && id(return); } fn call_id_3() { id(return) && id(return); } fn ret_guard() { - match 2i { + match 2 { x if (return) => { x; } _ => {} } diff --git a/src/test/run-pass/unused-move-capture.rs b/src/test/run-pass/unused-move-capture.rs index 27945f46920..a2d1b8780aa 100644 --- a/src/test/run-pass/unused-move-capture.rs +++ b/src/test/run-pass/unused-move-capture.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let _x = box 1i; + let _x = box 1; let lam_move = |&:| {}; lam_move(); } diff --git a/src/test/run-pass/unused-move.rs b/src/test/run-pass/unused-move.rs index 22201c7d83f..d053b03a2ca 100644 --- a/src/test/run-pass/unused-move.rs +++ b/src/test/run-pass/unused-move.rs @@ -18,6 +18,6 @@ pub fn main() { - let y = box 1i; + let y = box 1; y; } diff --git a/src/test/run-pass/unwind-unique.rs b/src/test/run-pass/unwind-unique.rs index 74802c156a2..ea52802d245 100644 --- a/src/test/run-pass/unwind-unique.rs +++ b/src/test/run-pass/unwind-unique.rs @@ -14,7 +14,7 @@ use std::thread::Thread; fn f() { - let _a = box 0i; + let _a = box 0; panic!(); } diff --git a/src/test/run-pass/use-uninit-match.rs b/src/test/run-pass/use-uninit-match.rs index 3f23d714c0f..efa6a2c5834 100644 --- a/src/test/run-pass/use-uninit-match.rs +++ b/src/test/run-pass/use-uninit-match.rs @@ -21,4 +21,4 @@ fn foo(o: myoption) -> int { enum myoption { none, some(T), } -pub fn main() { println!("{}", 5i); } +pub fn main() { println!("{}", 5); } diff --git a/src/test/run-pass/use-uninit-match2.rs b/src/test/run-pass/use-uninit-match2.rs index de5b32dd176..f2b487b7034 100644 --- a/src/test/run-pass/use-uninit-match2.rs +++ b/src/test/run-pass/use-uninit-match2.rs @@ -21,4 +21,4 @@ fn foo(o: myoption) -> int { enum myoption { none, some(T), } -pub fn main() { println!("{}", 5i); } +pub fn main() { println!("{}", 5); } diff --git a/src/test/run-pass/utf8_idents.rs b/src/test/run-pass/utf8_idents.rs index c99c394969c..0e6f20358aa 100644 --- a/src/test/run-pass/utf8_idents.rs +++ b/src/test/run-pass/utf8_idents.rs @@ -26,25 +26,25 @@ fn საჭმელად_გემრიელი_სადილი() -> int // Lunch in several languages. - let ランチ = 10i; - let 午餐 = 10i; + let ランチ = 10; + let 午餐 = 10; - let ארוחת_צהריי = 10i; + let ארוחת_צהריי = 10; let غداء = 10u; - let լանչ = 10i; - let обед = 10i; - let абед = 10i; - let μεσημεριανό = 10i; - let hádegismatur = 10i; - let ручек = 10i; + let լանչ = 10; + let обед = 10; + let абед = 10; + let μεσημεριανό = 10; + let hádegismatur = 10; + let ручек = 10; - let ăn_trưa = 10i; - let อาหารกลางวัน = 10i; + let ăn_trưa = 10; + let อาหารกลางวัน = 10; // Lunchy arithmetic, mm. assert_eq!(hádegismatur * ручек * обед, 1000); - assert_eq!(10i, ארוחת_צהריי); + assert_eq!(10, ארוחת_צהריי); assert_eq!(ランチ + 午餐 + μεσημεριανό, 30); assert_eq!(ăn_trưa + อาหารกลางวัน, 20); return (абед + լանչ) >> غداء; diff --git a/src/test/run-pass/variadic-ffi.rs b/src/test/run-pass/variadic-ffi.rs index 9600a242ca1..a729fedb271 100644 --- a/src/test/run-pass/variadic-ffi.rs +++ b/src/test/run-pass/variadic-ffi.rs @@ -35,7 +35,7 @@ pub fn main() { // Call with variable number of arguments let c = CString::from_slice(b"%d %f %c %s\n"); check("42 42.500000 a %d %f %c %s\n\n", |s| { - sprintf(s, c.as_ptr(), 42i, 42.5f64, 'a' as c_int, c.as_ptr()); + sprintf(s, c.as_ptr(), 42, 42.5f64, 'a' as c_int, c.as_ptr()); }); // Make a function pointer @@ -50,7 +50,7 @@ pub fn main() { // Call with variable number of arguments let c = CString::from_slice(b"%d %f %c %s\n"); check("42 42.500000 a %d %f %c %s\n\n", |s| { - sprintf(s, c.as_ptr(), 42i, 42.5f64, 'a' as c_int, c.as_ptr()); + sprintf(s, c.as_ptr(), 42, 42.5f64, 'a' as c_int, c.as_ptr()); }); } diff --git a/src/test/run-pass/vec-growth.rs b/src/test/run-pass/vec-growth.rs index d5e5f94d261..b8626b9c8a9 100644 --- a/src/test/run-pass/vec-growth.rs +++ b/src/test/run-pass/vec-growth.rs @@ -10,11 +10,11 @@ pub fn main() { - let mut v = vec!(1i); - v.push(2i); - v.push(3i); - v.push(4i); - v.push(5i); + let mut v = vec!(1); + v.push(2); + v.push(3); + v.push(4); + v.push(5); assert_eq!(v[0], 1); assert_eq!(v[1], 2); assert_eq!(v[2], 3); diff --git a/src/test/run-pass/vec-macro-with-brackets.rs b/src/test/run-pass/vec-macro-with-brackets.rs index a263501f8fe..5d1f43fb230 100644 --- a/src/test/run-pass/vec-macro-with-brackets.rs +++ b/src/test/run-pass/vec-macro-with-brackets.rs @@ -17,5 +17,5 @@ macro_rules! vec [ ]; pub fn main() { - let my_vec = vec![1i, 2, 3, 4, 5]; + let my_vec = vec![1, 2, 3, 4, 5]; } diff --git a/src/test/run-pass/vec-macro-with-trailing-comma.rs b/src/test/run-pass/vec-macro-with-trailing-comma.rs index 80c2a5fe83e..07033d60497 100644 --- a/src/test/run-pass/vec-macro-with-trailing-comma.rs +++ b/src/test/run-pass/vec-macro-with-trailing-comma.rs @@ -10,6 +10,6 @@ pub fn main() { - assert_eq!(vec!(1i), vec!(1i,)); - assert_eq!(vec!(1i, 2, 3), vec!(1i, 2, 3,)); + assert_eq!(vec!(1), vec!(1,)); + assert_eq!(vec!(1, 2, 3), vec!(1, 2, 3,)); } diff --git a/src/test/run-pass/vec-matching-autoslice.rs b/src/test/run-pass/vec-matching-autoslice.rs index 6476f734ae6..4ed73dc2301 100644 --- a/src/test/run-pass/vec-matching-autoslice.rs +++ b/src/test/run-pass/vec-matching-autoslice.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = [1i, 2, 3]; + let x = [1, 2, 3]; match x { [2, _, _] => panic!(), [1, a, b] => { @@ -18,7 +18,7 @@ pub fn main() { [_, _, _] => panic!(), } - let y = ([(1i, true), (2i, false)], 0.5f64); + let y = ([(1, true), (2, false)], 0.5f64); match y { ([(1, a), (b, false)], _) => { assert_eq!(a, true); diff --git a/src/test/run-pass/vec-matching-fixed.rs b/src/test/run-pass/vec-matching-fixed.rs index a1a14823ff5..6ef1dc4ea26 100644 --- a/src/test/run-pass/vec-matching-fixed.rs +++ b/src/test/run-pass/vec-matching-fixed.rs @@ -11,7 +11,7 @@ #![feature(advanced_slice_patterns)] fn a() { - let x = [1i, 2, 3]; + let x = [1, 2, 3]; match x { [1, 2, 4] => unreachable!(), [0, 2, 3, ..] => unreachable!(), diff --git a/src/test/run-pass/vec-matching-fold.rs b/src/test/run-pass/vec-matching-fold.rs index 57660183333..e72170cb730 100644 --- a/src/test/run-pass/vec-matching-fold.rs +++ b/src/test/run-pass/vec-matching-fold.rs @@ -39,11 +39,11 @@ fn foldr(values: &[T], } pub fn main() { - let x = &[1i, 2, 3, 4, 5]; + let x = &[1, 2, 3, 4, 5]; - let product = foldl(x, 1i, |a, b| a * *b); + let product = foldl(x, 1, |a, b| a * *b); assert_eq!(product, 120); - let sum = foldr(x, 0i, |a, b| *a + b); + let sum = foldr(x, 0, |a, b| *a + b); assert_eq!(sum, 15); } diff --git a/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs b/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs index a140399447b..64309906156 100644 --- a/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs +++ b/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let x = &[1i, 2, 3, 4, 5]; + let x = &[1, 2, 3, 4, 5]; let x: &[int] = &[1, 2, 3, 4, 5]; if !x.is_empty() { let el = match x { diff --git a/src/test/run-pass/vec-matching.rs b/src/test/run-pass/vec-matching.rs index 77226df7fa2..8dcf4612f47 100644 --- a/src/test/run-pass/vec-matching.rs +++ b/src/test/run-pass/vec-matching.rs @@ -11,7 +11,7 @@ #![feature(advanced_slice_patterns)] fn a() { - let x = [1i]; + let x = [1]; match x { [a] => { assert_eq!(a, 1); @@ -20,7 +20,7 @@ fn a() { } fn b() { - let x = [1i, 2, 3]; + let x = [1, 2, 3]; match x { [a, b, c..] => { assert_eq!(a, 1); @@ -55,7 +55,7 @@ fn b() { } fn c() { - let x = [1i]; + let x = [1]; match x { [2, ..] => panic!(), [..] => () @@ -63,18 +63,18 @@ fn c() { } fn d() { - let x = [1i, 2, 3]; + let x = [1, 2, 3]; let branch = match x { - [1, 1, ..] => 0i, - [1, 2, 3, ..] => 1i, - [1, 2, ..] => 2i, + [1, 1, ..] => 0, + [1, 2, 3, ..] => 1, + [1, 2, ..] => 2, _ => 3 }; assert_eq!(branch, 1); } fn e() { - let x: &[int] = &[1i, 2, 3]; + let x: &[int] = &[1, 2, 3]; match x { [1, 2] => (), [..] => () diff --git a/src/test/run-pass/vec-push.rs b/src/test/run-pass/vec-push.rs index fe0f92a0c11..33f01c5bd41 100644 --- a/src/test/run-pass/vec-push.rs +++ b/src/test/run-pass/vec-push.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub fn main() { let mut v = vec!(1i, 2, 3); v.push(1); } +pub fn main() { let mut v = vec!(1, 2, 3); v.push(1); } diff --git a/src/test/run-pass/vec-repeat-with-cast.rs b/src/test/run-pass/vec-repeat-with-cast.rs index 97a443cb3b8..22ca6c37a8e 100644 --- a/src/test/run-pass/vec-repeat-with-cast.rs +++ b/src/test/run-pass/vec-repeat-with-cast.rs @@ -8,4 +8,4 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub fn main() { let _a = [0i; 1 as uint]; } +pub fn main() { let _a = [0; 1 as uint]; } diff --git a/src/test/run-pass/vec-slice.rs b/src/test/run-pass/vec-slice.rs index 374913e3cfd..5375e54e27f 100644 --- a/src/test/run-pass/vec-slice.rs +++ b/src/test/run-pass/vec-slice.rs @@ -9,7 +9,7 @@ // except according to those terms. pub fn main() { - let v = vec!(1i,2,3,4,5); + let v = vec![1,2,3,4,5]; let v2 = &v[1..3]; assert_eq!(v2[0], 2); assert_eq!(v2[1], 3); diff --git a/src/test/run-pass/vec-to_str.rs b/src/test/run-pass/vec-to_str.rs index 31f26126242..5d132b2a749 100644 --- a/src/test/run-pass/vec-to_str.rs +++ b/src/test/run-pass/vec-to_str.rs @@ -9,9 +9,9 @@ // except according to those terms. pub fn main() { - assert_eq!(format!("{:?}", vec!(0i, 1)), "[0, 1]".to_string()); + assert_eq!(format!("{:?}", vec!(0, 1)), "[0, 1]".to_string()); - let foo = vec!(3i, 4); + let foo = vec!(3, 4); let bar: &[int] = &[4, 5]; assert_eq!(format!("{:?}", foo), "[3, 4]"); diff --git a/src/test/run-pass/vector-sort-panic-safe.rs b/src/test/run-pass/vector-sort-panic-safe.rs index 250bafc712d..aaefbc42d70 100644 --- a/src/test/run-pass/vector-sort-panic-safe.rs +++ b/src/test/run-pass/vector-sort-panic-safe.rs @@ -12,8 +12,8 @@ use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; use std::rand::{thread_rng, Rng, Rand}; use std::thread::Thread; -const REPEATS: uint = 5; -const MAX_LEN: uint = 32; +const REPEATS: usize = 5; +const MAX_LEN: usize = 32; static drop_counts: [AtomicUsize; MAX_LEN] = // FIXME #5244: AtomicUsize is not Copy. [ @@ -33,7 +33,7 @@ static drop_counts: [AtomicUsize; MAX_LEN] = static creation_count: AtomicUsize = ATOMIC_USIZE_INIT; #[derive(Clone, PartialEq, PartialOrd, Eq, Ord)] -struct DropCounter { x: uint, creation_id: uint } +struct DropCounter { x: usize, creation_id: usize } impl Rand for DropCounter { fn rand(rng: &mut R) -> DropCounter { @@ -53,7 +53,7 @@ impl Drop for DropCounter { } pub fn main() { - assert!(MAX_LEN <= std::uint::BITS); + assert!(MAX_LEN <= std::usize::BITS); // len can't go above 64. for len in 2..MAX_LEN { for _ in 0..REPEATS { @@ -67,11 +67,11 @@ pub fn main() { // work out the total number of comparisons required to sort // this array... - let mut count = 0; + let mut count = 0us; main.clone().as_mut_slice().sort_by(|a, b| { count += 1; a.cmp(b) }); // ... and then panic on each and every single one. - for panic_countdown in 0i..count { + for panic_countdown in 0..count { // refresh the counters. for c in drop_counts.iter() { c.store(0, Ordering::Relaxed); diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index c8ed1a26105..4080796b7a7 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -36,7 +36,7 @@ fn zombiejesus() { while (return) { if (return) { match (return) { - 1i => { + 1 => { if (return) { return } else { @@ -65,13 +65,13 @@ fn canttouchthis() -> uint { fn p() -> bool { true } let _a = (assert!((true)) == (assert!(p()))); let _c = (assert!((p())) == ()); - let _b: bool = (println!("{}", 0i) == (return 0u)); + let _b: bool = (println!("{}", 0) == (return 0u)); } fn angrydome() { loop { if break { } } - let mut i = 0i; - loop { i += 1; if i == 1 { match (continue) { 1i => { }, _ => panic!("wat") } } + let mut i = 0; + loop { i += 1; if i == 1 { match (continue) { 1 => { }, _ => panic!("wat") } } break; } } diff --git a/src/test/run-pass/where-clause-region-outlives.rs b/src/test/run-pass/where-clause-region-outlives.rs index 1ecb4b6c2dc..aa39325277e 100644 --- a/src/test/run-pass/where-clause-region-outlives.rs +++ b/src/test/run-pass/where-clause-region-outlives.rs @@ -11,7 +11,7 @@ struct A<'a, 'b> where 'a : 'b { x: &'a int, y: &'b int } fn main() { - let x = 1i; - let y = 1i; + let x = 1; + let y = 1; let a = A { x: &x, y: &y }; } diff --git a/src/test/run-pass/where-clauses-cross-crate.rs b/src/test/run-pass/where-clauses-cross-crate.rs index 648f646b637..b822abd6732 100644 --- a/src/test/run-pass/where-clauses-cross-crate.rs +++ b/src/test/run-pass/where-clauses-cross-crate.rs @@ -15,9 +15,9 @@ extern crate where_clauses_xc; use where_clauses_xc::{Equal, equal}; fn main() { - println!("{}", equal(&1i, &2i)); - println!("{}", equal(&1i, &1i)); + println!("{}", equal(&1, &2)); + println!("{}", equal(&1, &1)); println!("{}", "hello".equal(&"hello")); - println!("{}", "hello".equals::(&1i, &1i, &"foo", &"bar")); + println!("{}", "hello".equals::(&1, &1, &"foo", &"bar")); } diff --git a/src/test/run-pass/where-clauses-lifetimes.rs b/src/test/run-pass/where-clauses-lifetimes.rs index 237c83c8aa2..e3ea7cd80e7 100644 --- a/src/test/run-pass/where-clauses-lifetimes.rs +++ b/src/test/run-pass/where-clauses-lifetimes.rs @@ -11,5 +11,5 @@ fn foo<'a, I>(mut it: I) where I: Iterator {} fn main() { - foo([1i, 2].iter()); + foo([1, 2].iter()); } diff --git a/src/test/run-pass/where-clauses-method.rs b/src/test/run-pass/where-clauses-method.rs index 2b87bcd4b39..29efe727276 100644 --- a/src/test/run-pass/where-clauses-method.rs +++ b/src/test/run-pass/where-clauses-method.rs @@ -22,8 +22,8 @@ impl Foo { } fn main() { - let x = Foo { value: 1i }; - let y = Foo { value: 2i }; + let x = Foo { value: 1 }; + let y = Foo { value: 2 }; println!("{}", x.equals(&x)); println!("{}", x.equals(&y)); } diff --git a/src/test/run-pass/where-clauses.rs b/src/test/run-pass/where-clauses.rs index 807d95691f4..92bc7edf285 100644 --- a/src/test/run-pass/where-clauses.rs +++ b/src/test/run-pass/where-clauses.rs @@ -29,9 +29,9 @@ fn equal(x: &T, y: &T) -> bool where T: Eq { } fn main() { - println!("{}", equal(&1i, &2i)); - println!("{}", equal(&1i, &1i)); + println!("{}", equal(&1, &2)); + println!("{}", equal(&1, &1)); println!("{}", "hello".equal(&"hello")); - println!("{}", "hello".equals::(&1i, &1i, &"foo", &"bar")); + println!("{}", "hello".equals::(&1, &1, &"foo", &"bar")); } diff --git a/src/test/run-pass/while-cont.rs b/src/test/run-pass/while-cont.rs index 50feb3ef4e1..3e1a232115f 100644 --- a/src/test/run-pass/while-cont.rs +++ b/src/test/run-pass/while-cont.rs @@ -10,7 +10,7 @@ // Issue #825: Should recheck the loop condition after continuing pub fn main() { - let mut i = 1i; + let mut i = 1; while i > 0 { assert!((i > 0)); println!("{}", i); diff --git a/src/test/run-pass/while-label.rs b/src/test/run-pass/while-label.rs index 41712f7c64d..4a3cd115d20 100644 --- a/src/test/run-pass/while-label.rs +++ b/src/test/run-pass/while-label.rs @@ -10,8 +10,8 @@ pub fn main() { - let mut i = 100i; - 'w: while 1i + 1 == 2 { + let mut i = 100; + 'w: while 1 + 1 == 2 { i -= 1; if i == 95 { break 'w; diff --git a/src/test/run-pass/while-let.rs b/src/test/run-pass/while-let.rs index 94a45817ee5..1780445fb3b 100644 --- a/src/test/run-pass/while-let.rs +++ b/src/test/run-pass/while-let.rs @@ -11,16 +11,16 @@ use std::collections::BinaryHeap; fn make_pq() -> BinaryHeap { - BinaryHeap::from_vec(vec![1i,2,3]) + BinaryHeap::from_vec(vec![1,2,3]) } pub fn main() { let mut pq = make_pq(); - let mut sum = 0i; + let mut sum = 0; while let Some(x) = pq.pop() { sum += x; } - assert_eq!(sum, 6i); + assert_eq!(sum, 6); pq = make_pq(); sum = 0; @@ -30,7 +30,7 @@ pub fn main() { break 'a; } } - assert_eq!(sum, 5i); + assert_eq!(sum, 5); pq = make_pq(); sum = 0; @@ -40,7 +40,7 @@ pub fn main() { } sum += x; } - assert_eq!(sum, 3i); + assert_eq!(sum, 3); let mut pq1 = make_pq(); sum = 0; @@ -50,5 +50,5 @@ pub fn main() { sum += x * y; } } - assert_eq!(sum, 6i + 12 + 18); + assert_eq!(sum, 6 + 12 + 18); } -- cgit 1.4.1-3-g733a5 From f9865eac185ef2af4df661442d5d3bd2698b725f Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 10 Jan 2015 21:50:07 -0500 Subject: fix fallout --- src/doc/trpl/unsafe.md | 4 ++++ src/libcollections/bit.rs | 4 +++- src/libcollections/btree/node.rs | 8 ++++---- src/libcollections/lib.rs | 4 ++++ src/libcollections/ring_buf.rs | 10 +++++++--- src/libcollections/slice.rs | 2 +- src/libcollections/str.rs | 2 +- src/libcollections/vec.rs | 10 ++++++---- src/libcore/iter.rs | 18 +++++++++--------- src/libcore/lib.rs | 4 ++++ src/libcore/num/mod.rs | 4 ++-- src/librand/lib.rs | 2 ++ src/librustc/lib.rs | 3 +++ src/librustc/middle/dataflow.rs | 4 +++- src/librustc_trans/lib.rs | 3 +++ src/librustc_typeck/lib.rs | 3 +++ src/librustdoc/lib.rs | 3 +++ src/libserialize/collection_impls.rs | 4 +++- src/libstd/ascii.rs | 5 ++++- src/libstd/collections/hash/table.rs | 4 ++-- src/libstd/lib.rs | 5 +++++ src/libstd/path/windows.rs | 2 +- src/libstd/rand/os.rs | 4 +++- src/libstd/sync/mpsc/mod.rs | 8 ++++++-- src/libstd/sync/mpsc/mpsc_queue.rs | 4 +++- src/libsyntax/fold.rs | 12 ++++++++---- src/libsyntax/lib.rs | 3 +++ src/libtest/lib.rs | 3 +++ src/libunicode/lib.rs | 3 +++ src/test/bench/shootout-mandelbrot.rs | 8 ++++++-- src/test/bench/shootout-meteor.rs | 8 ++++++-- 31 files changed, 118 insertions(+), 43 deletions(-) (limited to 'src/libstd') diff --git a/src/doc/trpl/unsafe.md b/src/doc/trpl/unsafe.md index 3acd1eefe89..2bd86fa987f 100644 --- a/src/doc/trpl/unsafe.md +++ b/src/doc/trpl/unsafe.md @@ -576,6 +576,10 @@ extern fn panic_fmt(args: &core::fmt::Arguments, #[lang = "eh_personality"] extern fn eh_personality() {} # #[start] fn start(argc: isize, argv: *const *const u8) -> isize { 0 } # fn main() {} +# mod std { // for-loops +# pub use core::iter; +# pub use core::option; +# } ``` Note that there is one extra lang item here which differs from the examples diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index d676cfca929..99172dcdef3 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -104,7 +104,9 @@ type MatchWords<'a> = Chain>, Skip u8 { let mut result = 0; - for i in 0..u8::BITS { + // FIXME(#21245) use a for loop + let mut iter = 0..u8::BITS; + while let Some(i) = iter.next() { result |= ((byte >> i) & 1) << (u8::BITS - 1 - i); } result diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs index ea167348a64..8d6f06b25c5 100644 --- a/src/libcollections/btree/node.rs +++ b/src/libcollections/btree/node.rs @@ -271,7 +271,7 @@ impl DoubleEndedIterator for RawItems { #[unsafe_destructor] impl Drop for RawItems { fn drop(&mut self) { - for _ in *self {} + for _ in self.by_ref() {} } } @@ -1374,9 +1374,9 @@ impl Drop for MoveTraversalImpl { fn drop(&mut self) { // We need to cleanup the stored values manually, as the RawItems destructor would run // after our deallocation. - for _ in self.keys {} - for _ in self.vals {} - for _ in self.edges {} + for _ in self.keys.by_ref() {} + for _ in self.vals.by_ref() {} + for _ in self.edges.by_ref() {} let (alignment, size) = calculate_allocation_generic::(self.capacity, self.is_leaf); diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 82b92d26d28..f28262dc0fe 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -34,6 +34,8 @@ #![feature(unicode)] #![feature(hash)] #![cfg_attr(test, feature(test))] +// NOTE(stage0): remove after a snapshot +#![cfg_attr(not(stage0), allow(unused_mut))] #[macro_use] extern crate core; @@ -114,6 +116,8 @@ mod std { pub use core::marker; // derive(Copy) pub use core::hash; // derive(Hash) pub use core::ops; // RangeFull + // for-loops + pub use core::iter; } #[cfg(test)] diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index 5b5e3be12e3..a9b31da8250 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -1510,7 +1510,7 @@ pub struct Drain<'a, T: 'a> { #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: 'a> Drop for Drain<'a, T> { fn drop(&mut self) { - for _ in *self {} + for _ in self.by_ref() {} self.inner.head = 0; self.inner.tail = 0; } @@ -1793,7 +1793,9 @@ mod tests { fn bench_push_back_100(b: &mut test::Bencher) { let mut deq = RingBuf::with_capacity(101); b.iter(|| { - for i in 0i..100 { + // FIXME(#21245) use a for loop + let mut iter = 0i..100; + while let Some(i) = iter.next() { deq.push_back(i); } deq.head = 0; @@ -1805,7 +1807,9 @@ mod tests { fn bench_push_front_100(b: &mut test::Bencher) { let mut deq = RingBuf::with_capacity(101); b.iter(|| { - for i in 0i..100 { + // FIXME(#21245) use a for loop + let mut iter = 0i..100; + while let Some(i) = iter.next() { deq.push_front(i); } deq.head = 0; diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 56d969b8946..57ee4704a9e 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1958,7 +1958,7 @@ mod tests { let mut amt = 0; let mut it = v.permutations(); let (min_size, max_opt) = it.size_hint(); - for _perm in it { + for _perm in it.by_ref() { amt += 1; } assert_eq!(amt, it.swaps.swaps_made); diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 35591a5e9ef..bbed943fc70 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -279,7 +279,7 @@ impl<'a> Iterator for Recompositions<'a> { loop { match self.state { Composing => { - for ch in self.iter { + for ch in self.iter.by_ref() { let ch_class = unicode::char::canonical_combining_class(ch); if self.composee.is_none() { if ch_class != 0 { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index ac6d7936f28..4ea8267135f 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1567,7 +1567,9 @@ impl Drop for Vec { // zeroed (when moving out, because of #[unsafe_no_drop_flag]). if self.cap != 0 { unsafe { - for x in self.iter() { + // FIXME(#21245) use a for loop + let mut iter = self.iter(); + while let Some(x) = iter.next() { ptr::read(x); } dealloc(*self.ptr, self.cap) @@ -1648,7 +1650,7 @@ impl IntoIter { #[unstable(feature = "collections")] pub fn into_inner(mut self) -> Vec { unsafe { - for _x in self { } + for _x in self.by_ref() { } let IntoIter { allocation, cap, ptr: _ptr, end: _end } = self; mem::forget(self); Vec { ptr: NonZero::new(allocation), cap: cap, len: 0 } @@ -1726,7 +1728,7 @@ impl Drop for IntoIter { fn drop(&mut self) { // destroy the remaining elements if self.cap != 0 { - for _x in *self {} + for _x in self.by_ref() {} unsafe { dealloc(self.allocation, self.cap); } @@ -1816,7 +1818,7 @@ impl<'a, T> Drop for Drain<'a, T> { // so we can use #[unsafe_no_drop_flag]. // destroy the remaining elements - for _x in *self {} + for _x in self.by_ref() {} } } diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index f9c6e0758e6..7847ed13ca9 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -195,7 +195,7 @@ pub trait IteratorExt: Iterator + Sized { #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn nth(&mut self, mut n: usize) -> Option { - for x in *self { + for x in self.by_ref() { if n == 0 { return Some(x) } n -= 1; } @@ -492,7 +492,7 @@ pub trait IteratorExt: Iterator + Sized { /// fn process>(it: U) -> isize { /// let mut it = it.fuse(); /// let mut sum = 0; - /// for x in it { + /// for x in it.by_ref() { /// if x > 5 { /// break; /// } @@ -660,7 +660,7 @@ pub trait IteratorExt: Iterator + Sized { #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn any(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool { - for x in *self { if f(x) { return true; } } + for x in self.by_ref() { if f(x) { return true; } } false } @@ -680,7 +680,7 @@ pub trait IteratorExt: Iterator + Sized { fn find

(&mut self, mut predicate: P) -> Option where P: FnMut(&Self::Item) -> bool, { - for x in *self { + for x in self.by_ref() { if predicate(&x) { return Some(x) } } None @@ -703,7 +703,7 @@ pub trait IteratorExt: Iterator + Sized { P: FnMut(Self::Item) -> bool, { let mut i = 0; - for x in *self { + for x in self.by_ref() { if predicate(x) { return Some(i); } @@ -1664,7 +1664,7 @@ impl Iterator for Filter where I: Iterator, P: FnMut(& #[inline] fn next(&mut self) -> Option { - for x in self.iter { + for x in self.iter.by_ref() { if (self.predicate)(&x) { return Some(x); } else { @@ -1728,7 +1728,7 @@ impl Iterator for FilterMap where #[inline] fn next(&mut self) -> Option { - for x in self.iter { + for x in self.iter.by_ref() { match (self.f)(x) { Some(y) => return Some(y), None => () @@ -1914,7 +1914,7 @@ impl Iterator for SkipWhile where I: Iterator, P: FnMu #[inline] fn next(&mut self) -> Option { - for x in self.iter { + for x in self.iter.by_ref() { if self.flag || !(self.predicate)(&x) { self.flag = true; return Some(x); @@ -2207,7 +2207,7 @@ impl Iterator for FlatMap where fn next(&mut self) -> Option { loop { for inner in self.frontiter.iter_mut() { - for x in *inner { + for x in inner.by_ref() { return Some(x) } } diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 1032c56fa22..353d4252dfb 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -65,6 +65,8 @@ #![allow(unknown_features)] #![feature(int_uint)] #![feature(on_unimplemented)] #![deny(missing_docs)] +// NOTE(stage0) remove cfg_attr after a snapshot +#![cfg_attr(not(stage0), allow(unused_mut))] #[macro_use] mod macros; @@ -158,4 +160,6 @@ mod std { pub use marker; pub use ops; pub use option; + // for-loops + pub use iter; } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index dd9cc553c7c..1be7a0fb066 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1524,7 +1524,7 @@ macro_rules! from_str_radix_float_impl { let mut exp_info = None::<(char, uint)>; // Parse the integer part of the significand - for (i, c) in cs { + for (i, c) in cs.by_ref() { match c.to_digit(radix) { Some(digit) => { // shift significand one digit left @@ -1572,7 +1572,7 @@ macro_rules! from_str_radix_float_impl { // part of the significand if exp_info.is_none() { let mut power = 1.0; - for (i, c) in cs { + for (i, c) in cs.by_ref() { match c.to_digit(radix) { Some(digit) => { // Decrease power one order of magnitude diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 76258151850..8c50550a6e8 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -498,6 +498,8 @@ mod std { pub use core::{option, fmt}; // panic!() pub use core::clone; // derive Clone pub use core::marker; + // for-loops + pub use core::iter; } #[cfg(test)] diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 580e55f78a9..e99b203cce7 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -41,6 +41,9 @@ #![feature(unicode)] #![feature(hash)] #![cfg_attr(test, feature(test))] +#![allow(unstable)] +// NOTE(stage0) remove cfg_attr after a snapshot +#![cfg_attr(not(stage0), allow(unused_mut))] extern crate arena; extern crate flate; diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index 01d42523f35..d5ee0e57b79 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -352,7 +352,9 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> { for (word_index, &word) in words.iter().enumerate() { if word != 0 { let base_index = word_index * uint::BITS; - for offset in 0u..uint::BITS { + // FIXME(#21245) use a for loop + let mut iter = 0u..uint::BITS; + while let Some(offset) = iter.next() { let bit = 1 << offset; if (word & bit) != 0 { // NB: we round up the total number of bits diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index bb026e237df..5a2ff926669 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -41,6 +41,9 @@ #![feature(std_misc)] #![feature(unicode)] #![feature(hash)] +#![allow(unstable)] +// NOTE(stage0) remove cfg_attr after a snapshot +#![cfg_attr(not(stage0), allow(unused_mut))] extern crate arena; extern crate flate; diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 31c9f996126..4772fac8bd4 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -84,6 +84,9 @@ This API is completely unstable and subject to change. #![feature(core)] #![feature(rustc_private)] #![feature(std_misc)] +#![allow(unstable)] +// NOTE(stage0) remove cfg_attr after a snapshot +#![cfg_attr(not(stage0), allow(unused_mut))] #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index f8ba2dc2a74..974d8b96d32 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -32,6 +32,9 @@ #![feature(test)] #![feature(unicode)] #![feature(hash)] +#![allow(unstable)] +// NOTE(stage0) remove cfg_attr after a snapshot +#![cfg_attr(not(stage0), allow(unused_mut))] extern crate arena; extern crate getopts; diff --git a/src/libserialize/collection_impls.rs b/src/libserialize/collection_impls.rs index 8b39d91ffae..77308d0a66f 100644 --- a/src/libserialize/collection_impls.rs +++ b/src/libserialize/collection_impls.rs @@ -148,7 +148,9 @@ impl< fn decode(d: &mut D) -> Result, D::Error> { let bits = try!(d.read_uint()); let mut set = EnumSet::new(); - for bit in 0..uint::BITS { + // FIXME(#21245) use a for loop + let mut iter = 0..uint::BITS; + while let Some(bit) = iter.next() { if bits & (1 << bit) != 0 { set.insert(CLike::from_uint(1 << bit)); } diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 9aa38e711e7..ffc4c5c6bac 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -232,7 +232,10 @@ pub fn escape_default(c: u8, mut f: F) where _ => { f(b'\\'); f(b'x'); - for &offset in [4u, 0u].iter() { + // FIXME(#21245) use a for loop + let arr = [4u, 0u]; + let mut iter = arr.iter(); + while let ::option::Option::Some(&offset) = ::iter::Iterator::next(&mut iter) { match ((c as i32) >> offset) & 0xf { i @ 0 ... 9 => f(b'0' + (i as u8)), i => f(b'a' + (i as u8 - 10)), diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 9e6a45d8bf0..141c51d8363 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -15,7 +15,7 @@ use self::BucketState::*; use clone::Clone; use cmp; use hash::{Hash, Hasher}; -use iter::{Iterator, ExactSizeIterator, count}; +use iter::{Iterator, IteratorExt, ExactSizeIterator, count}; use marker::{Copy, Sized, self}; use mem::{min_align_of, size_of}; use mem; @@ -921,7 +921,7 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> { #[unsafe_destructor] impl<'a, K: 'a, V: 'a> Drop for Drain<'a, K, V> { fn drop(&mut self) { - for _ in *self {} + for _ in self.by_ref() {} } } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index a016ba8fb0c..534ece52ff5 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -123,6 +123,9 @@ #![feature(rand)] #![feature(hash)] #![cfg_attr(test, feature(test))] +#![allow(unstable)] +// NOTE(stage0): remove cfg_attr after a snapshot +#![cfg_attr(not(stage0), allow(unused_mut))] // Don't link to std. We are std. #![no_std] @@ -310,4 +313,6 @@ mod std { pub use slice; pub use boxed; // used for vec![] + // for-loops + pub use iter; } diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 88db27013ac..98e0320cd14 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -557,7 +557,7 @@ impl GenericPath for Path { } (Some(a), Some(_)) => { comps.push(".."); - for _ in itb { + for _ in itb.by_ref() { comps.push(".."); } comps.push(a); diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 992afb2d10f..05677e1379d 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -404,7 +404,9 @@ mod test { } // start all the tasks - for tx in txs.iter() { + // FIXME(#21245) use a for loop + let mut iter = txs.iter(); + while let Some(tx) = iter.next() { tx.send(()).unwrap(); } } diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 6a43eccbaba..b503b92b00f 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -1476,7 +1476,9 @@ mod test { let _t = Thread::spawn(move|| { let mut count = 0; - for x in rx.iter() { + // FIXME(#21245) use a for loop + let mut iter = rx.iter(); + while let Some(x) = iter.next() { if count >= 3 { break; } else { @@ -1940,7 +1942,9 @@ mod sync_tests { let _t = Thread::spawn(move|| { let mut count = 0; - for x in rx.iter() { + // FIXME(#21245) use a for loop + let mut iter = rx.iter(); + while let Some(x) = iter.next() { if count >= 3 { break; } else { diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index 53eba131674..cc09cfd665c 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -185,7 +185,9 @@ mod tests { let tx = tx.clone(); let q = q.clone(); Thread::spawn(move|| { - for i in 0..nmsgs { + // FIXME(#21245) use a for loop + let mut iter = 0..nmsgs; + while let Some(i) = iter.next() { q.push(i); } tx.send(()).unwrap(); diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index a1362f5382c..d739e5fe6a0 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -37,10 +37,14 @@ pub trait MoveMap { impl MoveMap for Vec { fn move_map(mut self, mut f: F) -> Vec where F: FnMut(T) -> T { - for p in self.iter_mut() { - unsafe { - // FIXME(#5016) this shouldn't need to zero to be safe. - ptr::write(p, f(ptr::read_and_zero(p))); + // FIXME(#21245) use a for loop + { + let mut iter = self.iter_mut(); + while let Some(p) = iter.next() { + unsafe { + // FIXME(#5016) this shouldn't need to zero to be safe. + ptr::write(p, f(ptr::read_and_zero(p))); + } } } self diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index ff4c7b565cb..456c6f73ce1 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -39,6 +39,9 @@ #![feature(rustc_private)] #![feature(std_misc)] #![feature(unicode)] +#![allow(unstable)] +// NOTE(stage0) remove cfg_attr after a snapshot +#![cfg_attr(not(stage0), allow(unused_mut))] extern crate arena; extern crate fmt_macros; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 8fea6bb539f..af8d5b86f4b 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -44,6 +44,9 @@ #![feature(rustc_private)] #![feature(std_misc)] #![feature(hash)] +#![allow(unstable)] +// NOTE(stage0): remove cfg_attr after a snapshot +#![cfg_attr(not(stage0), allow(unused_mut))] extern crate getopts; extern crate serialize; diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 02f738c9d29..659d57b7292 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -84,4 +84,7 @@ mod std { pub use core::cmp; pub use core::fmt; pub use core::marker; + // for-loops + pub use core::iter; + pub use core::option; } diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index 4a9c5a91dcf..e84e6ac5699 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -133,7 +133,9 @@ fn mandelbrot(w: uint, mut out: W) -> old_io::IoResult<()> { (i + 1) * chunk_size }; - for &init_i in vec_init_i[start..end].iter() { + // FIXME(#21245) use a for loop + let mut iter = vec_init_i[start..end].iter(); + while let Some(&init_i) = iter.next() { write_line(init_i, init_r_slice, &mut res); } @@ -142,7 +144,9 @@ fn mandelbrot(w: uint, mut out: W) -> old_io::IoResult<()> { }).collect::>(); try!(writeln!(&mut out as &mut Writer, "P4\n{} {}", w, h)); - for res in data.into_iter() { + // FIXME(#21245) use a for loop + let mut iter = data.into_iter(); + while let Some(res) = iter.next() { try!(out.write(res.join().ok().unwrap().as_slice())); } out.flush() diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index e6ef58cba35..209cc985383 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -180,7 +180,9 @@ fn make_masks() -> Vec > > { // all unused piece can be placed on the board. fn is_board_unfeasible(board: u64, masks: &Vec>>) -> bool { let mut coverable = board; - for (i, masks_at) in masks.iter().enumerate() { + // FIXME(#21245) use a for loop + let mut iter = masks.iter().enumerate(); + while let Some((i, masks_at)) = iter.next() { if board & 1 << i != 0 { continue; } for (cur_id, pos_masks) in masks_at.iter().enumerate() { if board & 1 << (50 + cur_id) != 0 { continue; } @@ -222,7 +224,9 @@ fn to_vec(raw_sol: &List) -> Vec { let mut sol = repeat('.' as u8).take(50).collect::>(); for &m in raw_sol.iter() { let id = '0' as u8 + get_id(m); - for i in 0u..50 { + // FIXME(#21245) use a for loop + let mut iter = 0u..50; + while let Some(i) = iter.next() { if m & 1 << i != 0 { sol[i] = id; } -- cgit 1.4.1-3-g733a5 From 5e1820f34611e311759518440fd4129c5f0c322a Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 22 Jan 2015 20:08:56 -0500 Subject: fix tests --- src/libstd/collections/hash/map.rs | 1 + src/libstd/rt/backtrace.rs | 4 ++++ src/test/auxiliary/issue-16643.rs | 2 +- src/test/compile-fail/for-loop-bogosity.rs | 5 ++++- src/test/compile-fail/issue-13853.rs | 2 +- src/test/compile-fail/issue-2150.rs | 1 + src/test/compile-fail/range-1.rs | 5 ++++- src/test/run-pass/backtrace.rs | 1 + .../run-pass/foreach-external-iterators-hashmap-break-restart.rs | 2 +- 9 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index a291ec16a62..cef0b4034f4 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1731,6 +1731,7 @@ mod test_map { } #[test] + #[ignore] // FIXME(japaric) fn test_move_iter_drops() { DROP_VECTOR.with(|v| { *v.borrow_mut() = repeat(0).take(200).collect(); diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs index f2d66e1a4d7..089dd5fa280 100644 --- a/src/libstd/rt/backtrace.rs +++ b/src/libstd/rt/backtrace.rs @@ -48,6 +48,7 @@ mod test { }) } #[test] + #[ignore] // FIXME(japaric) fn demangle() { t!("test", "test"); t!("_ZN4testE", "test"); @@ -56,6 +57,7 @@ mod test { } #[test] + #[ignore] // FIXME(japaric) fn demangle_dollars() { t!("_ZN4$UP$E", "Box"); t!("_ZN8$UP$testE", "Boxtest"); @@ -64,12 +66,14 @@ mod test { } #[test] + #[ignore] // FIXME(japaric) fn demangle_many_dollars() { t!("_ZN14test$u{20}test4foobE", "test test::foob"); t!("_ZN12test$UP$test4foobE", "testBoxtest::foob"); } #[test] + #[ignore] // FIXME(japaric) fn demangle_windows() { t!("ZN4testE", "test"); t!("ZN14test$u{20}test4foobE", "test test::foob"); diff --git a/src/test/auxiliary/issue-16643.rs b/src/test/auxiliary/issue-16643.rs index c3f7f2d1aa1..c5b3fceaf4a 100644 --- a/src/test/auxiliary/issue-16643.rs +++ b/src/test/auxiliary/issue-16643.rs @@ -15,7 +15,7 @@ pub struct TreeBuilder; impl TreeBuilder { pub fn process_token(&mut self) { match self { - _ => for _y in *self {} + _ => for _y in self.by_ref() {} } } } diff --git a/src/test/compile-fail/for-loop-bogosity.rs b/src/test/compile-fail/for-loop-bogosity.rs index fd920f92394..6bc0e74a2eb 100644 --- a/src/test/compile-fail/for-loop-bogosity.rs +++ b/src/test/compile-fail/for-loop-bogosity.rs @@ -24,7 +24,10 @@ pub fn main() { x: 1, y: 2, }; - for x in bogus { //~ ERROR has type `MyStruct` which does not implement the `Iterator` trait + for x in bogus { //~ ERROR `core::iter::Iterator` is not implemented for the type `MyStruct` + //~^ ERROR + //~^^ ERROR + // FIXME(#21528) not fulfilled obligation error should be reported once, not thrice drop(x); } } diff --git a/src/test/compile-fail/issue-13853.rs b/src/test/compile-fail/issue-13853.rs index 509ca9b80f8..251da2c6b3e 100644 --- a/src/test/compile-fail/issue-13853.rs +++ b/src/test/compile-fail/issue-13853.rs @@ -32,7 +32,7 @@ impl Node for Stuff { fn iterate>(graph: &G) { for node in graph.iter() { //~ ERROR does not implement any method in scope named - node.zomg(); + node.zomg(); //~ error: the type of this value must be known in this context } } diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs index f18db94acf3..1a4c340aa95 100644 --- a/src/test/compile-fail/issue-2150.rs +++ b/src/test/compile-fail/issue-2150.rs @@ -11,6 +11,7 @@ #![deny(unreachable_code)] #![allow(unused_variables)] #![allow(dead_code)] +#![allow(unstable)] fn fail_len(v: Vec ) -> usize { let mut i = 3; diff --git a/src/test/compile-fail/range-1.rs b/src/test/compile-fail/range-1.rs index fdae5f79546..fbc9ad99b72 100644 --- a/src/test/compile-fail/range-1.rs +++ b/src/test/compile-fail/range-1.rs @@ -17,7 +17,10 @@ pub fn main() { // Float => does not implement iterator. for i in 0f32..42f32 {} - //~^ ERROR `for` loop expression has type `core::ops::Range` which does not implement + //~^ ERROR `core::iter::Iterator` is not implemented for the type `core::ops::Range` + //~^^ ERROR + //~^^^ ERROR + // FIXME(#21528) not fulfilled obligation error should be reported once, not thrice // Unsized type. let arr: &[_] = &[1us, 2, 3]; diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index af1cc3b1f4d..781e79257ed 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -10,6 +10,7 @@ // no-pretty-expanded FIXME #15189 // ignore-windows FIXME #13259 +// ignore-test FIXME(japaric) #![feature(unboxed_closures)] #![feature(unsafe_destructor)] diff --git a/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs b/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs index 4305ae95698..7c71c8ea464 100644 --- a/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs +++ b/src/test/run-pass/foreach-external-iterators-hashmap-break-restart.rs @@ -27,7 +27,7 @@ pub fn main() { let mut i = h.iter(); - for (&k,&v) in i { + for (&k,&v) in i.by_ref() { x += k; y += v; break; -- cgit 1.4.1-3-g733a5 From bfaf4227b8bbe81e89a05a5d371726a64b54ceaa Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 23 Jan 2015 13:16:03 -0500 Subject: smoke out remaining bugs --- src/libcollections/str.rs | 4 ++-- src/libstd/collections/hash/map.rs | 3 +-- src/libstd/rt/backtrace.rs | 4 ---- src/libstd/sys/common/backtrace.rs | 2 +- src/test/run-pass/backtrace.rs | 1 - 5 files changed, 4 insertions(+), 10 deletions(-) (limited to 'src/libstd') diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index bbed943fc70..d6ee4dc5f67 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -199,7 +199,7 @@ impl<'a> Iterator for Decompositions<'a> { } if !self.sorted { - for ch in self.iter { + for ch in self.iter.by_ref() { let buffer = &mut self.buffer; let sorted = &mut self.sorted; { @@ -2154,7 +2154,7 @@ mod tests { let s = "ศไทย中华Việt Nam"; let mut it = s.chars(); it.next(); - assert!(it.zip(it.clone()).all(|(x,y)| x == y)); + assert!(it.clone().zip(it).all(|(x,y)| x == y)); } #[test] diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index cef0b4034f4..b1c1dd1a9f6 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1731,7 +1731,6 @@ mod test_map { } #[test] - #[ignore] // FIXME(japaric) fn test_move_iter_drops() { DROP_VECTOR.with(|v| { *v.borrow_mut() = repeat(0).take(200).collect(); @@ -1773,7 +1772,7 @@ mod test_map { } }); - for _ in half {} + for _ in half.by_ref() {} DROP_VECTOR.with(|v| { let nk = (0u..100).filter(|&i| { diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs index 089dd5fa280..f2d66e1a4d7 100644 --- a/src/libstd/rt/backtrace.rs +++ b/src/libstd/rt/backtrace.rs @@ -48,7 +48,6 @@ mod test { }) } #[test] - #[ignore] // FIXME(japaric) fn demangle() { t!("test", "test"); t!("_ZN4testE", "test"); @@ -57,7 +56,6 @@ mod test { } #[test] - #[ignore] // FIXME(japaric) fn demangle_dollars() { t!("_ZN4$UP$E", "Box"); t!("_ZN8$UP$testE", "Boxtest"); @@ -66,14 +64,12 @@ mod test { } #[test] - #[ignore] // FIXME(japaric) fn demangle_many_dollars() { t!("_ZN14test$u{20}test4foobE", "test test::foob"); t!("_ZN12test$UP$test4foobE", "testBoxtest::foob"); } #[test] - #[ignore] // FIXME(japaric) fn demangle_windows() { t!("ZN4testE", "test"); t!("ZN14test$u{20}test4foobE", "test test::foob"); diff --git a/src/libstd/sys/common/backtrace.rs b/src/libstd/sys/common/backtrace.rs index c3e12586829..a71676c6bf2 100644 --- a/src/libstd/sys/common/backtrace.rs +++ b/src/libstd/sys/common/backtrace.rs @@ -54,7 +54,7 @@ pub fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> { let mut chars = inner.chars(); while valid { let mut i = 0; - for c in chars { + for c in chars.by_ref() { if c.is_numeric() { i = i * 10 + c as uint - '0' as uint; } else { diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index 781e79257ed..af1cc3b1f4d 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -10,7 +10,6 @@ // no-pretty-expanded FIXME #15189 // ignore-windows FIXME #13259 -// ignore-test FIXME(japaric) #![feature(unboxed_closures)] #![feature(unsafe_destructor)] -- cgit 1.4.1-3-g733a5 From 2d76c94dd077406d030a9b7058fb52f979db8bd2 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 27 Jan 2015 21:50:33 -0500 Subject: s/while let/for/g now that #21245 has been fixed --- src/libcollections/bit.rs | 4 +--- src/libcollections/ring_buf.rs | 8 ++------ src/libcollections/vec.rs | 4 +--- src/librustc/middle/dataflow.rs | 4 +--- src/libserialize/collection_impls.rs | 4 +--- src/libstd/ascii.rs | 5 +---- src/libstd/rand/os.rs | 4 +--- src/libstd/sync/mpsc/mod.rs | 8 ++------ src/libstd/sync/mpsc/mpsc_queue.rs | 4 +--- src/libsyntax/fold.rs | 12 ++++-------- src/test/bench/shootout-mandelbrot.rs | 8 ++------ src/test/bench/shootout-meteor.rs | 8 ++------ 12 files changed, 19 insertions(+), 54 deletions(-) (limited to 'src/libstd') diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 99172dcdef3..d676cfca929 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -104,9 +104,7 @@ type MatchWords<'a> = Chain>, Skip u8 { let mut result = 0; - // FIXME(#21245) use a for loop - let mut iter = 0..u8::BITS; - while let Some(i) = iter.next() { + for i in 0..u8::BITS { result |= ((byte >> i) & 1) << (u8::BITS - 1 - i); } result diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index a9b31da8250..a19b3c221b1 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -1793,9 +1793,7 @@ mod tests { fn bench_push_back_100(b: &mut test::Bencher) { let mut deq = RingBuf::with_capacity(101); b.iter(|| { - // FIXME(#21245) use a for loop - let mut iter = 0i..100; - while let Some(i) = iter.next() { + for i in 0i..100 { deq.push_back(i); } deq.head = 0; @@ -1807,9 +1805,7 @@ mod tests { fn bench_push_front_100(b: &mut test::Bencher) { let mut deq = RingBuf::with_capacity(101); b.iter(|| { - // FIXME(#21245) use a for loop - let mut iter = 0i..100; - while let Some(i) = iter.next() { + for i in 0i..100 { deq.push_front(i); } deq.head = 0; diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 4ea8267135f..1d20d39b115 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1567,9 +1567,7 @@ impl Drop for Vec { // zeroed (when moving out, because of #[unsafe_no_drop_flag]). if self.cap != 0 { unsafe { - // FIXME(#21245) use a for loop - let mut iter = self.iter(); - while let Some(x) = iter.next() { + for x in self.iter() { ptr::read(x); } dealloc(*self.ptr, self.cap) diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index d5ee0e57b79..01d42523f35 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -352,9 +352,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> { for (word_index, &word) in words.iter().enumerate() { if word != 0 { let base_index = word_index * uint::BITS; - // FIXME(#21245) use a for loop - let mut iter = 0u..uint::BITS; - while let Some(offset) = iter.next() { + for offset in 0u..uint::BITS { let bit = 1 << offset; if (word & bit) != 0 { // NB: we round up the total number of bits diff --git a/src/libserialize/collection_impls.rs b/src/libserialize/collection_impls.rs index 77308d0a66f..8b39d91ffae 100644 --- a/src/libserialize/collection_impls.rs +++ b/src/libserialize/collection_impls.rs @@ -148,9 +148,7 @@ impl< fn decode(d: &mut D) -> Result, D::Error> { let bits = try!(d.read_uint()); let mut set = EnumSet::new(); - // FIXME(#21245) use a for loop - let mut iter = 0..uint::BITS; - while let Some(bit) = iter.next() { + for bit in 0..uint::BITS { if bits & (1 << bit) != 0 { set.insert(CLike::from_uint(1 << bit)); } diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index ffc4c5c6bac..9aa38e711e7 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -232,10 +232,7 @@ pub fn escape_default(c: u8, mut f: F) where _ => { f(b'\\'); f(b'x'); - // FIXME(#21245) use a for loop - let arr = [4u, 0u]; - let mut iter = arr.iter(); - while let ::option::Option::Some(&offset) = ::iter::Iterator::next(&mut iter) { + for &offset in [4u, 0u].iter() { match ((c as i32) >> offset) & 0xf { i @ 0 ... 9 => f(b'0' + (i as u8)), i => f(b'a' + (i as u8 - 10)), diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 05677e1379d..992afb2d10f 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -404,9 +404,7 @@ mod test { } // start all the tasks - // FIXME(#21245) use a for loop - let mut iter = txs.iter(); - while let Some(tx) = iter.next() { + for tx in txs.iter() { tx.send(()).unwrap(); } } diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index b503b92b00f..6a43eccbaba 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -1476,9 +1476,7 @@ mod test { let _t = Thread::spawn(move|| { let mut count = 0; - // FIXME(#21245) use a for loop - let mut iter = rx.iter(); - while let Some(x) = iter.next() { + for x in rx.iter() { if count >= 3 { break; } else { @@ -1942,9 +1940,7 @@ mod sync_tests { let _t = Thread::spawn(move|| { let mut count = 0; - // FIXME(#21245) use a for loop - let mut iter = rx.iter(); - while let Some(x) = iter.next() { + for x in rx.iter() { if count >= 3 { break; } else { diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index cc09cfd665c..53eba131674 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -185,9 +185,7 @@ mod tests { let tx = tx.clone(); let q = q.clone(); Thread::spawn(move|| { - // FIXME(#21245) use a for loop - let mut iter = 0..nmsgs; - while let Some(i) = iter.next() { + for i in 0..nmsgs { q.push(i); } tx.send(()).unwrap(); diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index d739e5fe6a0..a1362f5382c 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -37,14 +37,10 @@ pub trait MoveMap { impl MoveMap for Vec { fn move_map(mut self, mut f: F) -> Vec where F: FnMut(T) -> T { - // FIXME(#21245) use a for loop - { - let mut iter = self.iter_mut(); - while let Some(p) = iter.next() { - unsafe { - // FIXME(#5016) this shouldn't need to zero to be safe. - ptr::write(p, f(ptr::read_and_zero(p))); - } + for p in self.iter_mut() { + unsafe { + // FIXME(#5016) this shouldn't need to zero to be safe. + ptr::write(p, f(ptr::read_and_zero(p))); } } self diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index e84e6ac5699..4a9c5a91dcf 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -133,9 +133,7 @@ fn mandelbrot(w: uint, mut out: W) -> old_io::IoResult<()> { (i + 1) * chunk_size }; - // FIXME(#21245) use a for loop - let mut iter = vec_init_i[start..end].iter(); - while let Some(&init_i) = iter.next() { + for &init_i in vec_init_i[start..end].iter() { write_line(init_i, init_r_slice, &mut res); } @@ -144,9 +142,7 @@ fn mandelbrot(w: uint, mut out: W) -> old_io::IoResult<()> { }).collect::>(); try!(writeln!(&mut out as &mut Writer, "P4\n{} {}", w, h)); - // FIXME(#21245) use a for loop - let mut iter = data.into_iter(); - while let Some(res) = iter.next() { + for res in data.into_iter() { try!(out.write(res.join().ok().unwrap().as_slice())); } out.flush() diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index 209cc985383..e6ef58cba35 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -180,9 +180,7 @@ fn make_masks() -> Vec > > { // all unused piece can be placed on the board. fn is_board_unfeasible(board: u64, masks: &Vec>>) -> bool { let mut coverable = board; - // FIXME(#21245) use a for loop - let mut iter = masks.iter().enumerate(); - while let Some((i, masks_at)) = iter.next() { + for (i, masks_at) in masks.iter().enumerate() { if board & 1 << i != 0 { continue; } for (cur_id, pos_masks) in masks_at.iter().enumerate() { if board & 1 << (50 + cur_id) != 0 { continue; } @@ -224,9 +222,7 @@ fn to_vec(raw_sol: &List) -> Vec { let mut sol = repeat('.' as u8).take(50).collect::>(); for &m in raw_sol.iter() { let id = '0' as u8 + get_id(m); - // FIXME(#21245) use a for loop - let mut iter = 0u..50; - while let Some(i) = iter.next() { + for i in 0u..50 { if m & 1 << i != 0 { sol[i] = id; } -- cgit 1.4.1-3-g733a5 From 60abb3bef2242a8a8be960f2e563036753de336c Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 28 Jan 2015 15:47:06 -0500 Subject: fixes after rebase --- src/libcore/iter.rs | 1 - src/librustc/lib.rs | 1 - src/librustc_trans/lib.rs | 1 - src/librustc_typeck/lib.rs | 1 - src/librustdoc/lib.rs | 1 - src/libstd/lib.rs | 1 - src/libsyntax/lib.rs | 1 - src/libtest/lib.rs | 1 - src/test/compile-fail/issue-20605.rs | 2 +- src/test/compile-fail/issue-2150.rs | 2 +- 10 files changed, 2 insertions(+), 10 deletions(-) (limited to 'src/libstd') diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 8f3c0a44835..b0906651da8 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -123,7 +123,6 @@ pub trait FromIterator { } /// Conversion into an `Iterator` -#[unstable] pub trait IntoIterator { type Iter: Iterator; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index e99b203cce7..a38e8bb4536 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -41,7 +41,6 @@ #![feature(unicode)] #![feature(hash)] #![cfg_attr(test, feature(test))] -#![allow(unstable)] // NOTE(stage0) remove cfg_attr after a snapshot #![cfg_attr(not(stage0), allow(unused_mut))] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 5a2ff926669..bee320c6829 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -41,7 +41,6 @@ #![feature(std_misc)] #![feature(unicode)] #![feature(hash)] -#![allow(unstable)] // NOTE(stage0) remove cfg_attr after a snapshot #![cfg_attr(not(stage0), allow(unused_mut))] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 4772fac8bd4..98f997c5990 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -84,7 +84,6 @@ This API is completely unstable and subject to change. #![feature(core)] #![feature(rustc_private)] #![feature(std_misc)] -#![allow(unstable)] // NOTE(stage0) remove cfg_attr after a snapshot #![cfg_attr(not(stage0), allow(unused_mut))] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 974d8b96d32..4e811844ea9 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -32,7 +32,6 @@ #![feature(test)] #![feature(unicode)] #![feature(hash)] -#![allow(unstable)] // NOTE(stage0) remove cfg_attr after a snapshot #![cfg_attr(not(stage0), allow(unused_mut))] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 534ece52ff5..54e2eaf16ee 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -123,7 +123,6 @@ #![feature(rand)] #![feature(hash)] #![cfg_attr(test, feature(test))] -#![allow(unstable)] // NOTE(stage0): remove cfg_attr after a snapshot #![cfg_attr(not(stage0), allow(unused_mut))] diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 456c6f73ce1..5b78d5b1405 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -39,7 +39,6 @@ #![feature(rustc_private)] #![feature(std_misc)] #![feature(unicode)] -#![allow(unstable)] // NOTE(stage0) remove cfg_attr after a snapshot #![cfg_attr(not(stage0), allow(unused_mut))] diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index af8d5b86f4b..4497832ba7e 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -44,7 +44,6 @@ #![feature(rustc_private)] #![feature(std_misc)] #![feature(hash)] -#![allow(unstable)] // NOTE(stage0): remove cfg_attr after a snapshot #![cfg_attr(not(stage0), allow(unused_mut))] diff --git a/src/test/compile-fail/issue-20605.rs b/src/test/compile-fail/issue-20605.rs index 7b02588ce44..87b7616db8e 100644 --- a/src/test/compile-fail/issue-20605.rs +++ b/src/test/compile-fail/issue-20605.rs @@ -10,7 +10,7 @@ fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } -//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `core::iter::Iterator` +//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `core::iter::Iterator //~^^ ERROR //~^^^ ERROR // FIXME(#21528) error should be reported once, not thrice diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs index 1a4c340aa95..68195985eec 100644 --- a/src/test/compile-fail/issue-2150.rs +++ b/src/test/compile-fail/issue-2150.rs @@ -11,7 +11,7 @@ #![deny(unreachable_code)] #![allow(unused_variables)] #![allow(dead_code)] -#![allow(unstable)] +#![feature(core)] fn fail_len(v: Vec ) -> usize { let mut i = 3; -- cgit 1.4.1-3-g733a5 From 0cdde6e5e015ee6f6d9381ab624a312af7c9b069 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 27 Jan 2015 22:52:32 -0800 Subject: std: Stabilize FromStr and parse This commits adds an associated type to the `FromStr` trait representing an error payload for parses which do not succeed. The previous return value, `Option` did not allow for this form of payload. After the associated type was added, the following attributes were applied: * `FromStr` is now stable * `FromStr::Err` is now stable * `FromStr::from_str` is now stable * `StrExt::parse` is now stable * `FromStr for bool` is now stable * `FromStr for $float` is now stable * `FromStr for $integral` is now stable * Errors returned from stable `FromStr` implementations are stable * Errors implement `Display` and `Error` (both impl blocks being `#[stable]`) Closes #15138 --- src/compiletest/common.rs | 21 +-- src/compiletest/compiletest.rs | 5 +- src/compiletest/header.rs | 6 +- src/doc/reference.md | 2 +- src/doc/trpl/guessing-game.md | 24 +-- src/libcollections/str.rs | 10 +- src/libcollections/string.rs | 8 +- src/libcore/num/mod.rs | 174 +++++++++++++++------ src/libcore/option.rs | 4 +- src/libcore/str/mod.rs | 53 +++++-- src/libcoretest/num/int_macros.rs | 42 ++--- src/libcoretest/num/mod.rs | 52 +++--- src/libcoretest/str.rs | 6 +- src/liblog/directive.rs | 2 +- src/librustc/lint/builtin.rs | 2 +- src/librustc/metadata/decoder.rs | 2 +- src/librustc/metadata/tydecode.rs | 8 +- .../middle/infer/region_inference/graphviz.rs | 2 +- src/librustc/middle/recursion_limit.rs | 3 +- src/librustc/session/config.rs | 4 +- src/librustc_driver/pretty.rs | 14 +- src/libserialize/json.rs | 9 +- src/libstd/num/uint_macros.rs | 20 +-- src/libstd/old_io/net/ip.rs | 108 +++++++------ src/libstd/path/posix.rs | 13 +- src/libstd/path/windows.rs | 13 +- src/libstd/rt/util.rs | 4 +- src/libsyntax/parse/lexer/mod.rs | 4 +- src/libsyntax/parse/mod.rs | 8 +- src/libsyntax/parse/parser.rs | 4 +- src/libsyntax/show_span.rs | 9 +- src/libtest/lib.rs | 3 +- src/test/auxiliary/static-methods-crate.rs | 2 +- src/test/bench/shootout-chameneos-redux.rs | 2 +- src/test/bench/shootout-fannkuch-redux.rs | 2 +- src/test/bench/shootout-nbody.rs | 2 +- src/test/bench/shootout-threadring.rs | 4 +- src/test/run-pass/match-with-ret-arm.rs | 2 +- src/test/run-pass/wait-forked-but-failed-child.rs | 2 +- 39 files changed, 392 insertions(+), 263 deletions(-) (limited to 'src/libstd') diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index b1deb8a36ad..df2981a6c83 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -25,17 +25,18 @@ pub enum Mode { } impl FromStr for Mode { - fn from_str(s: &str) -> Option { + type Err = (); + fn from_str(s: &str) -> Result { match s { - "compile-fail" => Some(CompileFail), - "run-fail" => Some(RunFail), - "run-pass" => Some(RunPass), - "run-pass-valgrind" => Some(RunPassValgrind), - "pretty" => Some(Pretty), - "debuginfo-lldb" => Some(DebugInfoLldb), - "debuginfo-gdb" => Some(DebugInfoGdb), - "codegen" => Some(Codegen), - _ => None, + "compile-fail" => Ok(CompileFail), + "run-fail" => Ok(RunFail), + "run-pass" => Ok(RunPass), + "run-pass-valgrind" => Ok(RunPassValgrind), + "pretty" => Ok(Pretty), + "debuginfo-lldb" => Ok(DebugInfoLldb), + "debuginfo-gdb" => Ok(DebugInfoGdb), + "codegen" => Ok(Codegen), + _ => Err(()), } } } diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 357ccec7cf3..ea733c84a97 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -35,7 +35,6 @@ extern crate log; use std::os; use std::old_io; use std::old_io::fs; -use std::str::FromStr; use std::thunk::Thunk; use getopts::{optopt, optflag, reqopt}; use common::Config; @@ -140,9 +139,7 @@ pub fn parse_config(args: Vec ) -> Config { build_base: opt_path(matches, "build-base"), aux_base: opt_path(matches, "aux-base"), stage_id: matches.opt_str("stage-id").unwrap(), - mode: FromStr::from_str(matches.opt_str("mode") - .unwrap() - .as_slice()).expect("invalid mode"), + mode: matches.opt_str("mode").unwrap().parse().ok().expect("invalid mode"), run_ignored: matches.opt_present("ignored"), filter: filter, logfile: matches.opt_str("logfile").map(|s| Path::new(s)), diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index f83c27b75d6..66059d2d13d 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -352,8 +352,8 @@ pub fn gdb_version_to_int(version_string: &str) -> int { panic!("{}", error_string); } - let major: int = components[0].parse().expect(error_string); - let minor: int = components[1].parse().expect(error_string); + let major: int = components[0].parse().ok().expect(error_string); + let minor: int = components[1].parse().ok().expect(error_string); return major * 1000 + minor; } @@ -363,6 +363,6 @@ pub fn lldb_version_to_int(version_string: &str) -> int { "Encountered LLDB version string with unexpected format: {}", version_string); let error_string = error_string.as_slice(); - let major: int = version_string.parse().expect(error_string); + let major: int = version_string.parse().ok().expect(error_string); return major; } diff --git a/src/doc/reference.md b/src/doc/reference.md index 59ac173f97a..686820eb813 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -2994,7 +2994,7 @@ Some examples of call expressions: # fn add(x: i32, y: i32) -> i32 { 0 } let x: i32 = add(1i32, 2i32); -let pi: Option = "3.14".parse(); +let pi: Option = "3.14".parse().ok(); ``` ### Lambda expressions diff --git a/src/doc/trpl/guessing-game.md b/src/doc/trpl/guessing-game.md index f01b62223ca..162e533d8bb 100644 --- a/src/doc/trpl/guessing-game.md +++ b/src/doc/trpl/guessing-game.md @@ -400,7 +400,7 @@ a function for that: let input = old_io::stdin().read_line() .ok() .expect("Failed to read line"); -let input_num: Option = input.parse(); +let input_num: Option = input.parse().ok(); ``` The `parse` function takes in a `&str` value and converts it into something. @@ -422,11 +422,13 @@ In this case, we say `x` is a `u32` explicitly, so Rust is able to properly tell `random()` what to generate. In a similar fashion, both of these work: ```{rust,ignore} -let input_num = "5".parse::(); // input_num: Option -let input_num: Option = "5".parse(); // input_num: Option +let input_num = "5".parse::().ok(); // input_num: Option +let input_num: Option = "5".parse().ok(); // input_num: Option ``` -Anyway, with us now converting our input to a number, our code looks like this: +Here we're converting the `Result` returned by `parse` to an `Option` by using +the `ok` method as well. Anyway, with us now converting our input to a number, +our code looks like this: ```{rust,ignore} use std::old_io; @@ -445,7 +447,7 @@ fn main() { let input = old_io::stdin().read_line() .ok() .expect("Failed to read line"); - let input_num: Option = input.parse(); + let input_num: Option = input.parse().ok(); println!("You guessed: {}", input_num); @@ -495,7 +497,7 @@ fn main() { let input = old_io::stdin().read_line() .ok() .expect("Failed to read line"); - let input_num: Option = input.parse(); + let input_num: Option = input.parse().ok(); let num = match input_num { Some(num) => num, @@ -562,7 +564,7 @@ fn main() { let input = old_io::stdin().read_line() .ok() .expect("Failed to read line"); - let input_num: Option = input.trim().parse(); + let input_num: Option = input.trim().parse().ok(); let num = match input_num { Some(num) => num, @@ -638,7 +640,7 @@ fn main() { let input = old_io::stdin().read_line() .ok() .expect("Failed to read line"); - let input_num: Option = input.trim().parse(); + let input_num: Option = input.trim().parse().ok(); let num = match input_num { Some(num) => num, @@ -714,7 +716,7 @@ fn main() { let input = old_io::stdin().read_line() .ok() .expect("Failed to read line"); - let input_num: Option = input.trim().parse(); + let input_num: Option = input.trim().parse().ok(); let num = match input_num { Some(num) => num, @@ -770,7 +772,7 @@ fn main() { let input = old_io::stdin().read_line() .ok() .expect("Failed to read line"); - let input_num: Option = input.trim().parse(); + let input_num: Option = input.trim().parse().ok(); let num = match input_num { Some(num) => num, @@ -847,7 +849,7 @@ fn main() { let input = old_io::stdin().read_line() .ok() .expect("Failed to read line"); - let input_num: Option = input.trim().parse(); + let input_num: Option = input.trim().parse().ok(); let num = match input_num { Some(num) => num, diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 35591a5e9ef..2a2a44aa38f 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -68,6 +68,7 @@ use core::ops::FullRange; #[cfg(not(stage0))] use core::ops::RangeFull; use core::option::Option::{self, Some, None}; +use core::result::Result; use core::slice::AsSlice; use core::str as core_str; use unicode::str::{UnicodeStr, Utf16Encoder}; @@ -1231,13 +1232,12 @@ pub trait StrExt: Index { /// # Example /// /// ``` - /// assert_eq!("4".parse::(), Some(4)); - /// assert_eq!("j".parse::(), None); + /// assert_eq!("4".parse::(), Ok(4)); + /// assert!("j".parse::().is_err()); /// ``` #[inline] - #[unstable(feature = "collections", - reason = "this method was just created")] - fn parse(&self) -> Option { + #[stable(feature = "rust1", since = "1.0.0")] + fn parse(&self) -> Result { core_str::StrExt::parse(&self[]) } diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 035529c7365..fa399ca3414 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -940,10 +940,12 @@ pub fn as_string<'a>(x: &'a str) -> DerefString<'a> { DerefString { x: as_vec(x.as_bytes()) } } +#[unstable(feature = "collections", reason = "associated error type may change")] impl FromStr for String { + type Err = (); #[inline] - fn from_str(s: &str) -> Option { - Some(String::from_str(s)) + fn from_str(s: &str) -> Result { + Ok(String::from_str(s)) } } @@ -1016,7 +1018,7 @@ mod tests { #[test] fn test_from_str() { - let owned: Option<::std::string::String> = "string".parse(); + let owned: Option<::std::string::String> = "string".parse().ok(); assert_eq!(owned.as_ref().map(|s| s.as_slice()), Some("string")); } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index dd9cc553c7c..138085abf41 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -17,16 +17,17 @@ use char::CharExt; use clone::Clone; -use cmp::{PartialEq, Eq}; -use cmp::{PartialOrd, Ord}; +use cmp::{PartialEq, Eq, PartialOrd, Ord}; +use error::Error; +use fmt; use intrinsics; use iter::IteratorExt; use marker::Copy; use mem::size_of; use ops::{Add, Sub, Mul, Div, Rem, Neg}; use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr}; -use option::Option; -use option::Option::{Some, None}; +use option::Option::{self, Some, None}; +use result::Result::{self, Ok, Err}; use str::{FromStr, StrExt}; /// A built-in signed or unsigned integer. @@ -1428,22 +1429,25 @@ pub trait Float } /// A generic trait for converting a string with a radix (base) to a value -#[unstable(feature = "core", reason = "might need to return Result")] +#[unstable(feature = "core", reason = "needs reevaluation")] pub trait FromStrRadix { - fn from_str_radix(str: &str, radix: uint) -> Option; + type Err; + fn from_str_radix(str: &str, radix: uint) -> Result; } /// A utility function that just calls FromStrRadix::from_str_radix. -#[unstable(feature = "core", reason = "might need to return Result")] -pub fn from_str_radix(str: &str, radix: uint) -> Option { +#[unstable(feature = "core", reason = "needs reevaluation")] +pub fn from_str_radix(str: &str, radix: uint) + -> Result { FromStrRadix::from_str_radix(str, radix) } macro_rules! from_str_radix_float_impl { ($T:ty) => { - #[unstable(feature = "core", - reason = "might need to return Result")] + #[stable(feature = "rust1", since = "1.0.0")] impl FromStr for $T { + type Err = ParseFloatError; + /// Convert a string in base 10 to a float. /// Accepts an optional decimal exponent. /// @@ -1470,14 +1474,15 @@ macro_rules! from_str_radix_float_impl { /// `None` if the string did not represent a valid number. Otherwise, /// `Some(n)` where `n` is the floating-point number represented by `src`. #[inline] - fn from_str(src: &str) -> Option<$T> { + fn from_str(src: &str) -> Result<$T, ParseFloatError> { from_str_radix(src, 10) } } - #[unstable(feature = "core", - reason = "might need to return Result")] + #[stable(feature = "rust1", since = "1.0.0")] impl FromStrRadix for $T { + type Err = ParseFloatError; + /// Convert a string in a given base to a float. /// /// Due to possible conflicts, this function does **not** accept @@ -1493,24 +1498,28 @@ macro_rules! from_str_radix_float_impl { /// /// # Return value /// - /// `None` if the string did not represent a valid number. Otherwise, - /// `Some(n)` where `n` is the floating-point number represented by `src`. - fn from_str_radix(src: &str, radix: uint) -> Option<$T> { - assert!(radix >= 2 && radix <= 36, + /// `None` if the string did not represent a valid number. + /// Otherwise, `Some(n)` where `n` is the floating-point number + /// represented by `src`. + fn from_str_radix(src: &str, radix: uint) + -> Result<$T, ParseFloatError> { + use self::FloatErrorKind::*; + use self::ParseFloatError as PFE; + assert!(radix >= 2 && radix <= 36, "from_str_radix_float: must lie in the range `[2, 36]` - found {}", radix); // Special values match src { - "inf" => return Some(Float::infinity()), - "-inf" => return Some(Float::neg_infinity()), - "NaN" => return Some(Float::nan()), + "inf" => return Ok(Float::infinity()), + "-inf" => return Ok(Float::neg_infinity()), + "NaN" => return Ok(Float::nan()), _ => {}, } let (is_positive, src) = match src.slice_shift_char() { - None => return None, - Some(('-', "")) => return None, + None => return Err(PFE { kind: Empty }), + Some(('-', "")) => return Err(PFE { kind: Empty }), Some(('-', src)) => (false, src), Some((_, _)) => (true, src), }; @@ -1541,15 +1550,15 @@ macro_rules! from_str_radix_float_impl { // if we've not seen any non-zero digits. if prev_sig != 0.0 { if is_positive && sig <= prev_sig - { return Some(Float::infinity()); } + { return Ok(Float::infinity()); } if !is_positive && sig >= prev_sig - { return Some(Float::neg_infinity()); } + { return Ok(Float::neg_infinity()); } // Detect overflow by reversing the shift-and-add process if is_positive && (prev_sig != (sig - digit as $T) / radix as $T) - { return Some(Float::infinity()); } + { return Ok(Float::infinity()); } if !is_positive && (prev_sig != (sig + digit as $T) / radix as $T) - { return Some(Float::neg_infinity()); } + { return Ok(Float::neg_infinity()); } } prev_sig = sig; }, @@ -1562,7 +1571,7 @@ macro_rules! from_str_radix_float_impl { break; // start of fractional part }, _ => { - return None; + return Err(PFE { kind: Invalid }); }, }, } @@ -1585,9 +1594,9 @@ macro_rules! from_str_radix_float_impl { }; // Detect overflow by comparing to last value if is_positive && sig < prev_sig - { return Some(Float::infinity()); } + { return Ok(Float::infinity()); } if !is_positive && sig > prev_sig - { return Some(Float::neg_infinity()); } + { return Ok(Float::neg_infinity()); } prev_sig = sig; }, None => match c { @@ -1596,7 +1605,7 @@ macro_rules! from_str_radix_float_impl { break; // start of exponent }, _ => { - return None; // invalid number + return Err(PFE { kind: Invalid }); }, }, } @@ -1609,7 +1618,7 @@ macro_rules! from_str_radix_float_impl { let base = match c { 'E' | 'e' if radix == 10 => 10.0, 'P' | 'p' if radix == 16 => 2.0, - _ => return None, + _ => return Err(PFE { kind: Invalid }), }; // Parse the exponent as decimal integer @@ -1618,19 +1627,19 @@ macro_rules! from_str_radix_float_impl { Some(('-', src)) => (false, src.parse::()), Some(('+', src)) => (true, src.parse::()), Some((_, _)) => (true, src.parse::()), - None => return None, + None => return Err(PFE { kind: Invalid }), }; match (is_positive, exp) { - (true, Some(exp)) => base.powi(exp as i32), - (false, Some(exp)) => 1.0 / base.powi(exp as i32), - (_, None) => return None, + (true, Ok(exp)) => base.powi(exp as i32), + (false, Ok(exp)) => 1.0 / base.powi(exp as i32), + (_, Err(_)) => return Err(PFE { kind: Invalid }), } }, None => 1.0, // no exponent }; - Some(sig * exp) + Ok(sig * exp) } } } @@ -1640,19 +1649,22 @@ from_str_radix_float_impl! { f64 } macro_rules! from_str_radix_int_impl { ($T:ty) => { - #[unstable(feature = "core", - reason = "might need to return Result")] + #[stable(feature = "rust1", since = "1.0.0")] impl FromStr for $T { + type Err = ParseIntError; #[inline] - fn from_str(src: &str) -> Option<$T> { + fn from_str(src: &str) -> Result<$T, ParseIntError> { from_str_radix(src, 10) } } - #[unstable(feature = "core", - reason = "might need to return Result")] + #[stable(feature = "rust1", since = "1.0.0")] impl FromStrRadix for $T { - fn from_str_radix(src: &str, radix: uint) -> Option<$T> { + type Err = ParseIntError; + fn from_str_radix(src: &str, radix: uint) + -> Result<$T, ParseIntError> { + use self::IntErrorKind::*; + use self::ParseIntError as PIE; assert!(radix >= 2 && radix <= 36, "from_str_radix_int: must lie in the range `[2, 36]` - found {}", radix); @@ -1666,18 +1678,18 @@ macro_rules! from_str_radix_int_impl { for c in src.chars() { let x = match c.to_digit(radix) { Some(x) => x, - None => return None, + None => return Err(PIE { kind: InvalidDigit }), }; result = match result.checked_mul(radix as $T) { Some(result) => result, - None => return None, + None => return Err(PIE { kind: Underflow }), }; result = match result.checked_sub(x as $T) { Some(result) => result, - None => return None, + None => return Err(PIE { kind: Underflow }), }; } - Some(result) + Ok(result) }, Some((_, _)) => { // The number is signed @@ -1685,20 +1697,20 @@ macro_rules! from_str_radix_int_impl { for c in src.chars() { let x = match c.to_digit(radix) { Some(x) => x, - None => return None, + None => return Err(PIE { kind: InvalidDigit }), }; result = match result.checked_mul(radix as $T) { Some(result) => result, - None => return None, + None => return Err(PIE { kind: Overflow }), }; result = match result.checked_add(x as $T) { Some(result) => result, - None => return None, + None => return Err(PIE { kind: Overflow }), }; } - Some(result) + Ok(result) }, - None => None, + None => Err(ParseIntError { kind: Empty }), } } } @@ -1714,3 +1726,63 @@ from_str_radix_int_impl! { u8 } from_str_radix_int_impl! { u16 } from_str_radix_int_impl! { u32 } from_str_radix_int_impl! { u64 } + +/// An error which can be returned when parsing an integer. +#[derive(Show, Clone, PartialEq)] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct ParseIntError { kind: IntErrorKind } + +#[derive(Show, Clone, PartialEq)] +enum IntErrorKind { + Empty, + InvalidDigit, + Overflow, + Underflow, +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl fmt::Display for ParseIntError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.description().fmt(f) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Error for ParseIntError { + fn description(&self) -> &str { + match self.kind { + IntErrorKind::Empty => "cannot parse integer from empty string", + IntErrorKind::InvalidDigit => "invalid digit found in string", + IntErrorKind::Overflow => "number too large to fit in target type", + IntErrorKind::Underflow => "number too small to fit in target type", + } + } +} + +/// An error which can be returned when parsing a float. +#[derive(Show, Clone, PartialEq)] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct ParseFloatError { kind: FloatErrorKind } + +#[derive(Show, Clone, PartialEq)] +enum FloatErrorKind { + Empty, + Invalid, +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl fmt::Display for ParseFloatError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.description().fmt(f) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Error for ParseFloatError { + fn description(&self) -> &str { + match self.kind { + FloatErrorKind::Empty => "cannot parse float from empty string", + FloatErrorKind::Invalid => "invalid float literal", + } + } +} diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 5cb8e5e5565..2f261b0628f 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -728,8 +728,8 @@ impl Option { /// ``` /// let good_year_from_input = "1909"; /// let bad_year_from_input = "190blarg"; - /// let good_year = good_year_from_input.parse().unwrap_or_default(); - /// let bad_year = bad_year_from_input.parse().unwrap_or_default(); + /// let good_year = good_year_from_input.parse().ok().unwrap_or_default(); + /// let bad_year = bad_year_from_input.parse().ok().unwrap_or_default(); /// /// assert_eq!(1909, good_year); /// assert_eq!(0, bad_year); diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 8495a03747e..d08a2d3d77e 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -108,37 +108,62 @@ macro_rules! delegate_iter { /// A trait to abstract the idea of creating a new instance of a type from a /// string. -// FIXME(#17307): there should be an `E` associated type for a `Result` return -#[unstable(feature = "core", - reason = "will return a Result once associated types are working")] +#[stable(feature = "rust1", since = "1.0.0")] pub trait FromStr { + /// The associated error which can be returned from parsing. + #[stable(feature = "rust1", since = "1.0.0")] + type Err; + /// Parses a string `s` to return an optional value of this type. If the /// string is ill-formatted, the None is returned. - fn from_str(s: &str) -> Option; + #[stable(feature = "rust1", since = "1.0.0")] + fn from_str(s: &str) -> Result; } +#[stable(feature = "rust1", since = "1.0.0")] impl FromStr for bool { + type Err = ParseBoolError; + /// Parse a `bool` from a string. /// - /// Yields an `Option`, because `s` may or may not actually be parseable. + /// Yields an `Option`, because `s` may or may not actually be + /// parseable. /// /// # Examples /// /// ```rust - /// assert_eq!("true".parse(), Some(true)); - /// assert_eq!("false".parse(), Some(false)); - /// assert_eq!("not even a boolean".parse::(), None); + /// assert_eq!("true".parse(), Ok(true)); + /// assert_eq!("false".parse(), Ok(false)); + /// assert!("not even a boolean".parse::().is_err()); /// ``` #[inline] - fn from_str(s: &str) -> Option { + fn from_str(s: &str) -> Result { match s { - "true" => Some(true), - "false" => Some(false), - _ => None, + "true" => Ok(true), + "false" => Ok(false), + _ => Err(ParseBoolError { _priv: () }), } } } +/// An error returned when parsing a `bool` from a string fails. +#[derive(Show, Clone, PartialEq)] +#[allow(missing_copy_implementations)] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct ParseBoolError { _priv: () } + +#[stable(feature = "rust1", since = "1.0.0")] +impl fmt::Display for ParseBoolError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + "provided string was not `true` or `false`".fmt(f) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Error for ParseBoolError { + fn description(&self) -> &str { "failed to parse bool" } +} + /* Section: Creating a string */ @@ -1355,7 +1380,7 @@ pub trait StrExt { fn as_ptr(&self) -> *const u8; fn len(&self) -> uint; fn is_empty(&self) -> bool; - fn parse(&self) -> Option; + fn parse(&self) -> Result; } #[inline(never)] @@ -1670,7 +1695,7 @@ impl StrExt for str { fn is_empty(&self) -> bool { self.len() == 0 } #[inline] - fn parse(&self) -> Option { FromStr::from_str(self) } + fn parse(&self) -> Result { FromStr::from_str(self) } } /// Pluck a code point out of a UTF-8-like byte slice and return the diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs index b98432e26b2..d956cd4816b 100644 --- a/src/libcoretest/num/int_macros.rs +++ b/src/libcoretest/num/int_macros.rs @@ -159,7 +159,7 @@ mod tests { #[test] fn test_from_str() { fn from_str(t: &str) -> Option { - ::std::str::FromStr::from_str(t) + ::std::str::FromStr::from_str(t).ok() } assert_eq!(from_str::<$T>("0"), Some(0 as $T)); assert_eq!(from_str::<$T>("3"), Some(3 as $T)); @@ -180,26 +180,26 @@ mod tests { #[test] fn test_from_str_radix() { - assert_eq!(FromStrRadix::from_str_radix("123", 10), Some(123 as $T)); - assert_eq!(FromStrRadix::from_str_radix("1001", 2), Some(9 as $T)); - assert_eq!(FromStrRadix::from_str_radix("123", 8), Some(83 as $T)); - assert_eq!(FromStrRadix::from_str_radix("123", 16), Some(291 as i32)); - assert_eq!(FromStrRadix::from_str_radix("ffff", 16), Some(65535 as i32)); - assert_eq!(FromStrRadix::from_str_radix("FFFF", 16), Some(65535 as i32)); - assert_eq!(FromStrRadix::from_str_radix("z", 36), Some(35 as $T)); - assert_eq!(FromStrRadix::from_str_radix("Z", 36), Some(35 as $T)); - - assert_eq!(FromStrRadix::from_str_radix("-123", 10), Some(-123 as $T)); - assert_eq!(FromStrRadix::from_str_radix("-1001", 2), Some(-9 as $T)); - assert_eq!(FromStrRadix::from_str_radix("-123", 8), Some(-83 as $T)); - assert_eq!(FromStrRadix::from_str_radix("-123", 16), Some(-291 as i32)); - assert_eq!(FromStrRadix::from_str_radix("-ffff", 16), Some(-65535 as i32)); - assert_eq!(FromStrRadix::from_str_radix("-FFFF", 16), Some(-65535 as i32)); - assert_eq!(FromStrRadix::from_str_radix("-z", 36), Some(-35 as $T)); - assert_eq!(FromStrRadix::from_str_radix("-Z", 36), Some(-35 as $T)); - - assert_eq!(FromStrRadix::from_str_radix("Z", 35), None::<$T>); - assert_eq!(FromStrRadix::from_str_radix("-9", 2), None::<$T>); + assert_eq!(FromStrRadix::from_str_radix("123", 10), Ok(123 as $T)); + assert_eq!(FromStrRadix::from_str_radix("1001", 2), Ok(9 as $T)); + assert_eq!(FromStrRadix::from_str_radix("123", 8), Ok(83 as $T)); + assert_eq!(FromStrRadix::from_str_radix("123", 16), Ok(291 as i32)); + assert_eq!(FromStrRadix::from_str_radix("ffff", 16), Ok(65535 as i32)); + assert_eq!(FromStrRadix::from_str_radix("FFFF", 16), Ok(65535 as i32)); + assert_eq!(FromStrRadix::from_str_radix("z", 36), Ok(35 as $T)); + assert_eq!(FromStrRadix::from_str_radix("Z", 36), Ok(35 as $T)); + + assert_eq!(FromStrRadix::from_str_radix("-123", 10), Ok(-123 as $T)); + assert_eq!(FromStrRadix::from_str_radix("-1001", 2), Ok(-9 as $T)); + assert_eq!(FromStrRadix::from_str_radix("-123", 8), Ok(-83 as $T)); + assert_eq!(FromStrRadix::from_str_radix("-123", 16), Ok(-291 as i32)); + assert_eq!(FromStrRadix::from_str_radix("-ffff", 16), Ok(-65535 as i32)); + assert_eq!(FromStrRadix::from_str_radix("-FFFF", 16), Ok(-65535 as i32)); + assert_eq!(FromStrRadix::from_str_radix("-z", 36), Ok(-35 as $T)); + assert_eq!(FromStrRadix::from_str_radix("-Z", 36), Ok(-35 as $T)); + + assert_eq!(FromStrRadix::from_str_radix("Z", 35).ok(), None::<$T>); + assert_eq!(FromStrRadix::from_str_radix("-9", 2).ok(), None::<$T>); } } diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs index e0623bade5c..f93c07eac5f 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -62,64 +62,64 @@ mod test { #[test] fn from_str_issue7588() { - let u : Option = from_str_radix("1000", 10); + let u : Option = from_str_radix("1000", 10).ok(); assert_eq!(u, None); - let s : Option = from_str_radix("80000", 10); + let s : Option = from_str_radix("80000", 10).ok(); assert_eq!(s, None); - let f : Option = from_str_radix("10000000000000000000000000000000000000000", 10); + let f : Option = from_str_radix("10000000000000000000000000000000000000000", 10).ok(); assert_eq!(f, Some(Float::infinity())); - let fe : Option = from_str_radix("1e40", 10); + let fe : Option = from_str_radix("1e40", 10).ok(); assert_eq!(fe, Some(Float::infinity())); } #[test] fn test_from_str_radix_float() { - let x1 : Option = from_str_radix("-123.456", 10); + let x1 : Option = from_str_radix("-123.456", 10).ok(); assert_eq!(x1, Some(-123.456)); - let x2 : Option = from_str_radix("123.456", 10); + let x2 : Option = from_str_radix("123.456", 10).ok(); assert_eq!(x2, Some(123.456)); - let x3 : Option = from_str_radix("-0.0", 10); + let x3 : Option = from_str_radix("-0.0", 10).ok(); assert_eq!(x3, Some(-0.0)); - let x4 : Option = from_str_radix("0.0", 10); + let x4 : Option = from_str_radix("0.0", 10).ok(); assert_eq!(x4, Some(0.0)); - let x4 : Option = from_str_radix("1.0", 10); + let x4 : Option = from_str_radix("1.0", 10).ok(); assert_eq!(x4, Some(1.0)); - let x5 : Option = from_str_radix("-1.0", 10); + let x5 : Option = from_str_radix("-1.0", 10).ok(); assert_eq!(x5, Some(-1.0)); } #[test] fn test_int_from_str_overflow() { let mut i8_val: i8 = 127_i8; - assert_eq!("127".parse::(), Some(i8_val)); - assert_eq!("128".parse::(), None); + assert_eq!("127".parse::().ok(), Some(i8_val)); + assert_eq!("128".parse::().ok(), None); i8_val += 1 as i8; - assert_eq!("-128".parse::(), Some(i8_val)); - assert_eq!("-129".parse::(), None); + assert_eq!("-128".parse::().ok(), Some(i8_val)); + assert_eq!("-129".parse::().ok(), None); let mut i16_val: i16 = 32_767_i16; - assert_eq!("32767".parse::(), Some(i16_val)); - assert_eq!("32768".parse::(), None); + assert_eq!("32767".parse::().ok(), Some(i16_val)); + assert_eq!("32768".parse::().ok(), None); i16_val += 1 as i16; - assert_eq!("-32768".parse::(), Some(i16_val)); - assert_eq!("-32769".parse::(), None); + assert_eq!("-32768".parse::().ok(), Some(i16_val)); + assert_eq!("-32769".parse::().ok(), None); let mut i32_val: i32 = 2_147_483_647_i32; - assert_eq!("2147483647".parse::(), Some(i32_val)); - assert_eq!("2147483648".parse::(), None); + assert_eq!("2147483647".parse::().ok(), Some(i32_val)); + assert_eq!("2147483648".parse::().ok(), None); i32_val += 1 as i32; - assert_eq!("-2147483648".parse::(), Some(i32_val)); - assert_eq!("-2147483649".parse::(), None); + assert_eq!("-2147483648".parse::().ok(), Some(i32_val)); + assert_eq!("-2147483649".parse::().ok(), None); let mut i64_val: i64 = 9_223_372_036_854_775_807_i64; - assert_eq!("9223372036854775807".parse::(), Some(i64_val)); - assert_eq!("9223372036854775808".parse::(), None); + assert_eq!("9223372036854775807".parse::().ok(), Some(i64_val)); + assert_eq!("9223372036854775808".parse::().ok(), None); i64_val += 1 as i64; - assert_eq!("-9223372036854775808".parse::(), Some(i64_val)); - assert_eq!("-9223372036854775809".parse::(), None); + assert_eq!("-9223372036854775808".parse::().ok(), Some(i64_val)); + assert_eq!("-9223372036854775809".parse::().ok(), None); } } diff --git a/src/libcoretest/str.rs b/src/libcoretest/str.rs index 938755113b5..f2a1b0ac584 100644 --- a/src/libcoretest/str.rs +++ b/src/libcoretest/str.rs @@ -10,9 +10,9 @@ #[test] fn test_bool_from_str() { - assert_eq!("true".parse(), Some(true)); - assert_eq!("false".parse(), Some(false)); - assert_eq!("not even a boolean".parse::(), None); + assert_eq!("true".parse().ok(), Some(true)); + assert_eq!("false".parse().ok(), Some(false)); + assert_eq!("not even a boolean".parse::().ok(), None); } fn check_contains_all_substrings(s: &str) { diff --git a/src/liblog/directive.rs b/src/liblog/directive.rs index edd93358bfa..46b9b2ed865 100644 --- a/src/liblog/directive.rs +++ b/src/liblog/directive.rs @@ -22,7 +22,7 @@ pub static LOG_LEVEL_NAMES: [&'static str; 4] = ["ERROR", "WARN", "INFO", /// Parse an individual log level that is either a number or a symbolic log level fn parse_log_level(level: &str) -> Option { - level.parse::().or_else(|| { + level.parse::().ok().or_else(|| { let pos = LOG_LEVEL_NAMES.iter().position(|&name| name.eq_ignore_ascii_case(level)); pos.map(|p| p as u32 + 1) }).map(|p| cmp::min(p, ::MAX_LOG_LEVEL)) diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index f13814527cd..664914f2e4c 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -254,7 +254,7 @@ impl LintPass for TypeLimits { let lit_val: f64 = match lit.node { ast::LitFloat(ref v, _) | ast::LitFloatUnsuffixed(ref v) => { - match v.parse() { + match v.parse().ok() { Some(f) => f, None => return } diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 933fd873aeb..bb4b52378ea 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -223,7 +223,7 @@ fn each_reexport(d: rbml::Doc, f: F) -> bool where fn variant_disr_val(d: rbml::Doc) -> Option { reader::maybe_get_doc(d, tag_disr_val).and_then(|val_doc| { reader::with_doc_data(val_doc, |data| { - str::from_utf8(data).ok().and_then(|s| s.parse()) + str::from_utf8(data).ok().and_then(|s| s.parse().ok()) }) }) } diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 943479ff35e..6d19107096a 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -717,12 +717,16 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId { let crate_part = &buf[0u..colon_idx]; let def_part = &buf[colon_idx + 1u..len]; - let crate_num = match str::from_utf8(crate_part).ok().and_then(|s| s.parse::()) { + let crate_num = match str::from_utf8(crate_part).ok().and_then(|s| { + s.parse::().ok() + }) { Some(cn) => cn as ast::CrateNum, None => panic!("internal error: parse_def_id: crate number expected, found {:?}", crate_part) }; - let def_num = match str::from_utf8(def_part).ok().and_then(|s| s.parse::()) { + let def_num = match str::from_utf8(def_part).ok().and_then(|s| { + s.parse::().ok() + }) { Some(dn) => dn as ast::NodeId, None => panic!("internal error: parse_def_id: id expected, found {:?}", def_part) diff --git a/src/librustc/middle/infer/region_inference/graphviz.rs b/src/librustc/middle/infer/region_inference/graphviz.rs index 215c4945ea9..92d8419484a 100644 --- a/src/librustc/middle/infer/region_inference/graphviz.rs +++ b/src/librustc/middle/infer/region_inference/graphviz.rs @@ -59,7 +59,7 @@ pub fn maybe_print_constraints_for<'a, 'tcx>(region_vars: &RegionVarBindings<'a, } let requested_node : Option = - os::getenv("RUST_REGION_GRAPH_NODE").and_then(|s| s.parse()); + os::getenv("RUST_REGION_GRAPH_NODE").and_then(|s| s.parse().ok()); if requested_node.is_some() && requested_node != Some(subject_node) { return; diff --git a/src/librustc/middle/recursion_limit.rs b/src/librustc/middle/recursion_limit.rs index 81cbdf13c51..da83833fba3 100644 --- a/src/librustc/middle/recursion_limit.rs +++ b/src/librustc/middle/recursion_limit.rs @@ -18,7 +18,6 @@ use session::Session; use syntax::ast; use syntax::attr::AttrMetaMethods; -use std::str::FromStr; pub fn update_recursion_limit(sess: &Session, krate: &ast::Crate) { for attr in krate.attrs.iter() { @@ -27,7 +26,7 @@ pub fn update_recursion_limit(sess: &Session, krate: &ast::Crate) { } if let Some(s) = attr.value_str() { - if let Some(n) = FromStr::from_str(s.get()) { + if let Some(n) = s.parse().ok() { sess.recursion_limit.set(n); return; } diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 2fc68e6244a..125fbaa40e0 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -424,7 +424,7 @@ macro_rules! options { } fn parse_uint(slot: &mut uint, v: Option<&str>) -> bool { - match v.and_then(|s| s.parse()) { + match v.and_then(|s| s.parse().ok()) { Some(i) => { *slot = i; true }, None => false } @@ -432,7 +432,7 @@ macro_rules! options { fn parse_opt_uint(slot: &mut Option, v: Option<&str>) -> bool { match v { - Some(s) => { *slot = s.parse(); slot.is_some() } + Some(s) => { *slot = s.parse().ok(); slot.is_some() } None => { *slot = None; true } } } diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 4ee13f5a542..bd7ad51de37 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -99,7 +99,7 @@ pub fn parse_pretty(sess: &Session, } } }; - let opt_second = opt_second.and_then(|s| s.parse::()); + let opt_second = opt_second.and_then(|s| s.parse::().ok()); (first, opt_second) } @@ -345,13 +345,11 @@ pub enum UserIdentifiedItem { } impl FromStr for UserIdentifiedItem { - fn from_str(s: &str) -> Option { - s.parse().map(ItemViaNode).or_else(|| { - let v : Vec<_> = s.split_str("::") - .map(|x|x.to_string()) - .collect(); - Some(ItemViaPath(v)) - }) + type Err = (); + fn from_str(s: &str) -> Result { + Ok(s.parse().map(ItemViaNode).unwrap_or_else(|_| { + ItemViaPath(s.split_str("::").map(|s| s.to_string()).collect()) + })) } } diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 2e7a6fd4923..b50f12deb44 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -2127,7 +2127,7 @@ macro_rules! read_primitive { Json::F64(f) => Err(ExpectedError("Integer".to_string(), format!("{}", f))), // re: #12967.. a type w/ numeric keys (ie HashMap etc) // is going to have a string here, as per JSON spec. - Json::String(s) => match s.parse() { + Json::String(s) => match s.parse().ok() { Some(f) => Ok(f), None => Err(ExpectedError("Number".to_string(), s)), }, @@ -2165,7 +2165,7 @@ impl ::Decoder for Decoder { Json::String(s) => { // re: #12967.. a type w/ numeric keys (ie HashMap etc) // is going to have a string here, as per JSON spec. - match s.parse() { + match s.parse().ok() { Some(f) => Ok(f), None => Err(ExpectedError("Number".to_string(), s)), } @@ -2597,8 +2597,9 @@ impl<'a, T: Encodable> fmt::Display for AsPrettyJson<'a, T> { } impl FromStr for Json { - fn from_str(s: &str) -> Option { - from_str(s).ok() + type Err = BuilderError; + fn from_str(s: &str) -> Result { + from_str(s) } } diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index 82c55d7b5b8..4cd6391318f 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -20,7 +20,7 @@ mod tests { use num::FromStrRadix; fn from_str(t: &str) -> Option { - ::str::FromStr::from_str(t) + ::str::FromStr::from_str(t).ok() } #[test] @@ -38,15 +38,15 @@ mod tests { #[test] pub fn test_parse_bytes() { - assert_eq!(FromStrRadix::from_str_radix("123", 10), Some(123u as $T)); - assert_eq!(FromStrRadix::from_str_radix("1001", 2), Some(9u as $T)); - assert_eq!(FromStrRadix::from_str_radix("123", 8), Some(83u as $T)); - assert_eq!(FromStrRadix::from_str_radix("123", 16), Some(291u as u16)); - assert_eq!(FromStrRadix::from_str_radix("ffff", 16), Some(65535u as u16)); - assert_eq!(FromStrRadix::from_str_radix("z", 36), Some(35u as $T)); - - assert_eq!(FromStrRadix::from_str_radix("Z", 10), None::<$T>); - assert_eq!(FromStrRadix::from_str_radix("_", 2), None::<$T>); + assert_eq!(FromStrRadix::from_str_radix("123", 10), Ok(123u as $T)); + assert_eq!(FromStrRadix::from_str_radix("1001", 2), Ok(9u as $T)); + assert_eq!(FromStrRadix::from_str_radix("123", 8), Ok(83u as $T)); + assert_eq!(FromStrRadix::from_str_radix("123", 16), Ok(291u as u16)); + assert_eq!(FromStrRadix::from_str_radix("ffff", 16), Ok(65535u as u16)); + assert_eq!(FromStrRadix::from_str_radix("z", 36), Ok(35u as $T)); + + assert_eq!(FromStrRadix::from_str_radix("Z", 10).ok(), None::<$T>); + assert_eq!(FromStrRadix::from_str_radix("_", 2).ok(), None::<$T>); } #[test] diff --git a/src/libstd/old_io/net/ip.rs b/src/libstd/old_io/net/ip.rs index f0b73bd37f2..3e2e69f75a6 100644 --- a/src/libstd/old_io/net/ip.rs +++ b/src/libstd/old_io/net/ip.rs @@ -25,7 +25,7 @@ use iter::{Iterator, IteratorExt}; use ops::{FnOnce, FnMut}; use option::Option; use option::Option::{None, Some}; -use result::Result::{Ok, Err}; +use result::Result::{self, Ok, Err}; use slice::SliceExt; use str::{FromStr, StrExt}; use vec::Vec; @@ -350,17 +350,28 @@ impl<'a> Parser<'a> { } impl FromStr for IpAddr { - fn from_str(s: &str) -> Option { - Parser::new(s).read_till_eof(|p| p.read_ip_addr()) + type Err = ParseError; + fn from_str(s: &str) -> Result { + match Parser::new(s).read_till_eof(|p| p.read_ip_addr()) { + Some(s) => Ok(s), + None => Err(ParseError), + } } } impl FromStr for SocketAddr { - fn from_str(s: &str) -> Option { - Parser::new(s).read_till_eof(|p| p.read_socket_addr()) + type Err = ParseError; + fn from_str(s: &str) -> Result { + match Parser::new(s).read_till_eof(|p| p.read_socket_addr()) { + Some(s) => Ok(s), + None => Err(ParseError), + } } } +#[derive(Show, Clone, PartialEq, Copy)] +pub struct ParseError; + /// A trait for objects which can be converted or resolved to one or more `SocketAddr` values. /// /// Implementing types minimally have to implement either `to_socket_addr` or `to_socket_addr_all` @@ -493,7 +504,7 @@ fn parse_and_resolve_socket_addr(s: &str) -> IoResult> { let mut parts_iter = s.rsplitn(2, ':'); let port_str = try_opt!(parts_iter.next(), "invalid socket address"); let host = try_opt!(parts_iter.next(), "invalid socket address"); - let port: u16 = try_opt!(FromStr::from_str(port_str), "invalid port value"); + let port: u16 = try_opt!(port_str.parse().ok(), "invalid port value"); resolve_socket_addr(host, port) } @@ -502,7 +513,7 @@ impl<'a> ToSocketAddr for (&'a str, u16) { let (host, port) = *self; // try to parse the host as a regular IpAddr first - match FromStr::from_str(host) { + match host.parse().ok() { Some(addr) => return Ok(vec![SocketAddr { ip: addr, port: port @@ -518,7 +529,7 @@ impl<'a> ToSocketAddr for (&'a str, u16) { impl<'a> ToSocketAddr for &'a str { fn to_socket_addr(&self) -> IoResult { // try to parse as a regular SocketAddr first - match FromStr::from_str(*self) { + match self.parse().ok() { Some(addr) => return Ok(addr), None => {} } @@ -535,7 +546,7 @@ impl<'a> ToSocketAddr for &'a str { fn to_socket_addr_all(&self) -> IoResult> { // try to parse as a regular SocketAddr first - match FromStr::from_str(*self) { + match self.parse().ok() { Some(addr) => return Ok(vec![addr]), None => {} } @@ -553,95 +564,94 @@ mod test { #[test] fn test_from_str_ipv4() { - assert_eq!(Some(Ipv4Addr(127, 0, 0, 1)), FromStr::from_str("127.0.0.1")); - assert_eq!(Some(Ipv4Addr(255, 255, 255, 255)), FromStr::from_str("255.255.255.255")); - assert_eq!(Some(Ipv4Addr(0, 0, 0, 0)), FromStr::from_str("0.0.0.0")); + assert_eq!(Ok(Ipv4Addr(127, 0, 0, 1)), "127.0.0.1".parse()); + assert_eq!(Ok(Ipv4Addr(255, 255, 255, 255)), "255.255.255.255".parse()); + assert_eq!(Ok(Ipv4Addr(0, 0, 0, 0)), "0.0.0.0".parse()); // out of range - let none: Option = FromStr::from_str("256.0.0.1"); + let none: Option = "256.0.0.1".parse().ok(); assert_eq!(None, none); // too short - let none: Option = FromStr::from_str("255.0.0"); + let none: Option = "255.0.0".parse().ok(); assert_eq!(None, none); // too long - let none: Option = FromStr::from_str("255.0.0.1.2"); + let none: Option = "255.0.0.1.2".parse().ok(); assert_eq!(None, none); // no number between dots - let none: Option = FromStr::from_str("255.0..1"); + let none: Option = "255.0..1".parse().ok(); assert_eq!(None, none); } #[test] fn test_from_str_ipv6() { - assert_eq!(Some(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 0)), FromStr::from_str("0:0:0:0:0:0:0:0")); - assert_eq!(Some(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 1)), FromStr::from_str("0:0:0:0:0:0:0:1")); + assert_eq!(Ok(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 0)), "0:0:0:0:0:0:0:0".parse()); + assert_eq!(Ok(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 1)), "0:0:0:0:0:0:0:1".parse()); - assert_eq!(Some(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 1)), FromStr::from_str("::1")); - assert_eq!(Some(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 0)), FromStr::from_str("::")); + assert_eq!(Ok(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 1)), "::1".parse()); + assert_eq!(Ok(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 0)), "::".parse()); - assert_eq!(Some(Ipv6Addr(0x2a02, 0x6b8, 0, 0, 0, 0, 0x11, 0x11)), - FromStr::from_str("2a02:6b8::11:11")); + assert_eq!(Ok(Ipv6Addr(0x2a02, 0x6b8, 0, 0, 0, 0, 0x11, 0x11)), + "2a02:6b8::11:11".parse()); // too long group - let none: Option = FromStr::from_str("::00000"); + let none: Option = "::00000".parse().ok(); assert_eq!(None, none); // too short - let none: Option = FromStr::from_str("1:2:3:4:5:6:7"); + let none: Option = "1:2:3:4:5:6:7".parse().ok(); assert_eq!(None, none); // too long - let none: Option = FromStr::from_str("1:2:3:4:5:6:7:8:9"); + let none: Option = "1:2:3:4:5:6:7:8:9".parse().ok(); assert_eq!(None, none); // triple colon - let none: Option = FromStr::from_str("1:2:::6:7:8"); + let none: Option = "1:2:::6:7:8".parse().ok(); assert_eq!(None, none); // two double colons - let none: Option = FromStr::from_str("1:2::6::8"); + let none: Option = "1:2::6::8".parse().ok(); assert_eq!(None, none); } #[test] fn test_from_str_ipv4_in_ipv6() { - assert_eq!(Some(Ipv6Addr(0, 0, 0, 0, 0, 0, 49152, 545)), - FromStr::from_str("::192.0.2.33")); - assert_eq!(Some(Ipv6Addr(0, 0, 0, 0, 0, 0xFFFF, 49152, 545)), - FromStr::from_str("::FFFF:192.0.2.33")); - assert_eq!(Some(Ipv6Addr(0x64, 0xff9b, 0, 0, 0, 0, 49152, 545)), - FromStr::from_str("64:ff9b::192.0.2.33")); - assert_eq!(Some(Ipv6Addr(0x2001, 0xdb8, 0x122, 0xc000, 0x2, 0x2100, 49152, 545)), - FromStr::from_str("2001:db8:122:c000:2:2100:192.0.2.33")); + assert_eq!(Ok(Ipv6Addr(0, 0, 0, 0, 0, 0, 49152, 545)), + "::192.0.2.33".parse()); + assert_eq!(Ok(Ipv6Addr(0, 0, 0, 0, 0, 0xFFFF, 49152, 545)), + "::FFFF:192.0.2.33".parse()); + assert_eq!(Ok(Ipv6Addr(0x64, 0xff9b, 0, 0, 0, 0, 49152, 545)), + "64:ff9b::192.0.2.33".parse()); + assert_eq!(Ok(Ipv6Addr(0x2001, 0xdb8, 0x122, 0xc000, 0x2, 0x2100, 49152, 545)), + "2001:db8:122:c000:2:2100:192.0.2.33".parse()); // colon after v4 - let none: Option = FromStr::from_str("::127.0.0.1:"); + let none: Option = "::127.0.0.1:".parse().ok(); assert_eq!(None, none); // not enough groups - let none: Option = FromStr::from_str("1.2.3.4.5:127.0.0.1"); + let none: Option = "1.2.3.4.5:127.0.0.1".parse().ok(); assert_eq!(None, none); // too many groups - let none: Option = - FromStr::from_str("1.2.3.4.5:6:7:127.0.0.1"); + let none: Option = "1.2.3.4.5:6:7:127.0.0.1".parse().ok(); assert_eq!(None, none); } #[test] fn test_from_str_socket_addr() { - assert_eq!(Some(SocketAddr { ip: Ipv4Addr(77, 88, 21, 11), port: 80 }), - FromStr::from_str("77.88.21.11:80")); - assert_eq!(Some(SocketAddr { ip: Ipv6Addr(0x2a02, 0x6b8, 0, 1, 0, 0, 0, 1), port: 53 }), - FromStr::from_str("[2a02:6b8:0:1::1]:53")); - assert_eq!(Some(SocketAddr { ip: Ipv6Addr(0, 0, 0, 0, 0, 0, 0x7F00, 1), port: 22 }), - FromStr::from_str("[::127.0.0.1]:22")); + assert_eq!(Ok(SocketAddr { ip: Ipv4Addr(77, 88, 21, 11), port: 80 }), + "77.88.21.11:80".parse()); + assert_eq!(Ok(SocketAddr { ip: Ipv6Addr(0x2a02, 0x6b8, 0, 1, 0, 0, 0, 1), port: 53 }), + "[2a02:6b8:0:1::1]:53".parse()); + assert_eq!(Ok(SocketAddr { ip: Ipv6Addr(0, 0, 0, 0, 0, 0, 0x7F00, 1), port: 22 }), + "[::127.0.0.1]:22".parse()); // without port - let none: Option = FromStr::from_str("127.0.0.1"); + let none: Option = "127.0.0.1".parse().ok(); assert_eq!(None, none); // without port - let none: Option = FromStr::from_str("127.0.0.1:"); + let none: Option = "127.0.0.1:".parse().ok(); assert_eq!(None, none); // wrong brackets around v4 - let none: Option = FromStr::from_str("[127.0.0.1]:22"); + let none: Option = "[127.0.0.1]:22".parse().ok(); assert_eq!(None, none); // port out of range - let none: Option = FromStr::from_str("127.0.0.1:123456"); + let none: Option = "127.0.0.1:123456".parse().ok(); assert_eq!(None, none); } diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 588f724134e..72c41f2399e 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -19,6 +19,7 @@ use iter::{AdditiveIterator, Extend}; use iter::{Iterator, IteratorExt, Map}; use marker::Sized; use option::Option::{self, Some, None}; +use result::Result::{self, Ok, Err}; use slice::{AsSlice, Split, SliceExt, SliceConcatExt}; use str::{self, FromStr, StrExt}; use vec::Vec; @@ -86,11 +87,19 @@ impl Ord for Path { } impl FromStr for Path { - fn from_str(s: &str) -> Option { - Path::new_opt(s) + type Err = ParsePathError; + fn from_str(s: &str) -> Result { + match Path::new_opt(s) { + Some(p) => Ok(p), + None => Err(ParsePathError), + } } } +/// Valuelue indicating that a path could not be parsed from a string. +#[derive(Show, Clone, PartialEq, Copy)] +pub struct ParsePathError; + impl hash::Hash for Path { #[inline] fn hash(&self, state: &mut S) { diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 88db27013ac..f3289492390 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -27,6 +27,7 @@ use mem; use option::Option::{self, Some, None}; #[cfg(stage0)] use ops::FullRange; +use result::Result::{self, Ok, Err}; use slice::{SliceExt, SliceConcatExt}; use str::{SplitTerminator, FromStr, StrExt}; use string::{String, ToString}; @@ -115,11 +116,19 @@ impl Ord for Path { } impl FromStr for Path { - fn from_str(s: &str) -> Option { - Path::new_opt(s) + type Err = ParsePathError; + fn from_str(s: &str) -> Result { + match Path::new_opt(s) { + Some(p) => Ok(p), + None => Err(ParsePathError), + } } } +/// Value indicating that a path could not be parsed from a string. +#[derive(Show, Clone, PartialEq, Copy)] +pub struct ParsePathError; + impl hash::Hash for Path { #[cfg(not(test))] #[inline] diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 4023a0a4c10..f5727a38b69 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -51,7 +51,7 @@ pub fn min_stack() -> uint { 0 => {} n => return n - 1, } - let amt = os::getenv("RUST_MIN_STACK").and_then(|s| s.parse()); + let amt = os::getenv("RUST_MIN_STACK").and_then(|s| s.parse().ok()); let amt = amt.unwrap_or(2 * 1024 * 1024); // 0 is our sentinel value, so ensure that we'll never see 0 after // initialization has run @@ -64,7 +64,7 @@ pub fn min_stack() -> uint { pub fn default_sched_threads() -> uint { match os::getenv("RUST_THREADS") { Some(nstr) => { - let opt_n: Option = nstr.parse(); + let opt_n: Option = nstr.parse().ok(); match opt_n { Some(n) if n > 0 => n, _ => panic!("`RUST_THREADS` is `{}`, should be a positive integer", nstr) diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 493a97c24cf..2cf6058a433 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -613,7 +613,7 @@ impl<'a> StringReader<'a> { // find the integer representing the name self.scan_digits(base); let encoded_name : u32 = self.with_str_from(start_bpos, |s| { - num::from_str_radix(s, 10).unwrap_or_else(|| { + num::from_str_radix(s, 10).ok().unwrap_or_else(|| { panic!("expected digits representing a name, got {:?}, {}, range [{:?},{:?}]", s, whence, start_bpos, self.last_pos); }) @@ -631,7 +631,7 @@ impl<'a> StringReader<'a> { let start_bpos = self.last_pos; self.scan_digits(base); let encoded_ctxt : ast::SyntaxContext = self.with_str_from(start_bpos, |s| { - num::from_str_radix(s, 10).unwrap_or_else(|| { + num::from_str_radix(s, 10).ok().unwrap_or_else(|| { panic!("expected digits representing a ctxt, got {:?}, {}", s, whence); }) }); diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 1c146968fd5..e7be876edbb 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -401,7 +401,7 @@ pub fn char_lit(lit: &str) -> (char, isize) { let msg2 = &msg[]; fn esc(len: usize, lit: &str) -> Option<(char, isize)> { - num::from_str_radix(&lit[2..len], 16) + num::from_str_radix(&lit[2..len], 16).ok() .and_then(char::from_u32) .map(|x| (x, len as isize)) } @@ -410,7 +410,7 @@ pub fn char_lit(lit: &str) -> (char, isize) { if lit.as_bytes()[2] == b'{' { let idx = lit.find('}').expect(msg2); let subslice = &lit[3..idx]; - num::from_str_radix(subslice, 16) + num::from_str_radix(subslice, 16).ok() .and_then(char::from_u32) .map(|x| (x, subslice.chars().count() as isize + 4)) } else { @@ -583,7 +583,7 @@ pub fn byte_lit(lit: &str) -> (u8, usize) { b'\'' => b'\'', b'0' => b'\0', _ => { - match ::std::num::from_str_radix::(&lit[2..4], 16) { + match ::std::num::from_str_radix::(&lit[2..4], 16).ok() { Some(c) => if c > 0xFF { panic!(err(2)) @@ -732,7 +732,7 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) -> debug!("integer_lit: the type is {:?}, base {:?}, the new string is {:?}, the original \ string was {:?}, the original suffix was {:?}", ty, base, s, orig, suffix); - let res: u64 = match ::std::num::from_str_radix(s, base) { + let res: u64 = match ::std::num::from_str_radix(s, base).ok() { Some(r) => r, None => { sd.span_err(sp, "int literal is too large"); 0 } }; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c4224db8e18..d99095eeba3 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2459,7 +2459,7 @@ impl<'a> Parser<'a> { hi = self.span.hi; self.bump(); - let index = n.as_str().parse::(); + let index = n.as_str().parse::().ok(); match index { Some(n) => { let id = spanned(dot, hi, n); @@ -2479,7 +2479,7 @@ impl<'a> Parser<'a> { self.span_err(last_span, &format!("unexpected token: `{}`", n.as_str())[]); if fstr.chars().all(|x| "0123456789.".contains_char(x)) { - let float = match fstr.parse::() { + let float = match fstr.parse::().ok() { Some(f) => f, None => continue, }; diff --git a/src/libsyntax/show_span.rs b/src/libsyntax/show_span.rs index 57520257fe1..6492cd4b095 100644 --- a/src/libsyntax/show_span.rs +++ b/src/libsyntax/show_span.rs @@ -27,14 +27,15 @@ enum Mode { } impl FromStr for Mode { - fn from_str(s: &str) -> Option { + type Err = (); + fn from_str(s: &str) -> Result { let mode = match s { "expr" => Mode::Expression, "pat" => Mode::Pattern, "ty" => Mode::Type, - _ => return None + _ => return Err(()) }; - Some(mode) + Ok(mode) } } @@ -73,7 +74,7 @@ impl<'a, 'v> Visitor<'v> for ShowSpanVisitor<'a> { pub fn run(span_diagnostic: &diagnostic::SpanHandler, mode: &str, krate: &ast::Crate) { - let mode = match mode.parse() { + let mode = match mode.parse().ok() { Some(mode) => mode, None => return }; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 8fea6bb539f..e49efebfef4 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -74,7 +74,6 @@ use std::old_io; use std::iter::repeat; use std::num::{Float, Int}; use std::os; -use std::str::FromStr; use std::sync::mpsc::{channel, Sender}; use std::thread::{self, Thread}; use std::thunk::{Thunk, Invoke}; @@ -818,7 +817,7 @@ fn get_concurrency() -> uint { use std::rt; match os::getenv("RUST_TEST_TASKS") { Some(s) => { - let opt_n: Option = FromStr::from_str(s.as_slice()); + let opt_n: Option = s.parse().ok(); match opt_n { Some(n) if n > 0 => n, _ => panic!("RUST_TEST_TASKS is `{}`, should be a positive integer.", s) diff --git a/src/test/auxiliary/static-methods-crate.rs b/src/test/auxiliary/static-methods-crate.rs index 1b18571cf8c..6cb16f04ce1 100644 --- a/src/test/auxiliary/static-methods-crate.rs +++ b/src/test/auxiliary/static-methods-crate.rs @@ -19,7 +19,7 @@ pub trait read { impl read for int { fn readMaybe(s: String) -> Option { - s.parse() + s.parse().ok() } } diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index 7fad2c9b4be..15a63e153b9 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -232,7 +232,7 @@ fn main() { } else { std::os::args().as_slice() .get(1) - .and_then(|arg| arg.parse()) + .and_then(|arg| arg.parse().ok()) .unwrap_or(600u) }; diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index e12a9e7cb16..03666c84d57 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -182,7 +182,7 @@ fn fannkuch(n: i32) -> (i32, i32) { fn main() { let n = std::os::args().as_slice() .get(1) - .and_then(|arg| arg.parse()) + .and_then(|arg| arg.parse().ok()) .unwrap_or(2i32); let (checksum, maxflips) = fannkuch(n); diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index 7325b8a4738..b2161000322 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -174,7 +174,7 @@ fn main() { 5000000 } else { std::os::args().get(1) - .and_then(|arg| arg.parse()) + .and_then(|arg| arg.parse().ok()) .unwrap_or(1000) }; let mut bodies = BODIES; diff --git a/src/test/bench/shootout-threadring.rs b/src/test/bench/shootout-threadring.rs index 47f17997e84..ebe8a0751c3 100644 --- a/src/test/bench/shootout-threadring.rs +++ b/src/test/bench/shootout-threadring.rs @@ -68,10 +68,10 @@ fn main() { let token = if std::os::getenv("RUST_BENCH").is_some() { 2000000 } else { - args.get(1).and_then(|arg| arg.parse()).unwrap_or(1000) + args.get(1).and_then(|arg| arg.parse().ok()).unwrap_or(1000) }; let n_tasks = args.get(2) - .and_then(|arg| arg.parse()) + .and_then(|arg| arg.parse().ok()) .unwrap_or(503); start(n_tasks, token); diff --git a/src/test/run-pass/match-with-ret-arm.rs b/src/test/run-pass/match-with-ret-arm.rs index a1537e63e57..05c6aac90e3 100644 --- a/src/test/run-pass/match-with-ret-arm.rs +++ b/src/test/run-pass/match-with-ret-arm.rs @@ -14,7 +14,7 @@ pub fn main() { // sometimes we have had trouble finding // the right type for f, as we unified // bot and u32 here - let f = match "1234".parse::() { + let f = match "1234".parse::().ok() { None => return (), Some(num) => num as u32 }; diff --git a/src/test/run-pass/wait-forked-but-failed-child.rs b/src/test/run-pass/wait-forked-but-failed-child.rs index ef48bdff11d..12de40129fd 100644 --- a/src/test/run-pass/wait-forked-but-failed-child.rs +++ b/src/test/run-pass/wait-forked-but-failed-child.rs @@ -41,7 +41,7 @@ fn find_zombies() { if 0 < line_no && 0 < line.len() && my_pid == line.split(' ').filter(|w| 0 < w.len()).nth(1) .expect("1st column should be PPID") - .parse() + .parse().ok() .expect("PPID string into integer") && line.contains("defunct") { panic!("Zombie child {}", line); -- cgit 1.4.1-3-g733a5 From 62273575139a80c2b208a3a27e0c2392b1425be6 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 13 Jan 2015 15:42:53 -0800 Subject: std: Stabilize the std::fmt module This commit performs a final stabilization pass over the std::fmt module, marking all necessary APIs as stable. One of the more interesting aspects of this module is that it exposes a good deal of its runtime representation to the outside world in order for `format_args!` to be able to construct the format strings. Instead of hacking the compiler to assume that these items are stable, this commit instead lays out a story for the stabilization and evolution of these APIs. There are three primary details used by the `format_args!` macro: 1. `Arguments` - an opaque package of a "compiled format string". This structure is passed around and the `write` function is the source of truth for transforming a compiled format string into a string at runtime. This must be able to be constructed in stable code. 2. `Argument` - an opaque structure representing an argument to a format string. This is *almost* a trait object as it's just a pointer/function pair, but due to the function originating from one of many traits, it's not actually a trait object. Like `Arguments`, this must be constructed from stable code. 3. `fmt::rt` - this module contains the runtime type definitions primarily for the `rt::Argument` structure. Whenever an argument is formatted with nonstandard flags, a corresponding `rt::Argument` is generated describing how the argument is being formatted. This can be used to construct an `Arguments`. The primary interface to `std::fmt` is the `Arguments` structure, and as such this type name is stabilize as-is today. It is expected for libraries to pass around an `Arguments` structure to represent a pending formatted computation. The remaining portions are largely "cruft" which would rather not be stabilized, but due to the stability checks they must be. As a result, almost all pieces have been renamed to represent that they are "version 1" of the formatting representation. The theory is that at a later date if we change the representation of these types we can add new definitions called "version 2" and corresponding constructors for `Arguments`. One of the other remaining large questions about the fmt module were how the pending I/O reform would affect the signatures of methods in the module. Due to [RFC 526][rfc], however, the writers of fmt are now incompatible with the writers of io, so this question has largely been solved. As a result the interfaces are largely stabilized as-is today. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md Specifically, the following changes were made: * The contents of `fmt::rt` were all moved under `fmt::rt::v1` * `fmt::rt` is stable * `fmt::rt::v1` is stable * `Error` is stable * `Writer` is stable * `Writer::write_str` is stable * `Writer::write_fmt` is stable * `Formatter` is stable * `Argument` has been renamed to `ArgumentV1` and is stable * `ArgumentV1::new` is stable * `ArgumentV1::from_uint` is stable * `Arguments::new_v1` is stable (renamed from `new`) * `Arguments::new_v1_formatted` is stable (renamed from `with_placeholders`) * All formatting traits are now stable, as well as the `fmt` method. * `fmt::write` is stable * `fmt::format` is stable * `Formatter::pad_integral` is stable * `Formatter::pad` is stable * `Formatter::write_str` is stable * `Formatter::write_fmt` is stable * Some assorted top level items which were only used by `format_args!` were removed in favor of static functions on `ArgumentV1` as well. * The formatting-flag-accessing methods remain unstable Within the contents of the `fmt::rt::v1` module, the following actions were taken: * Reexports of all enum variants were removed * All prefixes on enum variants were removed * A few miscellaneous enum variants were renamed * Otherwise all structs, fields, and variants were marked stable. In addition to these actions in the `std::fmt` module, many implementations of `Show` and `String` were stabilized as well. In some other modules: * `ToString` is now stable * `ToString::to_string` is now stable * `Vec` no longer implements `fmt::Writer` (this has moved to `String`) This is a breaking change due to all of the changes to the `fmt::rt` module, but this likely will not have much impact on existing programs. Closes #20661 [breaking-change] --- src/liballoc/arc.rs | 29 +-- src/libcollections/bit.rs | 1 + src/libcollections/enum_set.rs | 1 + src/libcollections/string.rs | 4 + src/libcollections/vec.rs | 7 - src/libcore/fmt/mod.rs | 252 ++++++++++++--------- src/libcore/fmt/rt.rs | 86 ------- src/libcore/fmt/rt/v1.rs | 94 ++++++++ src/libcore/result.rs | 6 +- src/libgraphviz/lib.rs | 16 +- src/librustc/middle/cfg/graphviz.rs | 4 +- .../middle/infer/region_inference/graphviz.rs | 4 +- src/libserialize/json.rs | 4 +- src/libstd/ffi/c_str.rs | 2 +- src/libstd/fmt.rs | 7 +- src/libstd/old_io/process.rs | 5 +- src/libstd/sync/mpsc/mod.rs | 6 +- src/libsyntax/ext/format.rs | 136 +++++------ src/test/compile-fail/lint-dead-code-4.rs | 1 - src/test/compile-fail/missing_debug_impls.rs | 1 - src/test/pretty/issue-4264.pp | 62 +++-- 21 files changed, 379 insertions(+), 349 deletions(-) delete mode 100644 src/libcore/fmt/rt.rs create mode 100644 src/libcore/fmt/rt/v1.rs (limited to 'src/libstd') diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index f9f6de2df58..32fe2bb0a32 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -12,20 +12,22 @@ //! Threadsafe reference-counted boxes (the `Arc` type). //! -//! The `Arc` type provides shared ownership of an immutable value. Destruction is -//! deterministic, and will occur as soon as the last owner is gone. It is marked as `Send` because -//! it uses atomic reference counting. +//! The `Arc` type provides shared ownership of an immutable value. +//! Destruction is deterministic, and will occur as soon as the last owner is +//! gone. It is marked as `Send` because it uses atomic reference counting. //! -//! If you do not need thread-safety, and just need shared ownership, consider the [`Rc` -//! type](../rc/struct.Rc.html). It is the same as `Arc`, but does not use atomics, making it -//! both thread-unsafe as well as significantly faster when updating the reference count. +//! If you do not need thread-safety, and just need shared ownership, consider +//! the [`Rc` type](../rc/struct.Rc.html). It is the same as `Arc`, but +//! does not use atomics, making it both thread-unsafe as well as significantly +//! faster when updating the reference count. //! -//! The `downgrade` method can be used to create a non-owning `Weak` pointer to the box. A -//! `Weak` pointer can be upgraded to an `Arc` pointer, but will return `None` if the value -//! has already been dropped. +//! The `downgrade` method can be used to create a non-owning `Weak` pointer +//! to the box. A `Weak` pointer can be upgraded to an `Arc` pointer, but +//! will return `None` if the value has already been dropped. //! -//! For example, a tree with parent pointers can be represented by putting the nodes behind strong -//! `Arc` pointers, and then storing the parent pointers as `Weak` pointers. +//! For example, a tree with parent pointers can be represented by putting the +//! nodes behind strong `Arc` pointers, and then storing the parent pointers +//! as `Weak` pointers. //! //! # Examples //! @@ -87,8 +89,9 @@ use heap::deallocate; /// /// # Example /// -/// In this example, a large vector of floats is shared between several tasks. With simple pipes, -/// without `Arc`, a copy would have to be made for each task. +/// In this example, a large vector of floats is shared between several tasks. +/// With simple pipes, without `Arc`, a copy would have to be made for each +/// task. /// /// ```rust /// use std::sync::Arc; diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index c6275740579..99f650db449 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -1730,6 +1730,7 @@ impl BitvSet { } } +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for BitvSet { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { try!(write!(fmt, "BitvSet {{")); diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index b542259eba0..c70794262c9 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -31,6 +31,7 @@ pub struct EnumSet { impl Copy for EnumSet {} +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for EnumSet { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { try!(write!(fmt, "EnumSet {{")); diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 8f7920fe1c4..ae52eff0111 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -938,11 +938,14 @@ impl FromStr for String { } /// A generic trait for converting a value to a string +#[stable(feature = "rust1", since = "1.0.0")] pub trait ToString { /// Converts the value of `self` to an owned string + #[stable(feature = "rust1", since = "1.0.0")] fn to_string(&self) -> String; } +#[stable(feature = "rust1", since = "1.0.0")] impl ToString for T { #[inline] fn to_string(&self) -> String { @@ -979,6 +982,7 @@ impl<'a> Str for CowString<'a> { } } +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Writer for String { #[inline] fn write_str(&mut self, s: &str) -> fmt::Result { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 336a3d7521a..f57bffa1900 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1546,13 +1546,6 @@ impl fmt::Debug for Vec { } } -impl<'a> fmt::Writer for Vec { - fn write_str(&mut self, s: &str) -> fmt::Result { - self.push_all(s.as_bytes()); - Ok(()) - } -} - //////////////////////////////////////////////////////////////////////////////// // Clone-on-write //////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 8b7a4c677ac..2ff67ebd550 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -10,7 +10,6 @@ //! Utilities for formatting and printing strings -#![allow(unused_variables)] #![stable(feature = "rust1", since = "1.0.0")] use any; @@ -27,6 +26,7 @@ use result; use slice::SliceExt; use slice; use str::{self, StrExt}; +use self::rt::v1::Alignment; pub use self::num::radix; pub use self::num::Radix; @@ -34,10 +34,15 @@ pub use self::num::RadixFmt; mod num; mod float; -pub mod rt; -#[unstable(feature = "core", - reason = "core and I/O reconciliation may alter this definition")] +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(hidden)] +pub mod rt { + #[cfg(stage0)] pub use self::v1::*; + pub mod v1; +} + +#[stable(feature = "rust1", since = "1.0.0")] /// The type returned by formatter methods. pub type Result = result::Result<(), Error>; @@ -46,8 +51,7 @@ pub type Result = result::Result<(), Error>; /// This type does not support transmission of an error other than that an error /// occurred. Any extra information must be arranged to be transmitted through /// some other means. -#[unstable(feature = "core", - reason = "core and I/O reconciliation may alter this definition")] +#[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy, Debug)] pub struct Error; @@ -60,8 +64,7 @@ pub struct Error; /// This trait should generally not be implemented by consumers of the standard /// library. The `write!` macro accepts an instance of `io::Writer`, and the /// `io::Writer` trait is favored over implementing this trait. -#[unstable(feature = "core", - reason = "waiting for core and I/O reconciliation")] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Writer { /// Writes a slice of bytes into this writer, returning whether the write /// succeeded. @@ -73,12 +76,14 @@ pub trait Writer { /// # Errors /// /// This function will return an instance of `FormatError` on error. + #[stable(feature = "rust1", since = "1.0.0")] fn write_str(&mut self, s: &str) -> Result; /// Glue for usage of the `write!` macro with implementers of this trait. /// /// This method should generally not be invoked manually, but rather through /// the `write!` macro itself. + #[stable(feature = "rust1", since = "1.0.0")] fn write_fmt(&mut self, args: Arguments) -> Result { // This Adapter is needed to allow `self` (of type `&mut // Self`) to be cast to a FormatWriter (below) without @@ -104,18 +109,17 @@ pub trait Writer { /// A struct to represent both where to emit formatting strings to and how they /// should be formatted. A mutable version of this is passed to all formatting /// traits. -#[unstable(feature = "core", - reason = "name may change and implemented traits are also unstable")] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Formatter<'a> { flags: uint, fill: char, - align: rt::Alignment, + align: rt::v1::Alignment, width: Option, precision: Option, buf: &'a mut (Writer+'a), - curarg: slice::Iter<'a, Argument<'a>>, - args: &'a [Argument<'a>], + curarg: slice::Iter<'a, ArgumentV1<'a>>, + args: &'a [ArgumentV1<'a>], } // NB. Argument is essentially an optimized partially applied formatting function, @@ -127,35 +131,40 @@ enum Void {} /// family of functions. It contains a function to format the given value. At /// compile time it is ensured that the function and the value have the correct /// types, and then this struct is used to canonicalize arguments to one type. -#[unstable(feature = "core", - reason = "implementation detail of the `format_args!` macro")] #[derive(Copy)] -pub struct Argument<'a> { +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(hidden)] +pub struct ArgumentV1<'a> { value: &'a Void, formatter: fn(&Void, &mut Formatter) -> Result, } -impl<'a> Argument<'a> { +impl<'a> ArgumentV1<'a> { #[inline(never)] fn show_uint(x: &uint, f: &mut Formatter) -> Result { Display::fmt(x, f) } - fn new<'b, T>(x: &'b T, f: fn(&T, &mut Formatter) -> Result) -> Argument<'b> { + #[doc(hidden)] + #[stable(feature = "rust1", since = "1.0.0")] + pub fn new<'b, T>(x: &'b T, + f: fn(&T, &mut Formatter) -> Result) -> ArgumentV1<'b> { unsafe { - Argument { + ArgumentV1 { formatter: mem::transmute(f), value: mem::transmute(x) } } } - fn from_uint(x: &uint) -> Argument { - Argument::new(x, Argument::show_uint) + #[doc(hidden)] + #[stable(feature = "rust1", since = "1.0.0")] + pub fn from_uint(x: &uint) -> ArgumentV1 { + ArgumentV1::new(x, ArgumentV1::show_uint) } fn as_uint(&self) -> Option { - if self.formatter as uint == Argument::show_uint as uint { + if self.formatter as uint == ArgumentV1::show_uint as uint { Some(unsafe { *(self.value as *const _ as *const uint) }) } else { None @@ -163,14 +172,32 @@ impl<'a> Argument<'a> { } } +// flags available in the v1 format of format_args +#[derive(Copy)] +#[allow(dead_code)] // SignMinus isn't currently used +enum FlagV1 { SignPlus, SignMinus, Alternate, SignAwareZeroPad, } + impl<'a> Arguments<'a> { /// When using the format_args!() macro, this function is used to generate the /// Arguments structure. #[doc(hidden)] #[inline] - #[unstable(feature = "core", - reason = "implementation detail of the `format_args!` macro")] + #[stable(feature = "rust1", since = "1.0.0")] + pub fn new_v1(pieces: &'a [&'a str], + args: &'a [ArgumentV1<'a>]) -> Arguments<'a> { + Arguments { + pieces: pieces, + fmt: None, + args: args + } + } + + /// When using the format_args!() macro, this function is used to generate the + /// Arguments structure. + #[doc(hidden)] #[inline] + #[cfg(stage0)] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new(pieces: &'a [&'a str], - args: &'a [Argument<'a>]) -> Arguments<'a> { + args: &'a [ArgumentV1<'a>]) -> Arguments<'a> { Arguments { pieces: pieces, fmt: None, @@ -185,11 +212,28 @@ impl<'a> Arguments<'a> { /// created with `argumentuint`. However, failing to do so doesn't cause /// unsafety, but will ignore invalid . #[doc(hidden)] #[inline] - #[unstable(feature = "core", - reason = "implementation detail of the `format_args!` macro")] + #[cfg(stage0)] + #[stable(feature = "rust1", since = "1.0.0")] pub fn with_placeholders(pieces: &'a [&'a str], - fmt: &'a [rt::Argument], - args: &'a [Argument<'a>]) -> Arguments<'a> { + fmt: &'a [rt::v1::Argument], + args: &'a [ArgumentV1<'a>]) -> Arguments<'a> { + Arguments { + pieces: pieces, + fmt: Some(fmt), + args: args + } + } + /// This function is used to specify nonstandard formatting parameters. + /// The `pieces` array must be at least as long as `fmt` to construct + /// a valid Arguments structure. Also, any `Count` within `fmt` that is + /// `CountIsParam` or `CountIsNextParam` has to point to an argument + /// created with `argumentuint`. However, failing to do so doesn't cause + /// unsafety, but will ignore invalid . + #[doc(hidden)] #[inline] + #[cfg(not(stage0))] + pub fn new_v1_formatted(pieces: &'a [&'a str], + args: &'a [ArgumentV1<'a>], + fmt: &'a [rt::v1::Argument]) -> Arguments<'a> { Arguments { pieces: pieces, fmt: Some(fmt), @@ -214,11 +258,11 @@ pub struct Arguments<'a> { pieces: &'a [&'a str], // Placeholder specs, or `None` if all specs are default (as in "{}{}"). - fmt: Option<&'a [rt::Argument]>, + fmt: Option<&'a [rt::v1::Argument]>, // Dynamic arguments for interpolation, to be interleaved with string // pieces. (Every argument is preceded by a string piece.) - args: &'a [Argument<'a>], + args: &'a [ArgumentV1<'a>], } #[stable(feature = "rust1", since = "1.0.0")] @@ -237,20 +281,20 @@ impl<'a> Display for Arguments<'a> { /// Format trait for the `:?` format. Useful for debugging, all types /// should implement this. -#[unstable(feature = "core", - reason = "I/O and core have yet to be reconciled")] #[deprecated(since = "1.0.0", reason = "renamed to Debug")] +#[unstable(feature = "old_fmt")] pub trait Show { /// Formats the value using the given formatter. + #[stable(feature = "rust1", since = "1.0.0")] fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `:?` format. Useful for debugging, all types /// should implement this. -#[unstable(feature = "core", - reason = "I/O and core have yet to be reconciled")] -#[rustc_on_unimplemented = "`{Self}` cannot be formatted using `:?`; if it is defined in your \ - crate, add `#[derive(Debug)]` or manually implement it"] +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented = "`{Self}` cannot be formatted using `:?`; if it is \ + defined in your crate, add `#[derive(Debug)]` or \ + manually implement it"] #[lang = "debug_trait"] pub trait Debug { /// Formats the value using the given formatter. @@ -264,19 +308,20 @@ impl Debug for T { /// When a value can be semantically expressed as a String, this trait may be /// used. It corresponds to the default format, `{}`. -#[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "renamed to Display")] +#[unstable(feature = "old_fmt")] pub trait String { /// Formats the value using the given formatter. + #[stable(feature = "rust1", since = "1.0.0")] fn fmt(&self, &mut Formatter) -> Result; } /// When a value can be semantically expressed as a String, this trait may be /// used. It corresponds to the default format, `{}`. -#[unstable(feature = "core", - reason = "I/O and core have yet to be reconciled")] -#[rustc_on_unimplemented = "`{Self}` cannot be formatted with the default formatter; try using \ - `:?` instead if you are using a format string"] +#[rustc_on_unimplemented = "`{Self}` cannot be formatted with the default \ + formatter; try using `:?` instead if you are using \ + a format string"] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Display { /// Formats the value using the given formatter. fn fmt(&self, &mut Formatter) -> Result; @@ -288,58 +333,58 @@ impl Display for T { } /// Format trait for the `o` character -#[unstable(feature = "core", - reason = "I/O and core have yet to be reconciled")] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Octal { /// Formats the value using the given formatter. + #[stable(feature = "rust1", since = "1.0.0")] fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `b` character -#[unstable(feature = "core", - reason = "I/O and core have yet to be reconciled")] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Binary { /// Formats the value using the given formatter. + #[stable(feature = "rust1", since = "1.0.0")] fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `x` character -#[unstable(feature = "core", - reason = "I/O and core have yet to be reconciled")] +#[stable(feature = "rust1", since = "1.0.0")] pub trait LowerHex { /// Formats the value using the given formatter. + #[stable(feature = "rust1", since = "1.0.0")] fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `X` character -#[unstable(feature = "core", - reason = "I/O and core have yet to be reconciled")] +#[stable(feature = "rust1", since = "1.0.0")] pub trait UpperHex { /// Formats the value using the given formatter. + #[stable(feature = "rust1", since = "1.0.0")] fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `p` character -#[unstable(feature = "core", - reason = "I/O and core have yet to be reconciled")] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Pointer { /// Formats the value using the given formatter. + #[stable(feature = "rust1", since = "1.0.0")] fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `e` character -#[unstable(feature = "core", - reason = "I/O and core have yet to be reconciled")] +#[stable(feature = "rust1", since = "1.0.0")] pub trait LowerExp { /// Formats the value using the given formatter. + #[stable(feature = "rust1", since = "1.0.0")] fn fmt(&self, &mut Formatter) -> Result; } /// Format trait for the `E` character -#[unstable(feature = "core", - reason = "I/O and core have yet to be reconciled")] +#[stable(feature = "rust1", since = "1.0.0")] pub trait UpperExp { /// Formats the value using the given formatter. + #[stable(feature = "rust1", since = "1.0.0")] fn fmt(&self, &mut Formatter) -> Result; } @@ -351,16 +396,14 @@ pub trait UpperExp { /// /// * output - the buffer to write output to /// * args - the precompiled arguments generated by `format_args!` -#[unstable(feature = "core", - reason = "libcore and I/O have yet to be reconciled, and this is an \ - implementation detail which should not otherwise be exported")] +#[stable(feature = "rust1", since = "1.0.0")] pub fn write(output: &mut Writer, args: Arguments) -> Result { let mut formatter = Formatter { flags: 0, width: None, precision: None, buf: output, - align: rt::AlignUnknown, + align: Alignment::Unknown, fill: ' ', args: args.args, curarg: args.args.iter(), @@ -402,7 +445,7 @@ impl<'a> Formatter<'a> { // First up is the collection of functions used to execute a format string // at runtime. This consumes all of the compile-time statics generated by // the format! syntax extension. - fn run(&mut self, arg: &rt::Argument) -> Result { + fn run(&mut self, arg: &rt::v1::Argument) -> Result { // Fill in the format parameters into the formatter self.fill = arg.format.fill; self.align = arg.format.align; @@ -412,22 +455,22 @@ impl<'a> Formatter<'a> { // Extract the correct argument let value = match arg.position { - rt::ArgumentNext => { *self.curarg.next().unwrap() } - rt::ArgumentIs(i) => self.args[i], + rt::v1::Position::Next => { *self.curarg.next().unwrap() } + rt::v1::Position::At(i) => self.args[i], }; // Then actually do some printing (value.formatter)(value.value, self) } - fn getcount(&mut self, cnt: &rt::Count) -> Option { + fn getcount(&mut self, cnt: &rt::v1::Count) -> Option { match *cnt { - rt::CountIs(n) => Some(n), - rt::CountImplied => None, - rt::CountIsParam(i) => { + rt::v1::Count::Is(n) => Some(n), + rt::v1::Count::Implied => None, + rt::v1::Count::Param(i) => { self.args[i].as_uint() } - rt::CountIsNextParam => { + rt::v1::Count::NextParam => { self.curarg.next().and_then(|arg| arg.as_uint()) } } @@ -437,8 +480,8 @@ impl<'a> Formatter<'a> { // all formatting traits can use. /// Performs the correct padding for an integer which has already been - /// emitted into a byte-array. The byte-array should *not* contain the sign - /// for the integer, that will be added by this method. + /// emitted into a str. The str should *not* contain the sign for the + /// integer, that will be added by this method. /// /// # Arguments /// @@ -449,27 +492,25 @@ impl<'a> Formatter<'a> { /// /// This function will correctly account for the flags provided as well as /// the minimum width. It will not take precision into account. - #[unstable(feature = "core", - reason = "definition may change slightly over time")] + #[stable(feature = "rust1", since = "1.0.0")] pub fn pad_integral(&mut self, is_positive: bool, prefix: &str, buf: &str) -> Result { use char::CharExt; - use fmt::rt::{FlagAlternate, FlagSignPlus, FlagSignAwareZeroPad}; let mut width = buf.len(); let mut sign = None; if !is_positive { sign = Some('-'); width += 1; - } else if self.flags & (1 << (FlagSignPlus as uint)) != 0 { + } else if self.flags & (1 << (FlagV1::SignPlus as uint)) != 0 { sign = Some('+'); width += 1; } let mut prefixed = false; - if self.flags & (1 << (FlagAlternate as uint)) != 0 { + if self.flags & (1 << (FlagV1::Alternate as uint)) != 0 { prefixed = true; width += prefix.char_len(); } @@ -499,16 +540,16 @@ impl<'a> Formatter<'a> { } // The sign and prefix goes before the padding if the fill character // is zero - Some(min) if self.flags & (1 << (FlagSignAwareZeroPad as uint)) != 0 => { + Some(min) if self.flags & (1 << (FlagV1::SignAwareZeroPad as uint)) != 0 => { self.fill = '0'; try!(write_prefix(self)); - self.with_padding(min - width, rt::AlignRight, |f| { + self.with_padding(min - width, Alignment::Right, |f| { f.buf.write_str(buf) }) } // Otherwise, the sign and prefix goes after the padding Some(min) => { - self.with_padding(min - width, rt::AlignRight, |f| { + self.with_padding(min - width, Alignment::Right, |f| { try!(write_prefix(f)); f.buf.write_str(buf) }) } @@ -526,8 +567,7 @@ impl<'a> Formatter<'a> { /// is longer than this length /// /// Notably this function ignored the `flag` parameters - #[unstable(feature = "core", - reason = "definition may change slightly over time")] + #[stable(feature = "rust1", since = "1.0.0")] pub fn pad(&mut self, s: &str) -> Result { // Make sure there's a fast path up front if self.width.is_none() && self.precision.is_none() { @@ -561,7 +601,7 @@ impl<'a> Formatter<'a> { // If we're under both the maximum and the minimum width, then fill // up the minimum width with the specified string + some alignment. Some(width) => { - self.with_padding(width - s.char_len(), rt::AlignLeft, |me| { + self.with_padding(width - s.char_len(), Alignment::Left, |me| { me.buf.write_str(s) }) } @@ -570,19 +610,20 @@ impl<'a> Formatter<'a> { /// Runs a callback, emitting the correct padding either before or /// afterwards depending on whether right or left alignment is requested. - fn with_padding(&mut self, padding: uint, default: rt::Alignment, f: F) -> Result where - F: FnOnce(&mut Formatter) -> Result, + fn with_padding(&mut self, padding: uint, default: Alignment, + f: F) -> Result + where F: FnOnce(&mut Formatter) -> Result, { use char::CharExt; let align = match self.align { - rt::AlignUnknown => default, + Alignment::Unknown => default, _ => self.align }; let (pre_pad, post_pad) = match align { - rt::AlignLeft => (0, padding), - rt::AlignRight | rt::AlignUnknown => (padding, 0), - rt::AlignCenter => (padding / 2, (padding + 1) / 2), + Alignment::Left => (0, padding), + Alignment::Right | Alignment::Unknown => (padding, 0), + Alignment::Center => (padding / 2, (padding + 1) / 2), }; let mut fill = [0u8; 4]; @@ -604,23 +645,20 @@ impl<'a> Formatter<'a> { /// Writes some data to the underlying buffer contained within this /// formatter. - #[unstable(feature = "core", - reason = "reconciling core and I/O may alter this definition")] + #[stable(feature = "rust1", since = "1.0.0")] pub fn write_str(&mut self, data: &str) -> Result { self.buf.write_str(data) } /// Writes some formatted information into this instance - #[unstable(feature = "core", - reason = "reconciling core and I/O may alter this definition")] + #[stable(feature = "rust1", since = "1.0.0")] pub fn write_fmt(&mut self, fmt: Arguments) -> Result { write(self.buf, fmt) } /// Flags for formatting (packed version of rt::Flag) - #[unstable(feature = "core", - reason = "return type may change and method was just created")] - pub fn flags(&self) -> uint { self.flags } + #[stable(feature = "rust1", since = "1.0.0")] + pub fn flags(&self) -> usize { self.flags } /// Character used as 'fill' whenever there is alignment #[unstable(feature = "core", reason = "method was just created")] @@ -628,7 +666,7 @@ impl<'a> Formatter<'a> { /// Flag indicating what form of alignment was requested #[unstable(feature = "core", reason = "method was just created")] - pub fn align(&self) -> rt::Alignment { self.align } + pub fn align(&self) -> Alignment { self.align } /// Optionally specified integer width that the output should be #[unstable(feature = "core", reason = "method was just created")] @@ -649,20 +687,20 @@ impl Display for Error { /// This is a function which calls are emitted to by the compiler itself to /// create the Argument structures that are passed into the `format` function. #[doc(hidden)] #[inline] -#[unstable(feature = "core", - reason = "implementation detail of the `format_args!` macro")] +#[cfg(stage0)] +#[stable(feature = "rust1", since = "1.0.0")] pub fn argument<'a, T>(f: fn(&T, &mut Formatter) -> Result, - t: &'a T) -> Argument<'a> { - Argument::new(t, f) + t: &'a T) -> ArgumentV1<'a> { + ArgumentV1::new(t, f) } /// When the compiler determines that the type of an argument *must* be a uint /// (such as for width and precision), then it invokes this method. #[doc(hidden)] #[inline] -#[unstable(feature = "core", - reason = "implementation detail of the `format_args!` macro")] -pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> { - Argument::from_uint(s) +#[cfg(stage0)] +#[stable(feature = "rust1", since = "1.0.0")] +pub fn argumentuint<'a>(s: &'a uint) -> ArgumentV1<'a> { + ArgumentV1::from_uint(s) } // Implementations of the core formatting traits @@ -741,9 +779,9 @@ impl Display for char { #[stable(feature = "rust1", since = "1.0.0")] impl Pointer for *const T { fn fmt(&self, f: &mut Formatter) -> Result { - f.flags |= 1 << (rt::FlagAlternate as uint); + f.flags |= 1 << (FlagV1::Alternate as uint); let ret = LowerHex::fmt(&(*self as uint), f); - f.flags &= !(1 << (rt::FlagAlternate as uint)); + f.flags &= !(1 << (FlagV1::Alternate as uint)); ret } } @@ -899,7 +937,7 @@ impl<'a> Debug for &'a (any::Any+'a) { #[stable(feature = "rust1", since = "1.0.0")] impl Debug for [T] { fn fmt(&self, f: &mut Formatter) -> Result { - if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 { + if f.flags & (1 << (FlagV1::Alternate as uint)) == 0 { try!(write!(f, "[")); } let mut is_first = true; @@ -911,7 +949,7 @@ impl Debug for [T] { } try!(write!(f, "{:?}", *x)) } - if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 { + if f.flags & (1 << (FlagV1::Alternate as uint)) == 0 { try!(write!(f, "]")); } Ok(()) diff --git a/src/libcore/fmt/rt.rs b/src/libcore/fmt/rt.rs deleted file mode 100644 index 0b2c1efbc5d..00000000000 --- a/src/libcore/fmt/rt.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! This is an internal module used by the ifmt! runtime. These structures are -//! emitted to static arrays to precompile format strings ahead of time. -//! -//! These definitions are similar to their `ct` equivalents, but differ in that -//! these can be statically allocated and are slightly optimized for the runtime - -#![unstable(feature = "core", - reason = "implementation detail of the `format_args!` macro")] - -pub use self::Alignment::*; -pub use self::Count::*; -pub use self::Position::*; -pub use self::Flag::*; - -#[doc(hidden)] -#[derive(Copy)] -pub struct Argument { - pub position: Position, - pub format: FormatSpec, -} - -#[doc(hidden)] -#[derive(Copy)] -pub struct FormatSpec { - pub fill: char, - pub align: Alignment, - pub flags: uint, - pub precision: Count, - pub width: Count, -} - -/// Possible alignments that can be requested as part of a formatting directive. -#[derive(Copy, PartialEq)] -pub enum Alignment { - /// Indication that contents should be left-aligned. - AlignLeft, - /// Indication that contents should be right-aligned. - AlignRight, - /// Indication that contents should be center-aligned. - AlignCenter, - /// No alignment was requested. - AlignUnknown, -} - -#[doc(hidden)] -#[derive(Copy)] -pub enum Count { - CountIs(uint), CountIsParam(uint), CountIsNextParam, CountImplied, -} - -#[doc(hidden)] -#[derive(Copy)] -pub enum Position { - ArgumentNext, ArgumentIs(uint) -} - -/// Flags which can be passed to formatting via a directive. -/// -/// These flags are discovered through the `flags` field of the `Formatter` -/// structure. The flag in that structure is a union of these flags into a -/// `uint` where each flag's discriminant is the corresponding bit. -#[derive(Copy)] -pub enum Flag { - /// A flag which enables number formatting to always print the sign of a - /// number. - FlagSignPlus, - /// Currently not a used flag - FlagSignMinus, - /// Indicates that the "alternate formatting" for a type should be used. - /// - /// The meaning of this flag is type-specific. - FlagAlternate, - /// Indicates that padding should be done with a `0` character as well as - /// being aware of the sign to be printed. - FlagSignAwareZeroPad, -} diff --git a/src/libcore/fmt/rt/v1.rs b/src/libcore/fmt/rt/v1.rs new file mode 100644 index 00000000000..f0c82759b70 --- /dev/null +++ b/src/libcore/fmt/rt/v1.rs @@ -0,0 +1,94 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! This is an internal module used by the ifmt! runtime. These structures are +//! emitted to static arrays to precompile format strings ahead of time. +//! +//! These definitions are similar to their `ct` equivalents, but differ in that +//! these can be statically allocated and are slightly optimized for the runtime + +#![stable(feature = "rust1", since = "1.0.0")] + +#[cfg(stage0)] pub use self::Position::*; + +#[cfg(stage0)] pub use self::Alignment::Left as AlignLeft; +#[cfg(stage0)] pub use self::Alignment::Right as AlignRight; +#[cfg(stage0)] pub use self::Alignment::Center as AlignCenter; +#[cfg(stage0)] pub use self::Alignment::Unknown as AlignUnknown; +#[cfg(stage0)] pub use self::Count::Is as CountIs; +#[cfg(stage0)] pub use self::Count::Implied as CountImplied; +#[cfg(stage0)] pub use self::Count::Param as CountIsParam; +#[cfg(stage0)] pub use self::Count::NextParam as CountIsNextParam; +#[cfg(stage0)] pub use self::Position::Next as ArgumentNext; +#[cfg(stage0)] pub use self::Position::At as ArgumentIs; + +#[derive(Copy)] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Argument { + #[stable(feature = "rust1", since = "1.0.0")] + pub position: Position, + #[stable(feature = "rust1", since = "1.0.0")] + pub format: FormatSpec, +} + +#[derive(Copy)] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct FormatSpec { + #[stable(feature = "rust1", since = "1.0.0")] + pub fill: char, + #[stable(feature = "rust1", since = "1.0.0")] + pub align: Alignment, + #[stable(feature = "rust1", since = "1.0.0")] + pub flags: uint, + #[stable(feature = "rust1", since = "1.0.0")] + pub precision: Count, + #[stable(feature = "rust1", since = "1.0.0")] + pub width: Count, +} + +/// Possible alignments that can be requested as part of a formatting directive. +#[derive(Copy, PartialEq)] +#[stable(feature = "rust1", since = "1.0.0")] +pub enum Alignment { + /// Indication that contents should be left-aligned. + #[stable(feature = "rust1", since = "1.0.0")] + Left, + /// Indication that contents should be right-aligned. + #[stable(feature = "rust1", since = "1.0.0")] + Right, + /// Indication that contents should be center-aligned. + #[stable(feature = "rust1", since = "1.0.0")] + Center, + /// No alignment was requested. + #[stable(feature = "rust1", since = "1.0.0")] + Unknown, +} + +#[derive(Copy)] +#[stable(feature = "rust1", since = "1.0.0")] +pub enum Count { + #[stable(feature = "rust1", since = "1.0.0")] + Is(usize), + #[stable(feature = "rust1", since = "1.0.0")] + Param(usize), + #[stable(feature = "rust1", since = "1.0.0")] + NextParam, + #[stable(feature = "rust1", since = "1.0.0")] + Implied, +} + +#[derive(Copy)] +#[stable(feature = "rust1", since = "1.0.0")] +pub enum Position { + #[stable(feature = "rust1", since = "1.0.0")] + Next, + #[stable(feature = "rust1", since = "1.0.0")] + At(usize) +} diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 92a7465038b..fc7d4e868f7 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -229,7 +229,7 @@ use self::Result::{Ok, Err}; use clone::Clone; -use fmt::Debug; +use fmt; use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, ExactSizeIterator}; use ops::{FnMut, FnOnce}; use option::Option::{self, None, Some}; @@ -715,7 +715,7 @@ impl Result { } #[stable(feature = "rust1", since = "1.0.0")] -impl Result { +impl Result { /// Unwraps a result, yielding the content of an `Ok`. /// /// # Panics @@ -746,7 +746,7 @@ impl Result { } #[stable(feature = "rust1", since = "1.0.0")] -impl Result { +impl Result { /// Unwraps a result, yielding the content of an `Err`. /// /// # Panics diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 21d5cd3d516..6b14592c23b 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -362,19 +362,19 @@ impl<'a> Id<'a> { /// /// Passing an invalid string (containing spaces, brackets, /// quotes, ...) will return an empty `Err` value. - pub fn new>(name: Name) -> Option> { + pub fn new>(name: Name) -> Result, ()> { let name = name.into_cow(); { let mut chars = name.chars(); match chars.next() { Some(c) if is_letter_or_underscore(c) => { ; }, - _ => return None + _ => return Err(()) } if !chars.all(is_constituent) { - return None + return Err(()) } } - return Some(Id{ name: name }); + return Ok(Id{ name: name }); fn is_letter_or_underscore(c: char) -> bool { in_range('a', c, 'z') || in_range('A', c, 'Z') || c == '_' @@ -878,8 +878,8 @@ r#"digraph syntax_tree { fn simple_id_construction() { let id1 = Id::new("hello"); match id1 { - Some(_) => {;}, - None => panic!("'hello' is not a valid value for id anymore") + Ok(_) => {;}, + Err(..) => panic!("'hello' is not a valid value for id anymore") } } @@ -887,8 +887,8 @@ r#"digraph syntax_tree { fn badly_formatted_id() { let id2 = Id::new("Weird { struct : ure } !!!"); match id2 { - Some(_) => panic!("graphviz id suddenly allows spaces, brackets and stuff"), - None => {;} + Ok(_) => panic!("graphviz id suddenly allows spaces, brackets and stuff"), + Err(..) => {;} } } } diff --git a/src/librustc/middle/cfg/graphviz.rs b/src/librustc/middle/cfg/graphviz.rs index 3d8348e8f5a..1f0fe4f1aca 100644 --- a/src/librustc/middle/cfg/graphviz.rs +++ b/src/librustc/middle/cfg/graphviz.rs @@ -54,10 +54,10 @@ fn replace_newline_with_backslash_l(s: String) -> String { } impl<'a, 'ast> dot::Labeller<'a, Node<'a>, Edge<'a>> for LabelledCFG<'a, 'ast> { - fn graph_id(&'a self) -> dot::Id<'a> { dot::Id::new(&self.name[]).unwrap() } + fn graph_id(&'a self) -> dot::Id<'a> { dot::Id::new(&self.name[]).ok().unwrap() } fn node_id(&'a self, &(i,_): &Node<'a>) -> dot::Id<'a> { - dot::Id::new(format!("N{}", i.node_id())).unwrap() + dot::Id::new(format!("N{}", i.node_id())).ok().unwrap() } fn node_label(&'a self, &(i, n): &Node<'a>) -> dot::LabelText<'a> { diff --git a/src/librustc/middle/infer/region_inference/graphviz.rs b/src/librustc/middle/infer/region_inference/graphviz.rs index 215c4945ea9..b1ca4e62515 100644 --- a/src/librustc/middle/infer/region_inference/graphviz.rs +++ b/src/librustc/middle/infer/region_inference/graphviz.rs @@ -157,10 +157,10 @@ impl<'a, 'tcx> ConstraintGraph<'a, 'tcx> { impl<'a, 'tcx> dot::Labeller<'a, Node, Edge> for ConstraintGraph<'a, 'tcx> { fn graph_id(&self) -> dot::Id { - dot::Id::new(self.graph_name.as_slice()).unwrap() + dot::Id::new(self.graph_name.as_slice()).ok().unwrap() } fn node_id(&self, n: &Node) -> dot::Id { - dot::Id::new(format!("node_{}", self.node_ids.get(n).unwrap())).unwrap() + dot::Id::new(format!("node_{}", self.node_ids.get(n).unwrap())).ok().unwrap() } fn node_label(&self, n: &Node) -> dot::LabelText { match *n { diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 2e7a6fd4923..d6eb05a867e 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -3951,8 +3951,8 @@ mod tests { struct ArbitraryType(uint); let mut hm: HashMap = HashMap::new(); hm.insert(ArbitraryType(1), true); - let mut mem_buf = Vec::new(); - let mut encoder = Encoder::new(&mut mem_buf as &mut fmt::Writer); + let mut mem_buf = string::String::new(); + let mut encoder = Encoder::new(&mut mem_buf); let result = hm.encode(&mut encoder); match result.err().unwrap() { EncoderError::BadHashmapKey => (), diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index fdd7aa216d3..2e55c007b55 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -122,7 +122,7 @@ impl Deref for CString { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for CString { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - String::from_utf8_lossy(self.as_bytes()).fmt(f) + fmt::Debug::fmt(&String::from_utf8_lossy(self.as_bytes()), f) } } diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index 4ab43e875cd..a1d6d097607 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -411,9 +411,10 @@ pub use core::fmt::{Display, Debug}; pub use core::fmt::{LowerHex, UpperHex, Pointer}; pub use core::fmt::{LowerExp, UpperExp}; pub use core::fmt::Error; -pub use core::fmt::{Argument, Arguments, write, radix, Radix, RadixFmt}; +pub use core::fmt::{ArgumentV1, Arguments, write, radix, Radix, RadixFmt}; #[doc(hidden)] +#[cfg(stage0)] pub use core::fmt::{argument, argumentuint}; /// The format function takes a precompiled format string and a list of @@ -431,9 +432,7 @@ pub use core::fmt::{argument, argumentuint}; /// let s = fmt::format(format_args!("Hello, {}!", "world")); /// assert_eq!(s, "Hello, world!".to_string()); /// ``` -#[unstable(feature = "std_misc", - reason = "this is an implementation detail of format! and should not \ - be called directly")] +#[stable(feature = "rust1", since = "1.0.0")] pub fn format(args: Arguments) -> string::String { let mut output = string::String::new(); let _ = write!(&mut output, "{}", args); diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index d3e60de2780..b47d81ae173 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -393,14 +393,15 @@ impl Command { } } +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for Command { /// Format the program and arguments of a Command for display. Any /// non-utf8 data is lossily converted using the utf8 replacement /// character. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, "{}", String::from_utf8_lossy(self.program.as_bytes()))); + try!(write!(f, "{:?}", self.program)); for arg in self.args.iter() { - try!(write!(f, " '{}'", String::from_utf8_lossy(arg.as_bytes()))); + try!(write!(f, " '{:?}'", arg)); } Ok(()) } diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 6a43eccbaba..f048dc9a84d 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -382,8 +382,8 @@ impl !Sync for SyncSender {} /// A `send` operation can only fail if the receiving end of a channel is /// disconnected, implying that the data could never be received. The error /// contains the data being sent as a payload so it can be recovered. -#[derive(PartialEq, Eq)] #[stable(feature = "rust1", since = "1.0.0")] +#[derive(PartialEq, Eq, Clone, Copy)] pub struct SendError(pub T); /// An error returned from the `recv` function on a `Receiver`. @@ -396,7 +396,7 @@ pub struct RecvError; /// This enumeration is the list of the possible reasons that try_recv could not /// return data when called. -#[derive(PartialEq, Clone, Copy, Debug)] +#[derive(PartialEq, Eq, Clone, Copy, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub enum TryRecvError { /// This channel is currently empty, but the sender(s) have not yet @@ -412,8 +412,8 @@ pub enum TryRecvError { /// This enumeration is the list of the possible error outcomes for the /// `SyncSender::try_send` method. -#[derive(PartialEq, Clone)] #[stable(feature = "rust1", since = "1.0.0")] +#[derive(PartialEq, Eq, Clone, Copy)] pub enum TrySendError { /// The data could not be sent on the channel because it would require that /// the callee block to send the data. diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 2a0a352f128..36dbf117604 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -17,7 +17,7 @@ use ext::base::*; use ext::base; use ext::build::AstBuilder; use fmt_macros as parse; -use parse::token::{InternedString, special_idents}; +use parse::token::special_idents; use parse::token; use ptr::P; @@ -300,56 +300,35 @@ impl<'a, 'b> Context<'a, 'b> { } } - /// These attributes are applied to all statics that this syntax extension - /// will generate. - fn static_attrs(ecx: &ExtCtxt, fmtsp: Span) -> Vec { - // Flag statics as `inline` so LLVM can merge duplicate globals as much - // as possible (which we're generating a whole lot of). - let unnamed = ecx.meta_word(fmtsp, InternedString::new("inline")); - let unnamed = ecx.attribute(fmtsp, unnamed); - - // Do not warn format string as dead code - let dead_code = ecx.meta_word(fmtsp, InternedString::new("dead_code")); - let allow_dead_code = ecx.meta_list(fmtsp, - InternedString::new("allow"), - vec![dead_code]); - let allow_dead_code = ecx.attribute(fmtsp, allow_dead_code); - vec![unnamed, allow_dead_code] - } - fn rtpath(ecx: &ExtCtxt, s: &str) -> Vec { - vec![ecx.ident_of("std"), ecx.ident_of("fmt"), ecx.ident_of("rt"), ecx.ident_of(s)] + vec![ecx.ident_of("std"), ecx.ident_of("fmt"), ecx.ident_of("rt"), + ecx.ident_of("v1"), ecx.ident_of(s)] } fn trans_count(&self, c: parse::Count) -> P { let sp = self.fmtsp; - match c { - parse::CountIs(i) => { - self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "CountIs"), - vec!(self.ecx.expr_usize(sp, i))) + let count = |: c, arg| { + let mut path = Context::rtpath(self.ecx, "Count"); + path.push(self.ecx.ident_of(c)); + match arg { + Some(arg) => self.ecx.expr_call_global(sp, path, vec![arg]), + None => self.ecx.expr_path(self.ecx.path_global(sp, path)), } + }; + match c { + parse::CountIs(i) => count("Is", Some(self.ecx.expr_usize(sp, i))), parse::CountIsParam(i) => { - self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "CountIsParam"), - vec!(self.ecx.expr_usize(sp, i))) - } - parse::CountImplied => { - let path = self.ecx.path_global(sp, Context::rtpath(self.ecx, - "CountImplied")); - self.ecx.expr_path(path) - } - parse::CountIsNextParam => { - let path = self.ecx.path_global(sp, Context::rtpath(self.ecx, - "CountIsNextParam")); - self.ecx.expr_path(path) + count("Param", Some(self.ecx.expr_usize(sp, i))) } + parse::CountImplied => count("Implied", None), + parse::CountIsNextParam => count("NextParam", None), parse::CountIsName(n) => { let i = match self.name_positions.get(n) { Some(&i) => i, None => 0, // error already emitted elsewhere }; let i = i + self.args.len(); - self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "CountIsParam"), - vec!(self.ecx.expr_usize(sp, i))) + count("Param", Some(self.ecx.expr_usize(sp, i))) } } } @@ -373,27 +352,35 @@ impl<'a, 'b> Context<'a, 'b> { } parse::NextArgument(ref arg) => { // Translate the position - let pos = match arg.position { - // These two have a direct mapping - parse::ArgumentNext => { - let path = self.ecx.path_global(sp, Context::rtpath(self.ecx, - "ArgumentNext")); - self.ecx.expr_path(path) - } - parse::ArgumentIs(i) => { - self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "ArgumentIs"), - vec!(self.ecx.expr_usize(sp, i))) - } - // Named arguments are converted to positional arguments at - // the end of the list of arguments - parse::ArgumentNamed(n) => { - let i = match self.name_positions.get(n) { - Some(&i) => i, - None => 0, // error already emitted elsewhere - }; - let i = i + self.args.len(); - self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "ArgumentIs"), - vec!(self.ecx.expr_usize(sp, i))) + let pos = { + let pos = |: c, arg| { + let mut path = Context::rtpath(self.ecx, "Position"); + path.push(self.ecx.ident_of(c)); + match arg { + Some(i) => { + let arg = self.ecx.expr_usize(sp, i); + self.ecx.expr_call_global(sp, path, vec![arg]) + } + None => { + self.ecx.expr_path(self.ecx.path_global(sp, path)) + } + } + }; + match arg.position { + // These two have a direct mapping + parse::ArgumentNext => pos("Next", None), + parse::ArgumentIs(i) => pos("At", Some(i)), + + // Named arguments are converted to positional arguments + // at the end of the list of arguments + parse::ArgumentNamed(n) => { + let i = match self.name_positions.get(n) { + Some(&i) => i, + None => 0, // error already emitted elsewhere + }; + let i = i + self.args.len(); + pos("At", Some(i)) + } } }; @@ -417,19 +404,16 @@ impl<'a, 'b> Context<'a, 'b> { // Translate the format let fill = self.ecx.expr_lit(sp, ast::LitChar(fill)); + let align = |:name| { + let mut p = Context::rtpath(self.ecx, "Alignment"); + p.push(self.ecx.ident_of(name)); + self.ecx.path_global(sp, p) + }; let align = match arg.format.align { - parse::AlignLeft => { - self.ecx.path_global(sp, Context::rtpath(self.ecx, "AlignLeft")) - } - parse::AlignRight => { - self.ecx.path_global(sp, Context::rtpath(self.ecx, "AlignRight")) - } - parse::AlignCenter => { - self.ecx.path_global(sp, Context::rtpath(self.ecx, "AlignCenter")) - } - parse::AlignUnknown => { - self.ecx.path_global(sp, Context::rtpath(self.ecx, "AlignUnknown")) - } + parse::AlignLeft => align("Left"), + parse::AlignRight => align("Right"), + parse::AlignCenter => align("Center"), + parse::AlignUnknown => align("Unknown"), }; let align = self.ecx.expr_path(align); let flags = self.ecx.expr_usize(sp, arg.format.flags); @@ -465,7 +449,7 @@ impl<'a, 'b> Context<'a, 'b> { let st = ast::ItemStatic(ty, ast::MutImmutable, slice); let name = ecx.ident_of(name); - let item = ecx.item(fmtsp, name, Context::static_attrs(ecx, fmtsp), st); + let item = ecx.item(fmtsp, name, vec![], st); let decl = respan(fmtsp, ast::DeclItem(item)); // Wrap the declaration in a block so that it forms a single expression. @@ -575,7 +559,7 @@ impl<'a, 'b> Context<'a, 'b> { // Now create the fmt::Arguments struct with all our locals we created. let (fn_name, fn_args) = if self.all_pieces_simple { - ("new", vec![pieces, args_slice]) + ("new_v1", vec![pieces, args_slice]) } else { // Build up the static array which will store our precompiled // nonstandard placeholders, if there are any. @@ -587,7 +571,7 @@ impl<'a, 'b> Context<'a, 'b> { piece_ty, self.pieces); - ("with_placeholders", vec![pieces, fmt, args_slice]) + ("new_v1_formatted", vec![pieces, args_slice, fmt]) }; self.ecx.expr_call_global(self.fmtsp, vec!( @@ -624,7 +608,8 @@ impl<'a, 'b> Context<'a, 'b> { return ecx.expr_call_global(sp, vec![ ecx.ident_of("std"), ecx.ident_of("fmt"), - ecx.ident_of("argumentuint")], vec![arg]) + ecx.ident_of("ArgumentV1"), + ecx.ident_of("from_uint")], vec![arg]) } }; @@ -636,7 +621,8 @@ impl<'a, 'b> Context<'a, 'b> { ecx.expr_call_global(sp, vec![ ecx.ident_of("std"), ecx.ident_of("fmt"), - ecx.ident_of("argument")], vec![ecx.expr_path(format_fn), arg]) + ecx.ident_of("ArgumentV1"), + ecx.ident_of("new")], vec![arg, ecx.expr_path(format_fn)]) } } diff --git a/src/test/compile-fail/lint-dead-code-4.rs b/src/test/compile-fail/lint-dead-code-4.rs index 22570bad616..449788459dc 100644 --- a/src/test/compile-fail/lint-dead-code-4.rs +++ b/src/test/compile-fail/lint-dead-code-4.rs @@ -13,7 +13,6 @@ #![deny(dead_code)] #![feature(libc)] #![feature(core)] -#![feature(collections)] extern crate libc; diff --git a/src/test/compile-fail/missing_debug_impls.rs b/src/test/compile-fail/missing_debug_impls.rs index 5b781a40fe5..bc4bfef4d48 100644 --- a/src/test/compile-fail/missing_debug_impls.rs +++ b/src/test/compile-fail/missing_debug_impls.rs @@ -11,7 +11,6 @@ // compile-flags: --crate-type lib #![deny(missing_debug_implementations)] #![allow(unused, missing_copy_implementations)] -#![feature(core)] use std::fmt; diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp index c18d076c0d3..b1d38f5dc9b 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -41,41 +41,39 @@ pub fn bar() { ((::std::fmt::format as - fn(core::fmt::Arguments<'_>) -> collections::string::String {std::fmt::format})(((::std::fmt::Arguments::new + fn(core::fmt::Arguments<'_>) -> collections::string::String {std::fmt::format})(((::std::fmt::Arguments::new_v1 as - fn(&[&str], &[core::fmt::Argument<'_>]) -> core::fmt::Arguments<'_> {core::fmt::Arguments<'a>::new})(({ - #[inline] - #[allow(dead_code)] - static __STATIC_FMTSTR: - &'static [&'static str] - = - (&([("test" - as - &'static str)] - as - [&'static str; 1]) - as - &'static [&'static str; 1]); - (__STATIC_FMTSTR + fn(&[&str], &[core::fmt::ArgumentV1<'_>]) -> core::fmt::Arguments<'_> {core::fmt::Arguments<'a>::new_v1})(({ + static __STATIC_FMTSTR: + &'static [&'static str] + = + (&([("test" + as + &'static str)] + as + [&'static str; 1]) + as + &'static [&'static str; 1]); + (__STATIC_FMTSTR + as + &'static [&'static str]) + } as - &'static [&'static str]) - } - as - &[&str]), - (&(match (() - as - ()) - { - () - => - ([] + &[&str]), + (&(match (() + as + ()) + { + () + => + ([] + as + [core::fmt::ArgumentV1<'_>; 0]), + } as - [core::fmt::Argument<'_>; 0]), - } - as - [core::fmt::Argument<'_>; 0]) - as - &[core::fmt::Argument<'_>; 0])) + [core::fmt::ArgumentV1<'_>; 0]) + as + &[core::fmt::ArgumentV1<'_>; 0])) as core::fmt::Arguments<'_>)) as collections::string::String); -- cgit 1.4.1-3-g733a5 From 3a2530d611fc92bd8094ec1745a927e059ac432a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 30 Jan 2015 12:26:44 -0800 Subject: Test fixes and rebase conflicts Also some tidying up of a bunch of crate attributes --- src/compiletest/compiletest.rs | 17 +++++++------- src/doc/trpl/patterns.md | 2 +- src/driver/driver.rs | 1 - src/liballoc/lib.rs | 3 +-- src/libarena/lib.rs | 13 +++++------ src/libcollections/lib.rs | 20 ++++++++--------- src/libcollections/ring_buf.rs | 22 +++++++++---------- src/libcollections/vec.rs | 2 +- src/libcore/lib.rs | 16 +++++++------- src/libcore/num/mod.rs | 8 +++---- src/libcore/str/mod.rs | 2 +- src/libcoretest/hash/mod.rs | 4 ++-- src/libcoretest/iter.rs | 16 +++++++------- src/libcoretest/lib.rs | 6 ++--- src/libflate/lib.rs | 6 ++--- src/libfmt_macros/lib.rs | 7 +++--- src/libgetopts/lib.rs | 7 +++--- src/libgraphviz/lib.rs | 2 +- src/liblibc/lib.rs | 2 +- src/liblog/lib.rs | 9 +++----- src/librand/lib.rs | 2 +- src/librbml/lib.rs | 8 +++---- src/librustc/lib.rs | 17 +++++++------- src/librustc_back/lib.rs | 8 +++---- src/librustc_bitflags/lib.rs | 1 - src/librustc_borrowck/lib.rs | 15 ++++++------- src/librustc_driver/lib.rs | 11 +++++----- src/librustc_llvm/lib.rs | 9 ++++---- src/librustc_privacy/lib.rs | 7 +++--- src/librustc_resolve/lib.rs | 10 ++++----- src/librustc_trans/lib.rs | 19 ++++++++-------- src/librustc_trans/save/mod.rs | 15 ++++++------- src/librustc_typeck/check/mod.rs | 2 +- src/librustc_typeck/lib.rs | 17 +++++++------- src/librustdoc/html/markdown.rs | 2 +- src/librustdoc/html/render.rs | 2 +- src/librustdoc/lib.rs | 11 +++++----- src/libserialize/lib.rs | 9 ++++---- src/libstd/lib.rs | 28 +++++++++++------------- src/libstd/old_io/fs.rs | 4 ++-- src/libstd/old_io/net/ip.rs | 2 +- src/libstd/old_io/net/tcp.rs | 6 ++--- src/libstd/path/posix.rs | 2 +- src/libstd/path/windows.rs | 2 +- src/libstd/rt/unwind.rs | 4 ++-- src/libsyntax/feature_gate.rs | 2 +- src/libsyntax/lib.rs | 13 +++++------ src/libterm/lib.rs | 9 ++++---- src/libtest/lib.rs | 12 +++++----- src/libunicode/lib.rs | 2 +- src/rustllvm/llvm-auto-clean-trigger | 2 +- src/test/bench/shootout-meteor.rs | 22 +++++++++---------- src/test/compile-fail/regions-infer-not-param.rs | 5 +++++ src/test/run-make/save-analysis/SubDir/mod.rs | 6 ++--- src/test/run-make/save-analysis/foo.rs | 6 ++--- src/test/run-pass/issue-16668.rs | 2 +- 56 files changed, 220 insertions(+), 239 deletions(-) (limited to 'src/libstd') diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index ea733c84a97..b73623223fd 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -9,21 +9,20 @@ // except according to those terms. #![crate_type = "bin"] -#![allow(unknown_features)] -#![feature(slicing_syntax, unboxed_closures)] + #![feature(box_syntax)] +#![feature(collections)] +#![feature(core)] #![feature(int_uint)] -#![feature(test)] -#![feature(rustc_private)] -#![feature(std_misc)] -#![feature(path)] #![feature(io)] -#![feature(core)] -#![feature(collections)] #![feature(os)] +#![feature(path)] +#![feature(rustc_private)] +#![feature(slicing_syntax, unboxed_closures)] +#![feature(std_misc)] +#![feature(test)] #![feature(unicode)] -#![allow(unstable)] #![deny(warnings)] extern crate test; diff --git a/src/doc/trpl/patterns.md b/src/doc/trpl/patterns.md index 8240689c24b..122cffe3697 100644 --- a/src/doc/trpl/patterns.md +++ b/src/doc/trpl/patterns.md @@ -180,7 +180,7 @@ If you want to match against a slice or array, you can use `&`: fn main() { let v = vec!["match_this", "1"]; - match &v { + match &v[] { ["match_this", second] => println!("The second element is {}", second), _ => {}, } diff --git a/src/driver/driver.rs b/src/driver/driver.rs index 601f130341b..6b56c2b6303 100644 --- a/src/driver/driver.rs +++ b/src/driver/driver.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![cfg_attr(rustc, feature(rustc_private))] #![cfg_attr(rustdoc, feature(rustdoc))] diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index f807d8d12a6..1fc205b5f75 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -66,11 +66,10 @@ html_root_url = "http://doc.rust-lang.org/nightly/")] #![no_std] -#![allow(unknown_features)] #![feature(lang_items, unsafe_destructor)] #![feature(box_syntax)] #![feature(optin_builtin_traits)] -#![allow(unknown_features)] #![feature(int_uint)] +#![feature(int_uint)] #![feature(core)] #![feature(hash)] #![feature(libc)] diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 9744feb4ee7..5ada51976ac 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -21,7 +21,6 @@ #![crate_name = "arena"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] @@ -29,16 +28,14 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![allow(unknown_features)] -#![feature(unsafe_destructor)] -#![feature(unboxed_closures)] -#![feature(box_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] -#![allow(missing_docs)] #![feature(alloc)] +#![feature(box_syntax)] #![feature(core)] +#![feature(int_uint)] +#![feature(staged_api)] +#![feature(unboxed_closures)] +#![feature(unsafe_destructor)] #![cfg_attr(test, feature(test))] -#![cfg_attr(test, feature(collections))] extern crate alloc; diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index f28262dc0fe..ce00bd48bb8 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -15,7 +15,6 @@ #![crate_name = "collections"] #![unstable(feature = "collections")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -23,19 +22,20 @@ html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] -#![allow(unknown_features)] -#![feature(unsafe_destructor, slicing_syntax)] +#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap + +#![feature(alloc)] #![feature(box_syntax)] -#![feature(unboxed_closures)] -#![allow(unknown_features)] #![feature(int_uint)] -#![no_std] #![feature(core)] -#![feature(alloc)] -#![feature(unicode)] #![feature(hash)] +#![feature(int_uint)] +#![feature(staged_api)] +#![feature(unboxed_closures)] +#![feature(unicode)] +#![feature(unsafe_destructor, slicing_syntax)] #![cfg_attr(test, feature(test))] -// NOTE(stage0): remove after a snapshot -#![cfg_attr(not(stage0), allow(unused_mut))] + +#![no_std] #[macro_use] extern crate core; diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index 93b10a39549..7032a3d9137 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -2204,7 +2204,7 @@ mod tests { d.push_back(i); } - assert_eq!(d.drain().collect::>(), [0, 1, 2, 3, 4]); + assert_eq!(d.drain().collect::>(), [0, 1, 2, 3, 4]); assert!(d.is_empty()); } @@ -2214,21 +2214,21 @@ mod tests { for i in 0..5 { d.push_back(i); } - for i in 6i..9 { + for i in 6..9 { d.push_front(i); } - assert_eq!(d.drain().collect::>(), [8,7,6,0,1,2,3,4]); + assert_eq!(d.drain().collect::>(), [8,7,6,0,1,2,3,4]); assert!(d.is_empty()); } // partially used { - let mut d = RingBuf::new(); + let mut d: RingBuf = RingBuf::new(); for i in 0..5 { d.push_back(i); } - for i in 6i..9 { + for i in 6..9 { d.push_front(i); } @@ -2669,7 +2669,7 @@ mod tests { #[test] fn test_as_slices() { let mut ring: RingBuf = RingBuf::with_capacity(127); - let cap = ring.capacity() as int; + let cap = ring.capacity() as i32; let first = cap/2; let last = cap - first; for i in 0..first { @@ -2690,14 +2690,14 @@ mod tests { assert_eq!(right, expected_right); } - assert_eq!(ring.len() as int, cap); - assert_eq!(ring.capacity() as int, cap); + assert_eq!(ring.len() as i32, cap); + assert_eq!(ring.capacity() as i32, cap); } #[test] fn test_as_mut_slices() { let mut ring: RingBuf = RingBuf::with_capacity(127); - let cap = ring.capacity() as int; + let cap = ring.capacity() as i32; let first = cap/2; let last = cap - first; for i in 0..first { @@ -2718,7 +2718,7 @@ mod tests { assert_eq!(right, expected_right); } - assert_eq!(ring.len() as int, cap); - assert_eq!(ring.capacity() as int, cap); + assert_eq!(ring.len() as i32, cap); + assert_eq!(ring.capacity() as i32, cap); } } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index d5f3d2a39a4..c45879ae251 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -181,7 +181,7 @@ impl Vec { /// # Examples /// /// ``` - /// let mut vec: Vec = Vec::with_capacity(10); + /// let mut vec: Vec<_> = Vec::with_capacity(10); /// /// // The vector contains no items, even though it has capacity for more /// assert_eq!(vec.len(), 0); diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 353d4252dfb..d2bc30fa74a 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -49,7 +49,6 @@ #![crate_name = "core"] #![unstable(feature = "core")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", @@ -58,15 +57,16 @@ html_playground_url = "http://play.rust-lang.org/")] #![no_std] -#![allow(unknown_features, raw_pointer_derive)] -#![allow(unknown_features)] #![feature(intrinsics, lang_items)] +#![allow(raw_pointer_derive)] +#![deny(missing_docs)] +#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap + +#![feature(int_uint)] +#![feature(intrinsics, lang_items)] +#![feature(on_unimplemented)] #![feature(simd, unsafe_destructor, slicing_syntax)] +#![feature(staged_api)] #![feature(unboxed_closures)] -#![allow(unknown_features)] #![feature(int_uint)] -#![feature(on_unimplemented)] -#![deny(missing_docs)] -// NOTE(stage0) remove cfg_attr after a snapshot -#![cfg_attr(not(stage0), allow(unused_mut))] #[macro_use] mod macros; diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 206e63c7a17..b7c5c6640ce 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1728,11 +1728,11 @@ from_str_radix_int_impl! { u32 } from_str_radix_int_impl! { u64 } /// An error which can be returned when parsing an integer. -#[derive(Show, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq)] #[stable(feature = "rust1", since = "1.0.0")] pub struct ParseIntError { kind: IntErrorKind } -#[derive(Show, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq)] enum IntErrorKind { Empty, InvalidDigit, @@ -1760,11 +1760,11 @@ impl Error for ParseIntError { } /// An error which can be returned when parsing a float. -#[derive(Show, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq)] #[stable(feature = "rust1", since = "1.0.0")] pub struct ParseFloatError { kind: FloatErrorKind } -#[derive(Show, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq)] enum FloatErrorKind { Empty, Invalid, diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index ee62cede191..cb7af3b3d35 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -148,7 +148,7 @@ impl FromStr for bool { } /// An error returned when parsing a `bool` from a string fails. -#[derive(Show, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq)] #[allow(missing_copy_implementations)] #[stable(feature = "rust1", since = "1.0.0")] pub struct ParseBoolError { _priv: () } diff --git a/src/libcoretest/hash/mod.rs b/src/libcoretest/hash/mod.rs index f83b03d845b..ae23024cf20 100644 --- a/src/libcoretest/hash/mod.rs +++ b/src/libcoretest/hash/mod.rs @@ -76,12 +76,12 @@ fn test_writer_hasher() { // FIXME (#18248) Add tests for hashing Rc and Rc<[T]> unsafe { - let ptr: *const int = mem::transmute(5); + let ptr: *const i32 = mem::transmute(5is); assert_eq!(hash(&ptr), 5); } unsafe { - let ptr: *mut int = mem::transmute(5); + let ptr: *mut i32 = mem::transmute(5is); assert_eq!(hash(&ptr), 5); } } diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index 2a872ef3443..3102abb660f 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -328,7 +328,7 @@ fn test_iterator_len() { #[test] fn test_iterator_sum() { - let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let v: &[i32] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(v[..4].iter().map(|&x| x).sum(), 6); assert_eq!(v.iter().map(|&x| x).sum(), 55); assert_eq!(v[..0].iter().map(|&x| x).sum(), 0); @@ -336,7 +336,7 @@ fn test_iterator_sum() { #[test] fn test_iterator_product() { - let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + let v: &[i32] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(v[..4].iter().map(|&x| x).product(), 0); assert_eq!(v[1..5].iter().map(|&x| x).product(), 24); assert_eq!(v[..0].iter().map(|&x| x).product(), 1); @@ -730,23 +730,23 @@ fn test_random_access_cycle() { #[test] fn test_double_ended_range() { - assert!((11..14).rev().collect::>() == vec![13, 12, 11]); + assert!((11..14).rev().collect::>() == vec![13, 12, 11]); for _ in (10..0).rev() { panic!("unreachable"); } - assert!((11u..14).rev().collect::>() == vec![13u, 12, 11]); - for _ in (10u..0).rev() { + assert!((11..14).rev().collect::>() == vec![13, 12, 11]); + for _ in (10..0).rev() { panic!("unreachable"); } } #[test] fn test_range() { - assert!((0..5).collect::>() == vec![0, 1, 2, 3, 4]); - assert!((-10..-1).collect::>() == + assert!((0..5).collect::>() == vec![0, 1, 2, 3, 4]); + assert!((-10..-1).collect::>() == vec![-10, -9, -8, -7, -6, -5, -4, -3, -2]); - assert!((0..5).rev().collect::>() == vec![4, 3, 2, 1, 0]); + assert!((0..5).rev().collect::>() == vec![4, 3, 2, 1, 0]); assert_eq!((200..-5).count(), 0); assert_eq!((200..-5).rev().count(), 0); assert_eq!((200..200).count(), 0); diff --git a/src/libcoretest/lib.rs b/src/libcoretest/lib.rs index 0d371dbe153..c26d3e7bb8a 100644 --- a/src/libcoretest/lib.rs +++ b/src/libcoretest/lib.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(unsafe_destructor, slicing_syntax)] -#![feature(unboxed_closures)] #![feature(box_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] +#![feature(int_uint)] +#![feature(unboxed_closures)] +#![feature(unsafe_destructor, slicing_syntax)] extern crate core; extern crate test; diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 5c868ce6910..e7fb2ba56ab 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -16,17 +16,17 @@ #![crate_name = "flate"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] -#![allow(unknown_features)] #![feature(int_uint)] #![crate_type = "rlib"] #![crate_type = "dylib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![feature(hash)] + #![feature(core)] +#![feature(int_uint)] #![feature(libc)] +#![feature(staged_api)] #[cfg(test)] #[macro_use] extern crate log; diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 9bc7acb67ad..8a473ad43af 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -16,7 +16,6 @@ #![crate_name = "fmt_macros"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] @@ -25,10 +24,10 @@ html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] +#![cfg_attr(stage0, feature(core))] +#![feature(int_uint)] #![feature(slicing_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] -#![feature(collections)] -#![feature(core)] +#![feature(staged_api)] #![feature(unicode)] pub use self::Piece::*; diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 7b86dab8a7c..055672df5d1 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -80,7 +80,6 @@ #![crate_name = "getopts"] #![unstable(feature = "rustc_private", reason = "use the crates.io `getopts` library instead")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] @@ -88,11 +87,13 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(slicing_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] + #![deny(missing_docs)] #![feature(collections)] #![feature(core)] +#![feature(int_uint)] +#![feature(slicing_syntax)] +#![feature(staged_api)] #![cfg_attr(test, feature(rustc_private))] #[cfg(test)] #[macro_use] extern crate log; diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 6b14592c23b..3606387ad23 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -274,7 +274,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] #![feature(slicing_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] +#![feature(int_uint)] #![feature(collections)] #![feature(core)] #![feature(io)] diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 96717a38cba..bd8537f53cd 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -15,7 +15,7 @@ #![cfg_attr(not(feature = "cargo-build"), feature(staged_api))] #![cfg_attr(not(feature = "cargo-build"), staged_api)] #![cfg_attr(not(feature = "cargo-build"), feature(core))] -#![allow(unknown_features)] #![feature(int_uint)] +#![feature(int_uint)] #![no_std] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index bf7fdaeadf4..81d8c60f893 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -158,7 +158,6 @@ #![crate_name = "log"] #![unstable(feature = "rustc_private", reason = "use the crates.io `log` library instead")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] @@ -166,17 +165,15 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] +#![deny(missing_docs)] -#![allow(unknown_features)] +#![feature(staged_api)] #![feature(slicing_syntax)] #![feature(box_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] -#![deny(missing_docs)] -#![feature(collections)] +#![feature(int_uint)] #![feature(core)] #![feature(io)] #![feature(os)] -#![feature(rustc_private)] #![feature(std_misc)] use std::cell::RefCell; diff --git a/src/librand/lib.rs b/src/librand/lib.rs index ebe72cee84a..3ff40038872 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -22,7 +22,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] -#![allow(unknown_features)] #![feature(int_uint)] +#![feature(int_uint)] #![no_std] #![unstable(feature = "rand")] #![feature(staged_api)] diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index f7fd8889fae..acc21cbf060 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -17,7 +17,6 @@ #![crate_name = "rbml"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] @@ -25,13 +24,14 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] -#![allow(unknown_features)] -#![feature(slicing_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] + #![feature(collections)] #![feature(core)] +#![feature(int_uint)] #![feature(io)] #![feature(rustc_private)] +#![feature(slicing_syntax)] +#![feature(staged_api)] extern crate serialize; #[macro_use] extern crate log; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index a38e8bb4536..6ae861fcb04 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -16,7 +16,6 @@ #![crate_name = "rustc"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -24,25 +23,25 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![allow(unknown_features)] -#![feature(quote)] -#![feature(slicing_syntax, unsafe_destructor)] +#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap + #![feature(box_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] -#![feature(rustc_diagnostic_macros)] #![feature(collections)] #![feature(core)] +#![feature(hash)] +#![feature(int_uint)] #![feature(io)] #![feature(libc)] #![feature(os)] #![feature(path)] +#![feature(quote)] +#![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] +#![feature(slicing_syntax, unsafe_destructor)] +#![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] -#![feature(hash)] #![cfg_attr(test, feature(test))] -// NOTE(stage0) remove cfg_attr after a snapshot -#![cfg_attr(not(stage0), allow(unused_mut))] extern crate arena; extern crate flate; diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index 13dec65d13e..2c6b5797f57 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -23,23 +23,23 @@ #![crate_name = "rustc_back"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![allow(unknown_features)] -#![feature(slicing_syntax, box_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] + +#![feature(box_syntax)] #![feature(collections)] #![feature(core)] #![feature(hash)] +#![feature(int_uint)] #![feature(io)] #![feature(os)] #![feature(path)] #![feature(rustc_private)] +#![feature(staged_api)] extern crate syntax; extern crate serialize; diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs index 487de3a6bb5..03160772879 100644 --- a/src/librustc_bitflags/lib.rs +++ b/src/librustc_bitflags/lib.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_name = "rustc_bitflags"] -#![allow(unknown_features)] #![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index d525c22f0ab..c2677cc3fd0 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -10,7 +10,6 @@ #![crate_name = "rustc_borrowck"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -18,16 +17,16 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![allow(unknown_features)] -#![feature(quote)] -#![feature(slicing_syntax, unsafe_destructor)] -#![feature(rustc_diagnostic_macros)] -#![allow(unknown_features)] #![feature(int_uint)] #![allow(non_camel_case_types)] -#![feature(collections)] + #![feature(core)] -#![feature(rustc_private)] #![feature(hash)] +#![feature(int_uint)] +#![feature(quote)] +#![feature(rustc_diagnostic_macros)] +#![feature(rustc_private)] +#![feature(staged_api)] +#![feature(unsafe_destructor)] #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 727638c29c3..2eada1ff174 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -16,7 +16,6 @@ #![crate_name = "rustc_driver"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -24,19 +23,19 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![allow(unknown_features)] -#![feature(quote)] -#![feature(slicing_syntax, unsafe_destructor)] #![feature(box_syntax)] -#![feature(rustc_diagnostic_macros)] -#![allow(unknown_features)] #![feature(int_uint)] #![feature(collections)] #![feature(core)] +#![feature(int_uint)] #![feature(io)] #![feature(libc)] #![feature(os)] #![feature(path)] +#![feature(quote)] +#![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] +#![feature(slicing_syntax, unsafe_destructor)] +#![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 5ce916f5360..a24bc6eaec3 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -15,7 +15,6 @@ #![crate_name = "rustc_llvm"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -23,16 +22,16 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![allow(unknown_features)] -#![feature(link_args)] #![feature(box_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] #![feature(collections)] #![feature(core)] +#![feature(hash)] +#![feature(int_uint)] #![feature(libc)] +#![feature(link_args)] #![feature(path)] +#![feature(staged_api)] #![feature(std_misc)] -#![feature(hash)] extern crate libc; #[macro_use] #[no_link] extern crate rustc_bitflags; diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index dbac2358047..14e80c6c8ef 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -10,7 +10,6 @@ #![crate_name = "rustc_privacy"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -18,11 +17,11 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![feature(rustc_diagnostic_macros)] -#![allow(unknown_features)] #![feature(int_uint)] -#![feature(collections)] #![feature(core)] +#![feature(int_uint)] +#![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] +#![feature(staged_api)] #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 89d36ef5801..a753631ec80 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -10,7 +10,6 @@ #![crate_name = "rustc_resolve"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -18,15 +17,16 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![feature(slicing_syntax)] -#![feature(rustc_diagnostic_macros)] -#![allow(unknown_features)] #![feature(int_uint)] #![feature(alloc)] #![feature(collections)] #![feature(core)] +#![feature(hash)] +#![feature(int_uint)] +#![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] +#![feature(slicing_syntax)] +#![feature(staged_api)] #![feature(std_misc)] -#![feature(hash)] #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index bee320c6829..c46c2b7e6dd 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -16,7 +16,6 @@ #![crate_name = "rustc_trans"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -24,25 +23,25 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![allow(unknown_features)] -#![feature(quote)] -#![feature(slicing_syntax, unsafe_destructor)] -#![feature(box_syntax)] -#![feature(rustc_diagnostic_macros)] -#![allow(unknown_features)] #![feature(int_uint)] +#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap + #![feature(alloc)] +#![feature(box_syntax)] #![feature(collections)] #![feature(core)] +#![feature(hash)] +#![feature(int_uint)] #![feature(io)] #![feature(libc)] #![feature(os)] #![feature(path)] +#![feature(quote)] +#![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] +#![feature(slicing_syntax, unsafe_destructor)] +#![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] -#![feature(hash)] -// NOTE(stage0) remove cfg_attr after a snapshot -#![cfg_attr(not(stage0), allow(unused_mut))] extern crate arena; extern crate flate; diff --git a/src/librustc_trans/save/mod.rs b/src/librustc_trans/save/mod.rs index 0dc871703f9..fbeaae1d1df 100644 --- a/src/librustc_trans/save/mod.rs +++ b/src/librustc_trans/save/mod.rs @@ -130,7 +130,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { global: path.global, segments: segs}; let qualname = if i == 0 && path.global { - format("::{}", path_to_string(&sub_path)) + format!("::{}", path_to_string(&sub_path)) } else { path_to_string(&sub_path) }; @@ -169,7 +169,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { return; } - let sub_paths = sub_paths[..len-1]; + let sub_paths = &sub_paths[..len-1]; for (i, &(ref span, ref qualname)) in sub_paths.iter().enumerate() { let qualname = if i == 0 && global && !path.global { format!("::{}", qualname) @@ -339,7 +339,6 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> { match self.analysis.ty_cx.map.get(def_id.node) { NodeItem(_) => { format!("::{}", ty::item_path_str(&self.analysis.ty_cx, def_id)) - result } _ => { self.sess.span_bug(method.span, @@ -1149,20 +1148,20 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> { } } ast::ItemExternCrate(ref s) => { - let name = get_ident(ident); + let name = get_ident(item.ident); let name = name.get(); let location = match *s { Some((ref s, _)) => s.get().to_string(), None => name.to_string(), }; - let alias_span = self.span.span_for_last_ident(i.span); - let cnum = match self.sess.cstore.find_extern_mod_stmt_cnum(id) { + let alias_span = self.span.span_for_last_ident(item.span); + let cnum = match self.sess.cstore.find_extern_mod_stmt_cnum(item.id) { Some(cnum) => cnum, None => 0, }; - self.fmt.extern_crate_str(i.span, + self.fmt.extern_crate_str(item.span, alias_span, - id, + item.id, cnum, name, &location[], diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 12bf507c057..165eec5ecd7 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1865,7 +1865,7 @@ pub enum LvaluePreference { } /// Whether `autoderef` requires types to resolve. -#[derive(Copy, Show, PartialEq, Eq)] +#[derive(Copy, Debug, PartialEq, Eq)] pub enum UnresolvedTypeAction { /// Produce an error and return `ty_err` whenever a type cannot /// be resolved (i.e. it is `ty_infer`). diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 98f997c5990..68f5ec9c8c2 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -65,7 +65,6 @@ This API is completely unstable and subject to change. #![crate_name = "rustc_typeck"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -73,19 +72,19 @@ This API is completely unstable and subject to change. html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![allow(unknown_features)] -#![feature(quote)] -#![feature(slicing_syntax, unsafe_destructor)] -#![feature(box_syntax)] -#![feature(rustc_diagnostic_macros)] -#![allow(unknown_features)] #![feature(int_uint)] #![allow(non_camel_case_types)] +#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap + +#![feature(box_syntax)] #![feature(collections)] #![feature(core)] +#![feature(int_uint)] +#![feature(quote)] +#![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] +#![feature(slicing_syntax, unsafe_destructor)] +#![feature(staged_api)] #![feature(std_misc)] -// NOTE(stage0) remove cfg_attr after a snapshot -#![cfg_attr(not(stage0), allow(unused_mut))] #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 1c916ad817c..7e08226019f 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -420,7 +420,7 @@ impl LangString { let mut seen_other_tags = false; let mut data = LangString::all_false(); - let mut tokens = string.split(|&: c: char| + let tokens = string.split(|&: c: char| !(c == '_' || c == '-' || c.is_alphanumeric()) ); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index b8ebbf8ff36..8a007fb035e 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1942,7 +1942,7 @@ fn item_enum(w: &mut fmt::Formatter, it: &clean::Item, clean::VariantItem(ref var) => { match var.kind { clean::StructVariant(ref s) => { - let mut fields = s.fields.iter().filter(|f| { + let fields = s.fields.iter().filter(|f| { match f.inner { clean::StructFieldItem(ref t) => match *t { clean::HiddenStructField => false, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 4e811844ea9..29e52d627cd 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -10,7 +10,6 @@ #![crate_name = "rustdoc"] #![unstable(feature = "rustdoc")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -18,22 +17,22 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(slicing_syntax)] + #![feature(box_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] #![feature(collections)] #![feature(core)] +#![feature(hash)] +#![feature(int_uint)] #![feature(io)] #![feature(libc)] #![feature(os)] #![feature(path)] #![feature(rustc_private)] +#![feature(slicing_syntax)] +#![feature(staged_api)] #![feature(std_misc)] #![feature(test)] #![feature(unicode)] -#![feature(hash)] -// NOTE(stage0) remove cfg_attr after a snapshot -#![cfg_attr(not(stage0), allow(unused_mut))] extern crate arena; extern crate getopts; diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index d51bb3af627..e86ee4a73ce 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -17,7 +17,6 @@ Core encoding and decoding interfaces. #![crate_name = "serialize"] #![unstable(feature = "rustc_private", reason = "deprecated in favor of rustc-serialize on crates.io")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] @@ -25,16 +24,16 @@ Core encoding and decoding interfaces. html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] -#![allow(unknown_features)] + #![feature(box_syntax)] -#![feature(old_impl_check)] -#![feature(slicing_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] #![feature(collections)] #![feature(core)] +#![feature(int_uint)] #![feature(io)] #![feature(path)] #![feature(rustc_private)] +#![feature(slicing_syntax)] +#![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] #![cfg_attr(test, feature(test))] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 3735a0035bd..96aebb735ef 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -97,7 +97,6 @@ #![crate_name = "std"] #![stable(feature = "rust1", since = "1.0.0")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] @@ -106,30 +105,29 @@ html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] -#![allow(unknown_features)] -#![feature(linkage, thread_local, asm)] -#![feature(lang_items, unsafe_destructor)] -#![feature(slicing_syntax, unboxed_closures)] +#![feature(alloc)] #![feature(box_syntax)] -#![feature(old_impl_check)] -#![feature(optin_builtin_traits)] -#![feature(int_uint)] +#![feature(collections)] #![feature(core)] +#![feature(hash)] +#![feature(int_uint)] +#![feature(lang_items, unsafe_destructor)] #![feature(libc)] -#![feature(alloc)] -#![feature(unicode)] -#![feature(collections)] +#![feature(linkage, thread_local, asm)] +#![feature(old_impl_check)] +#![feature(optin_builtin_traits)] #![feature(rand)] -#![feature(hash)] +#![feature(staged_api)] +#![feature(unboxed_closures)] +#![feature(unicode)] +#![cfg_attr(not(stage0), feature(macro_reexport))] #![cfg_attr(test, feature(test))] -// NOTE(stage0): remove cfg_attr after a snapshot -#![cfg_attr(not(stage0), allow(unused_mut))] -#![feature(macro_reexport)] // Don't link to std. We are std. #![no_std] #![deny(missing_docs)] +#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap #[cfg(test)] #[macro_use] diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs index d048cde2613..1337675544d 100644 --- a/src/libstd/old_io/fs.rs +++ b/src/libstd/old_io/fs.rs @@ -1101,10 +1101,10 @@ mod test { let dir = &tmpdir.join("di_readdir"); check!(mkdir(dir, old_io::USER_RWX)); let prefix = "foo"; - for n in 0..3 { + for n in 0is..3 { let f = dir.join(format!("{}.txt", n)); let mut w = check!(File::create(&f)); - let msg_str = format!("{}{}", prefix, n.to_string()); + let msg_str = format!("{}{}", prefix, n); let msg = msg_str.as_bytes(); check!(w.write(msg)); } diff --git a/src/libstd/old_io/net/ip.rs b/src/libstd/old_io/net/ip.rs index 3e2e69f75a6..565f9d83818 100644 --- a/src/libstd/old_io/net/ip.rs +++ b/src/libstd/old_io/net/ip.rs @@ -369,7 +369,7 @@ impl FromStr for SocketAddr { } } -#[derive(Show, Clone, PartialEq, Copy)] +#[derive(Debug, Clone, PartialEq, Copy)] pub struct ParseError; /// A trait for objects which can be converted or resolved to one or more `SocketAddr` values. diff --git a/src/libstd/old_io/net/tcp.rs b/src/libstd/old_io/net/tcp.rs index 0f513dd8995..122ac4c3445 100644 --- a/src/libstd/old_io/net/tcp.rs +++ b/src/libstd/old_io/net/tcp.rs @@ -1160,7 +1160,7 @@ mod test { tx.send(TcpStream::connect(addr).unwrap()).unwrap(); }); let _l = rx.recv().unwrap(); - for i in 0..1001 { + for i in 0is..1001 { match a.accept() { Ok(..) => break, Err(ref e) if e.kind == TimedOut => {} @@ -1260,7 +1260,7 @@ mod test { assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut); s.set_timeout(Some(20)); - for i in 0..1001 { + for i in 0is..1001 { match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, @@ -1318,7 +1318,7 @@ mod test { let mut s = a.accept().unwrap(); s.set_write_timeout(Some(20)); - for i in 0..1001 { + for i in 0is..1001 { match s.write(&[0; 128 * 1024]) { Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {}, Err(IoError { kind: TimedOut, .. }) => break, diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 72c41f2399e..6a0c8a93010 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -97,7 +97,7 @@ impl FromStr for Path { } /// Valuelue indicating that a path could not be parsed from a string. -#[derive(Show, Clone, PartialEq, Copy)] +#[derive(Debug, Clone, PartialEq, Copy)] pub struct ParsePathError; impl hash::Hash for Path { diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index e04f697b2a4..b524b89ef9f 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -126,7 +126,7 @@ impl FromStr for Path { } /// Value indicating that a path could not be parsed from a string. -#[derive(Show, Clone, PartialEq, Copy)] +#[derive(Debug, Clone, PartialEq, Copy)] pub struct ParsePathError; impl hash::Hash for Path { diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index 757aecaaaff..fb40a6c8f60 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -160,7 +160,7 @@ pub fn panicking() -> bool { // An uninlined, unmangled function upon which to slap yer breakpoints #[inline(never)] #[no_mangle] -#[allow(private_no_mangle_fns)] +#[cfg_attr(not(stage0), allow(private_no_mangle_fns))] fn rust_panic(cause: Box) -> ! { rtdebug!("begin_unwind()"); @@ -238,7 +238,7 @@ pub mod eabi { #[lang="eh_personality"] #[no_mangle] // referenced from rust_try.ll - #[allow(private_no_mangle_fns)] + #[cfg_attr(not(stage0), allow(private_no_mangle_fns))] extern fn rust_eh_personality( version: c_int, actions: uw::_Unwind_Action, diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 059838ceb64..775cfede70d 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -110,7 +110,7 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[ ("int_uint", "1.0.0", Active), // macro reexport needs more discusion and stabilization - ("macro_reexport", Active), + ("macro_reexport", "1.0.0", Active), // These are used to test this portion of the compiler, they don't actually // mean anything diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 5b78d5b1405..73424136cfb 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -16,7 +16,6 @@ #![crate_name = "syntax"] #![unstable(feature = "rustc_private")] -#![feature(staged_api)] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] @@ -24,23 +23,23 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![allow(unknown_features)] -#![feature(slicing_syntax)] +#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap + #![feature(box_syntax)] -#![feature(quote, unsafe_destructor)] -#![allow(unknown_features)] #![feature(int_uint)] #![feature(collections)] #![feature(core)] #![feature(hash)] +#![feature(int_uint)] #![feature(io)] #![feature(libc)] #![feature(os)] #![feature(path)] +#![feature(quote, unsafe_destructor)] #![feature(rustc_private)] +#![feature(slicing_syntax)] +#![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] -// NOTE(stage0) remove cfg_attr after a snapshot -#![cfg_attr(not(stage0), allow(unused_mut))] extern crate arena; extern crate fmt_macros; diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index aa3af76d46c..27a46fb5a68 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -41,7 +41,6 @@ #![crate_name = "term"] #![unstable(feature = "rustc_private", reason = "use the crates.io `term` library instead")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] @@ -49,18 +48,18 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] +#![deny(missing_docs)] -#![allow(unknown_features)] -#![feature(slicing_syntax)] #![feature(box_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] -#![deny(missing_docs)] #![feature(collections)] #![feature(core)] +#![feature(int_uint)] #![feature(io)] #![feature(os)] #![feature(path)] #![feature(rustc_private)] +#![feature(slicing_syntax)] +#![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index da893ec251a..f22c58c54a6 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -25,27 +25,27 @@ #![crate_name = "test"] #![unstable(feature = "test")] -#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![allow(unknown_features)] + +#![cfg_attr(not(stage0), allow(unused_mut))] // NOTE: remove after stage0 snap + #![feature(asm, slicing_syntax)] #![feature(box_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] #![feature(collections)] #![feature(core)] +#![feature(hash)] +#![feature(int_uint)] #![feature(io)] #![feature(os)] #![feature(path)] #![feature(rustc_private)] +#![feature(staged_api)] #![feature(std_misc)] -#![feature(hash)] -// NOTE(stage0): remove cfg_attr after a snapshot -#![cfg_attr(not(stage0), allow(unused_mut))] extern crate getopts; extern crate serialize; diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 659d57b7292..822dde7eb2c 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -31,7 +31,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![no_std] #![feature(slicing_syntax)] -#![allow(unknown_features)] #![feature(int_uint)] +#![feature(int_uint)] #![feature(core)] extern crate core; diff --git a/src/rustllvm/llvm-auto-clean-trigger b/src/rustllvm/llvm-auto-clean-trigger index 9dd66ac0a30..e159e9729b6 100644 --- a/src/rustllvm/llvm-auto-clean-trigger +++ b/src/rustllvm/llvm-auto-clean-trigger @@ -1,4 +1,4 @@ # If this file is modified, then llvm will be forcibly cleaned and then rebuilt. # The actual contents of this file do not matter, but to trigger a change on the # build bots then the contents should be changed so git updates the mtime. -2015-01-18 +2015-01-30 diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index 11c471c40c5..3c01697166e 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -104,8 +104,8 @@ impl<'a, T> Iterator for ListIterator<'a, T> { // corresponding mirrored piece), with, as minimum coordinates, (0, // 0). If all is false, only generate half of the possibilities (used // to break the symmetry of the board). -fn transform(piece: Vec<(int, int)> , all: bool) -> Vec> { - let mut res: Vec> = +fn transform(piece: Vec<(isize, isize)> , all: bool) -> Vec> { + let mut res: Vec> = // rotations iterate(piece, |rot| rot.iter().map(|&(y, x)| (x + y, -y)).collect()) .take(if all {6} else {3}) @@ -133,14 +133,14 @@ fn transform(piece: Vec<(int, int)> , all: bool) -> Vec> { // Takes a piece with minimum coordinate (0, 0) (as generated by // transform). Returns the corresponding mask if p translated by (dy, // dx) is on the board. -fn mask(dy: int, dx: int, id: uint, p: &Vec<(int, int)>) -> Option { +fn mask(dy: isize, dx: isize, id: usize, p: &Vec<(isize, isize)>) -> Option { let mut m = 1 << (50 + id); for &(y, x) in p.iter() { let x = x + dx + (y + (dy % 2)) / 2; if x < 0 || x > 4 {return None;} let y = y + dy; if y < 0 || y > 9 {return None;} - m |= 1 << (y * 5 + x) as uint; + m |= 1 << (y * 5 + x) as usize; } Some(m) } @@ -164,12 +164,12 @@ fn make_masks() -> Vec > > { // To break the central symmetry of the problem, every // transformation must be taken except for one piece (piece 3 // here). - let transforms: Vec>> = + let transforms: Vec>> = pieces.into_iter().enumerate() .map(|(id, p)| transform(p, id != 3)) .collect(); - (0..50).map(|yx| { + (0is..50).map(|yx| { transforms.iter().enumerate().map(|(id, t)| { t.iter().filter_map(|p| mask(yx / 5, yx % 5, id, p)).collect() }).collect() @@ -212,7 +212,7 @@ fn filter_masks(masks: &mut Vec>>) { // Gets the identifier of a mask. fn get_id(m: u64) -> u8 { for id in 0u8..10 { - if m & (1 << (id + 50) as uint) != 0 {return id;} + if m & (1 << (id + 50) as usize) != 0 {return id;} } panic!("{:016x} does not have a valid identifier", m); } @@ -222,7 +222,7 @@ fn to_vec(raw_sol: &List) -> Vec { let mut sol = repeat('.' as u8).take(50).collect::>(); for &m in raw_sol.iter() { let id = '0' as u8 + get_id(m); - for i in 0u..50 { + for i in 0us..50 { if m & 1 << i != 0 { sol[i] = id; } @@ -244,7 +244,7 @@ fn print_sol(sol: &Vec) { // The data managed during the search struct Data { // Number of solution found. - nb: int, + nb: isize, // Lexicographically minimal solution found. min: Vec, // Lexicographically maximal solution found. @@ -286,7 +286,7 @@ fn handle_sol(raw_sol: &List, data: &mut Data) { fn search( masks: &Vec>>, board: u64, - mut i: uint, + mut i: usize, cur: List, data: &mut Data) { @@ -297,7 +297,7 @@ fn search( let masks_at = &masks[i]; // for every unused piece - for id in (0u..10).filter(|&id| board & (1 << (id + 50)) == 0) { + for id in (0us..10).filter(|&id| board & (1 << (id + 50)) == 0) { // for each mask that fits on the board for m in masks_at[id].iter().filter(|&m| board & *m == 0) { // This check is too costly. diff --git a/src/test/compile-fail/regions-infer-not-param.rs b/src/test/compile-fail/regions-infer-not-param.rs index 5d7a218ca8a..83b9d4633dc 100644 --- a/src/test/compile-fail/regions-infer-not-param.rs +++ b/src/test/compile-fail/regions-infer-not-param.rs @@ -27,5 +27,10 @@ fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched ty fn take_indirect1(p: indirect1) -> indirect1 { p } fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +//~| expected `indirect2<'b>` +//~| found `indirect2<'a>` +//~| ERROR mismatched types +//~| expected `indirect2<'b>` +//~| found `indirect2<'a>` fn main() {} diff --git a/src/test/run-make/save-analysis/SubDir/mod.rs b/src/test/run-make/save-analysis/SubDir/mod.rs index 5ce7855da2a..f2879cfc6ba 100644 --- a/src/test/run-make/save-analysis/SubDir/mod.rs +++ b/src/test/run-make/save-analysis/SubDir/mod.rs @@ -12,15 +12,15 @@ use sub::sub2 as msalias; use sub::sub2; -use std::io::stdio::println; +use std::old_io::stdio::println; static yy: usize = 25us; mod sub { pub mod sub2 { - use std::io::stdio::println; + use std::old_io::stdio::println; pub mod sub3 { - use std::io::stdio::println; + use std::old_io::stdio::println; pub fn hello() { println("hello from module 3"); } diff --git a/src/test/run-make/save-analysis/foo.rs b/src/test/run-make/save-analysis/foo.rs index da56e616fcf..690f40b4f5b 100644 --- a/src/test/run-make/save-analysis/foo.rs +++ b/src/test/run-make/save-analysis/foo.rs @@ -20,7 +20,7 @@ extern crate "flate" as myflate; use graphviz::maybe_owned_vec::MaybeOwnedVector; use std::collections::{HashMap,HashSet}; use std::cell::RefCell; -use std::io::stdio::println; +use std::old_io::stdio::println; use sub::sub2 as msalias; @@ -62,9 +62,9 @@ fn test_tup_struct(x: TupStruct) -> int { mod sub { pub mod sub2 { - use std::io::stdio::println; + use std::old_io::stdio::println; pub mod sub3 { - use std::io::stdio::println; + use std::old_io::stdio::println; pub fn hello() { println("hello from module 3"); } diff --git a/src/test/run-pass/issue-16668.rs b/src/test/run-pass/issue-16668.rs index e82add61aa3..95b7728b47f 100644 --- a/src/test/run-pass/issue-16668.rs +++ b/src/test/run-pass/issue-16668.rs @@ -18,7 +18,7 @@ struct Parser<'a, I, O> { parse: Box Result + 'a> } -impl<'a, I, O: 'a> Parser<'a, I, O> { +impl<'a, I: 'a, O: 'a> Parser<'a, I, O> { fn compose(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> { Parser { parse: box move |&mut: x: I| { -- cgit 1.4.1-3-g733a5