From e4a9eb95ce4a457e800571d86942561ada28304a Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Fri, 13 Feb 2015 14:40:57 +1100 Subject: Remove `_VALUE` from the float extremes constants. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In `std::f32` and `std::f64`: - `MIN_VALUE` → `MIN` - `MAX_VALUE` → `MAX` - `MIN_POS_VALUE` → `MIN_POSITIVE` This matches the corresponding integer constants. [breaking-change] --- src/libstd/num/f32.rs | 1 + src/libstd/num/f64.rs | 1 + 2 files changed, 2 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 58b93665fe1..83a5c68912c 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -30,6 +30,7 @@ use core::num; pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE}; pub use core::f32::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP}; pub use core::f32::{MAX_10_EXP, NAN, INFINITY, NEG_INFINITY}; +pub use core::f32::{MIN, MIN_POSITIVE, MAX}; pub use core::f32::consts; #[allow(dead_code)] diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 8b17feeb70c..f243955d199 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -29,6 +29,7 @@ use core::num; pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE}; pub use core::f64::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP}; pub use core::f64::{MAX_10_EXP, NAN, INFINITY, NEG_INFINITY}; +pub use core::f64::{MIN, MIN_POSITIVE, MAX}; pub use core::f64::consts; #[allow(dead_code)] -- cgit 1.4.1-3-g733a5 From 805a31fb760873d3b973699403866ca08e8999ca Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 13 Feb 2015 09:11:41 -0500 Subject: Improve documentation for `Select::new()`. Remove incorrect claim, add example, reformat and re-word. Fixes #22266 --- src/libstd/sync/mpsc/select.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index babae93b2d4..87b2fe8f100 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -111,11 +111,18 @@ pub trait Packet { } impl Select { - /// Creates a new selection structure. This set is initially empty and - /// `wait` will panic!() if called. + /// Creates a new selection structure. This set is initially empty. /// - /// Usage of this struct directly can sometimes be burdensome, and usage is - /// rather much easier through the `select!` macro. + /// Usage of this struct directly can sometimes be burdensome, and usage is much easier through + /// the `select!` macro. + /// + /// # Examples + /// + /// ``` + /// use std::sync::mpsc::Select; + /// + /// let select = Select::new(); + /// ``` pub fn new() -> Select { Select { head: ptr::null_mut(), -- cgit 1.4.1-3-g733a5 From 5284c4ea6363ce27c09b00690e8dfcf1de80d139 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Fri, 13 Feb 2015 15:03:15 +0200 Subject: Remove a few uses of deprecated getenv --- src/librustc_back/target/mod.rs | 3 +-- src/libstd/sync/mpsc/mod.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/libstd') diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 4d90c492fa2..b80a486b191 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -384,8 +384,7 @@ impl Target { Path::new(target) }; - let target_path = env::var_os("RUST_TARGET_PATH") - .unwrap_or(OsString::from_str("")); + let target_path = env::var_os("RUST_TARGET_PATH").unwrap_or(OsString::from_str("")); // FIXME 16351: add a sane default search path? diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 2e60d684d68..d783acd57ac 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -1024,14 +1024,14 @@ impl fmt::Display for TryRecvError { mod test { use prelude::v1::*; - use os; + use std::env; use super::*; use thread::Thread; pub fn stress_factor() -> uint { - match os::getenv("RUST_TEST_STRESS") { - Some(val) => val.parse().unwrap(), - None => 1, + match env::var("RUST_TEST_STRESS") { + Ok(val) => val.parse().unwrap(), + Err(..) => 1, } } @@ -1546,14 +1546,14 @@ mod test { mod sync_tests { use prelude::v1::*; - use os; + use std::env; use thread::Thread; use super::*; pub fn stress_factor() -> uint { - match os::getenv("RUST_TEST_STRESS") { - Some(val) => val.parse().unwrap(), - None => 1, + match env::var("RUST_TEST_STRESS") { + Ok(val) => val.parse().unwrap(), + Err(..) => 1, } } -- cgit 1.4.1-3-g733a5 From 1e01f7f470f1d79be710d546ab25426fcede59f9 Mon Sep 17 00:00:00 2001 From: Kevin Yap Date: Fri, 13 Feb 2015 19:59:53 -0800 Subject: Rename std::failure to std::panicking Closes #22306. --- src/libstd/failure.rs | 76 ---------------------------------------------- src/libstd/lib.rs | 2 +- src/libstd/old_io/stdio.rs | 2 +- src/libstd/panicking.rs | 76 ++++++++++++++++++++++++++++++++++++++++++++++ src/libstd/rt/unwind.rs | 6 ++-- 5 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 src/libstd/failure.rs create mode 100644 src/libstd/panicking.rs (limited to 'src/libstd') diff --git a/src/libstd/failure.rs b/src/libstd/failure.rs deleted file mode 100644 index c184d3f4661..00000000000 --- a/src/libstd/failure.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2014 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. - -#![unstable(feature = "std_misc")] - -use prelude::v1::*; - -use any::Any; -use cell::RefCell; -use old_io::IoResult; -use rt::{backtrace, unwind}; -use rt::util::{Stderr, Stdio}; -use thread::Thread; - -// Defined in this module instead of old_io::stdio so that the unwinding -thread_local! { - pub static LOCAL_STDERR: RefCell>> = { - RefCell::new(None) - } -} - -impl Writer for Stdio { - fn write_all(&mut self, bytes: &[u8]) -> IoResult<()> { - let _ = self.write_bytes(bytes); - Ok(()) - } -} - -pub fn on_fail(obj: &(Any+Send), file: &'static str, line: uint) { - let msg = match obj.downcast_ref::<&'static str>() { - Some(s) => *s, - None => match obj.downcast_ref::() { - Some(s) => &s[], - None => "Box", - } - }; - let mut err = Stderr; - let thread = Thread::current(); - let name = thread.name().unwrap_or(""); - let prev = LOCAL_STDERR.with(|s| s.borrow_mut().take()); - match prev { - Some(mut stderr) => { - // FIXME: what to do when the thread printing panics? - let _ = writeln!(stderr, - "thread '{}' panicked at '{}', {}:{}\n", - name, msg, file, line); - if backtrace::log_enabled() { - let _ = backtrace::write(&mut *stderr); - } - let mut s = Some(stderr); - LOCAL_STDERR.with(|slot| { - *slot.borrow_mut() = s.take(); - }); - } - None => { - let _ = writeln!(&mut err, "thread '{}' panicked at '{}', {}:{}", - name, msg, file, line); - if backtrace::log_enabled() { - let _ = backtrace::write(&mut err); - } - } - } - - // If this is a double panic, make sure that we printed a backtrace - // for this panic. - if unwind::panicking() && !backtrace::log_enabled() { - let _ = backtrace::write(&mut err); - } -} diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 83f0b7bc0e9..42eed5f4dbd 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -278,7 +278,7 @@ pub mod sync; #[path = "sys/common/mod.rs"] mod sys_common; pub mod rt; -mod failure; +mod panicking; // Documentation for primitive types diff --git a/src/libstd/old_io/stdio.rs b/src/libstd/old_io/stdio.rs index 8e55251d285..70cce1f7e76 100644 --- a/src/libstd/old_io/stdio.rs +++ b/src/libstd/old_io/stdio.rs @@ -30,7 +30,7 @@ use self::StdSource::*; use boxed::Box; use cell::RefCell; use clone::Clone; -use failure::LOCAL_STDERR; +use panicking::LOCAL_STDERR; use fmt; use old_io::{Reader, Writer, IoResult, IoError, OtherIoError, Buffer, standard_error, EndOfFile, LineBufferedWriter, BufferedReader}; diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs new file mode 100644 index 00000000000..e485c6a63c6 --- /dev/null +++ b/src/libstd/panicking.rs @@ -0,0 +1,76 @@ +// Copyright 2014 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. + +#![unstable(feature = "std_misc")] + +use prelude::v1::*; + +use any::Any; +use cell::RefCell; +use old_io::IoResult; +use rt::{backtrace, unwind}; +use rt::util::{Stderr, Stdio}; +use thread::Thread; + +// Defined in this module instead of old_io::stdio so that the unwinding +thread_local! { + pub static LOCAL_STDERR: RefCell>> = { + RefCell::new(None) + } +} + +impl Writer for Stdio { + fn write_all(&mut self, bytes: &[u8]) -> IoResult<()> { + let _ = self.write_bytes(bytes); + Ok(()) + } +} + +pub fn on_panic(obj: &(Any+Send), file: &'static str, line: uint) { + let msg = match obj.downcast_ref::<&'static str>() { + Some(s) => *s, + None => match obj.downcast_ref::() { + Some(s) => &s[], + None => "Box", + } + }; + let mut err = Stderr; + let thread = Thread::current(); + let name = thread.name().unwrap_or(""); + let prev = LOCAL_STDERR.with(|s| s.borrow_mut().take()); + match prev { + Some(mut stderr) => { + // FIXME: what to do when the thread printing panics? + let _ = writeln!(stderr, + "thread '{}' panicked at '{}', {}:{}\n", + name, msg, file, line); + if backtrace::log_enabled() { + let _ = backtrace::write(&mut *stderr); + } + let mut s = Some(stderr); + LOCAL_STDERR.with(|slot| { + *slot.borrow_mut() = s.take(); + }); + } + None => { + let _ = writeln!(&mut err, "thread '{}' panicked at '{}', {}:{}", + name, msg, file, line); + if backtrace::log_enabled() { + let _ = backtrace::write(&mut err); + } + } + } + + // If this is a double panic, make sure that we printed a backtrace + // for this panic. + if unwind::panicking() && !backtrace::log_enabled() { + let _ = backtrace::write(&mut err); + } +} diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index 659e787a9ff..464adadde62 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -62,7 +62,7 @@ use prelude::v1::*; use any::Any; use cell::Cell; use cmp; -use failure; +use panicking; use fmt; use intrinsics; use libc::c_void; @@ -534,10 +534,10 @@ pub fn begin_unwind(msg: M, file_line: &(&'static str, uint)) -> /// }` from ~1900/3700 (-O/no opts) to 180/590. #[inline(never)] #[cold] // this is the slow path, please never inline this fn begin_unwind_inner(msg: Box, file_line: &(&'static str, uint)) -> ! { - // Make sure the default failure handler is registered before we look at the + // Make sure the default panic handler is registered before we look at the // callbacks. static INIT: Once = ONCE_INIT; - INIT.call_once(|| unsafe { register(failure::on_fail); }); + INIT.call_once(|| unsafe { register(panicking::on_panic); }); // First, invoke call the user-defined callbacks triggered on thread panic. // -- cgit 1.4.1-3-g733a5 From 10dd8e721e0682de31006ca311400819b634771e Mon Sep 17 00:00:00 2001 From: Jorge Israel Peña Date: Sat, 14 Feb 2015 02:43:36 -0800 Subject: we forgot to make `Path` implement `Hash` `PathBuf` does implement `Hash`, but `Path` doesn't. This makes it annoying if you have a `HashMap` with `PathBuf`s as keys, because it means you have to convert a `Path` into a `PathBuf` and get a reference to it simply to perform operations on the `HashMap`! --- src/libstd/path.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libstd') diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 271a4cdb629..1f6d39fb1b3 100755 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1033,6 +1033,7 @@ impl AsOsStr for PathBuf { /// let parent_dir = path.parent(); /// ``` /// +#[derive(Hash)] pub struct Path { inner: OsStr } -- cgit 1.4.1-3-g733a5 From af7b8910b814f5f8ed58d0f692360c9bb7ee4ab9 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Sat, 14 Feb 2015 09:09:07 -0500 Subject: Correct typo --- src/libstd/ffi/os_str.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 4d7292b6eb4..1d14b141778 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -189,7 +189,7 @@ impl OsStr { self.inner.to_string_lossy() } - /// Copy the slice into an onwed `OsString`. + /// Copy the slice into an owned `OsString`. pub fn to_os_string(&self) -> OsString { OsString { inner: self.inner.to_owned() } } -- cgit 1.4.1-3-g733a5 From 09f53fd45c14a9fb796eca54a8954e943bf09477 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 15 Feb 2015 00:09:40 +0300 Subject: Audit integer types in libunicode, libcore/(char, str) and libstd/ascii --- src/etc/unicode.py | 10 +-- src/libcore/char.rs | 42 ++++++------- src/libcore/str/mod.rs | 156 ++++++++++++++++++++++++----------------------- src/libstd/ascii.rs | 4 +- src/libunicode/lib.rs | 1 - src/libunicode/tables.rs | 10 +-- src/libunicode/u_char.rs | 28 ++++----- src/libunicode/u_str.rs | 30 ++++----- 8 files changed, 141 insertions(+), 140 deletions(-) (limited to 'src/libstd') diff --git a/src/etc/unicode.py b/src/etc/unicode.py index 4952b99ab46..dc8716d1378 100755 --- a/src/etc/unicode.py +++ b/src/etc/unicode.py @@ -366,7 +366,7 @@ def emit_conversions_module(f, lowerupper, upperlower): } } - fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option { + fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option { match table.binary_search(|&(key, _)| { if c == key { Equal } else if key < c { Less } @@ -449,13 +449,13 @@ def emit_charwidth_module(f, width_table): """) f.write(""" - pub fn width(c: char, is_cjk: bool) -> Option { - match c as uint { + pub fn width(c: char, is_cjk: bool) -> Option { + match c as usize { _c @ 0 => Some(0), // null is zero width cu if cu < 0x20 => None, // control sequences have no width cu if cu < 0x7F => Some(1), // ASCII cu if cu < 0xA0 => None, // more control sequences - _ => Some(bsearch_range_value_table(c, is_cjk, charwidth_table) as uint) + _ => Some(bsearch_range_value_table(c, is_cjk, charwidth_table) as usize) } } @@ -610,7 +610,7 @@ if __name__ == "__main__": rf.write(""" /// The version of [Unicode](http://www.unicode.org/) /// that the `UnicodeChar` and `UnicodeStrPrelude` traits are based on. -pub const UNICODE_VERSION: (uint, uint, uint) = (%s, %s, %s); +pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s); """ % unicode_version) (canon_decomp, compat_decomp, gencats, combines, lowerupper, upperlower) = load_unicode_data("UnicodeData.txt") diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 28e0247f00a..683e450acb2 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -119,16 +119,16 @@ pub fn from_u32(i: u32) -> Option { /// ``` #[inline] #[unstable(feature = "core", reason = "pending integer conventions")] -pub fn from_digit(num: uint, radix: uint) -> Option { +pub fn from_digit(num: u32, radix: u32) -> Option { if radix > 36 { panic!("from_digit: radix is too high (maximum 36)"); } if num < radix { unsafe { if num < 10 { - Some(transmute(('0' as uint + num) as u32)) + Some(transmute('0' as u32 + num)) } else { - Some(transmute(('a' as uint + num - 10) as u32)) + Some(transmute('a' as u32 + num - 10)) } } } else { @@ -164,7 +164,7 @@ pub trait CharExt { /// ``` #[unstable(feature = "core", reason = "pending integer conventions")] - fn is_digit(self, radix: uint) -> bool; + fn is_digit(self, radix: u32) -> bool; /// Converts a character to the corresponding digit. /// @@ -189,7 +189,7 @@ pub trait CharExt { /// ``` #[unstable(feature = "core", reason = "pending integer conventions")] - fn to_digit(self, radix: uint) -> Option; + fn to_digit(self, radix: u32) -> Option; /// Returns an iterator that yields the hexadecimal Unicode escape of a character, as `char`s. /// @@ -275,7 +275,7 @@ pub trait CharExt { /// assert_eq!(n, 2); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf8(self) -> uint; + fn len_utf8(self) -> usize; /// Returns the number of bytes this character would need if encoded in UTF-16. /// @@ -287,7 +287,7 @@ pub trait CharExt { /// assert_eq!(n, 1); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf16(self) -> uint; + fn len_utf16(self) -> usize; /// Encodes this character as UTF-8 into the provided byte buffer, and then returns the number /// of bytes written. @@ -317,7 +317,7 @@ pub trait CharExt { /// assert_eq!(result, None); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - fn encode_utf8(self, dst: &mut [u8]) -> Option; + fn encode_utf8(self, dst: &mut [u8]) -> Option; /// Encodes this character as UTF-16 into the provided `u16` buffer, and then returns the /// number of `u16`s written. @@ -347,27 +347,27 @@ pub trait CharExt { /// assert_eq!(result, None); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - fn encode_utf16(self, dst: &mut [u16]) -> Option; + fn encode_utf16(self, dst: &mut [u16]) -> Option; } #[stable(feature = "rust1", since = "1.0.0")] impl CharExt for char { #[unstable(feature = "core", reason = "pending integer conventions")] - fn is_digit(self, radix: uint) -> bool { + fn is_digit(self, radix: u32) -> bool { self.to_digit(radix).is_some() } #[unstable(feature = "core", reason = "pending integer conventions")] - fn to_digit(self, radix: uint) -> Option { + fn to_digit(self, radix: u32) -> Option { if radix > 36 { panic!("to_digit: radix is too high (maximum 36)"); } let val = match self { - '0' ... '9' => self as uint - ('0' as uint), - 'a' ... 'z' => self as uint + 10 - ('a' as uint), - 'A' ... 'Z' => self as uint + 10 - ('A' as uint), + '0' ... '9' => self as u32 - '0' as u32, + 'a' ... 'z' => self as u32 - 'a' as u32 + 10, + 'A' ... 'Z' => self as u32 - 'A' as u32 + 10, _ => return None, }; if val < radix { Some(val) } @@ -396,7 +396,7 @@ impl CharExt for char { #[inline] #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf8(self) -> uint { + fn len_utf8(self) -> usize { let code = self as u32; match () { _ if code < MAX_ONE_B => 1, @@ -408,7 +408,7 @@ impl CharExt for char { #[inline] #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf16(self) -> uint { + fn len_utf16(self) -> usize { let ch = self as u32; if (ch & 0xFFFF_u32) == ch { 1 } else { 2 } } @@ -416,14 +416,14 @@ impl CharExt for char { #[inline] #[unstable(feature = "core", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf8(self, dst: &mut [u8]) -> Option { + fn encode_utf8(self, dst: &mut [u8]) -> Option { encode_utf8_raw(self as u32, dst) } #[inline] #[unstable(feature = "core", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf16(self, dst: &mut [u16]) -> Option { + fn encode_utf16(self, dst: &mut [u16]) -> Option { encode_utf16_raw(self as u32, dst) } } @@ -435,7 +435,7 @@ impl CharExt for char { /// and a `None` will be returned. #[inline] #[unstable(feature = "core")] -pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option { +pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option { // Marked #[inline] to allow llvm optimizing it away if code < MAX_ONE_B && dst.len() >= 1 { dst[0] = code as u8; @@ -467,7 +467,7 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option { /// and a `None` will be returned. #[inline] #[unstable(feature = "core")] -pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option { +pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option { // Marked #[inline] to allow llvm optimizing it away if (ch & 0xFFFF_u32) == ch && dst.len() >= 1 { // The BMP falls through (assuming non-surrogate, as it should) @@ -499,7 +499,7 @@ enum EscapeUnicodeState { Backslash, Type, LeftBrace, - Value(uint), + Value(usize), RightBrace, Done, } diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 747152a8244..ce26abe606d 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -41,7 +41,7 @@ macro_rules! delegate_iter { delegate_iter!{$te : $ti} impl<'a> ExactSizeIterator for $ti { #[inline] - fn len(&self) -> uint { + fn len(&self) -> usize { self.0.len() } } @@ -56,7 +56,7 @@ macro_rules! delegate_iter { self.0.next() } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { self.0.size_hint() } } @@ -78,7 +78,7 @@ macro_rules! delegate_iter { self.0.next() } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { self.0.size_hint() } } @@ -100,7 +100,7 @@ macro_rules! delegate_iter { self.0.next() } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { self.0.size_hint() } } @@ -178,7 +178,7 @@ pub enum Utf8Error { /// The offset is guaranteed to be in bounds of the slice in question, and /// the byte at the specified offset was the first invalid byte in the /// sequence detected. - InvalidByte(uint), + InvalidByte(usize), /// The byte slice was invalid because more bytes were needed but no more /// bytes were available. @@ -227,7 +227,7 @@ pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str { pub unsafe fn from_c_str(s: *const i8) -> &'static str { let s = s as *const u8; let mut len = 0; - while *s.offset(len as int) != 0 { + while *s.offset(len as isize) != 0 { len += 1; } let v: &'static [u8] = ::mem::transmute(Slice { data: s, len: len }); @@ -250,7 +250,7 @@ impl CharEq for char { fn matches(&mut self, c: char) -> bool { *self == c } #[inline] - fn only_ascii(&self) -> bool { (*self as uint) < 128 } + fn only_ascii(&self) -> bool { (*self as u32) < 128 } } impl CharEq for F where F: FnMut(char) -> bool { @@ -383,7 +383,7 @@ impl<'a> Iterator for Chars<'a> { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { let (len, _) = self.iter.size_hint(); (len.saturating_add(3) / 4, Some(len)) } @@ -428,16 +428,16 @@ impl<'a> DoubleEndedIterator for Chars<'a> { #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] pub struct CharIndices<'a> { - front_offset: uint, + front_offset: usize, iter: Chars<'a>, } #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Iterator for CharIndices<'a> { - type Item = (uint, char); + type Item = (usize, char); #[inline] - fn next(&mut self) -> Option<(uint, char)> { + fn next(&mut self) -> Option<(usize, char)> { let (pre_len, _) = self.iter.iter.size_hint(); match self.iter.next() { None => None, @@ -451,7 +451,7 @@ impl<'a> Iterator for CharIndices<'a> { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { self.iter.size_hint() } } @@ -459,7 +459,7 @@ impl<'a> Iterator for CharIndices<'a> { #[stable(feature = "rust1", since = "1.0.0")] impl<'a> DoubleEndedIterator for CharIndices<'a> { #[inline] - fn next_back(&mut self) -> Option<(uint, char)> { + fn next_back(&mut self) -> Option<(usize, char)> { match self.iter.next_back() { None => None, Some(ch) => { @@ -512,7 +512,7 @@ struct CharSplits<'a, Sep> { struct CharSplitsN<'a, Sep> { iter: CharSplits<'a, Sep>, /// The number of splits remaining - count: uint, + count: usize, invert: bool, } @@ -636,7 +636,7 @@ impl<'a, Sep: CharEq> Iterator for CharSplitsN<'a, Sep> { /// within a larger string using naive search #[derive(Clone)] struct NaiveSearcher { - position: uint + position: usize } impl NaiveSearcher { @@ -644,7 +644,7 @@ impl NaiveSearcher { NaiveSearcher { position: 0 } } - fn next(&mut self, haystack: &[u8], needle: &[u8]) -> Option<(uint, uint)> { + fn next(&mut self, haystack: &[u8], needle: &[u8]) -> Option<(usize, usize)> { while self.position + needle.len() <= haystack.len() { if &haystack[self.position .. self.position + needle.len()] == needle { let match_pos = self.position; @@ -663,13 +663,13 @@ impl NaiveSearcher { #[derive(Clone)] struct TwoWaySearcher { // constants - crit_pos: uint, - period: uint, + crit_pos: usize, + period: usize, byteset: u64, // variables - position: uint, - memory: uint + position: usize, + memory: usize } /* @@ -756,7 +756,7 @@ impl TwoWaySearcher { // This isn't in the original algorithm, as far as I'm aware. let byteset = needle.iter() - .fold(0, |a, &b| (1 << ((b & 0x3f) as uint)) | a); + .fold(0, |a, &b| (1 << ((b & 0x3f) as usize)) | a); // A particularly readable explanation of what's going on here can be found // in Crochemore and Rytter's book "Text Algorithms", ch 13. Specifically @@ -794,7 +794,8 @@ impl TwoWaySearcher { // How far we can jump when we encounter a mismatch is all based on the fact // that (u, v) is a critical factorization for the needle. #[inline] - fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) -> Option<(uint, uint)> { + fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) + -> Option<(usize, usize)> { 'search: loop { // Check that we have room to search in if self.position + needle.len() > haystack.len() { @@ -804,7 +805,7 @@ impl TwoWaySearcher { // Quickly skip by large portions unrelated to our substring if (self.byteset >> ((haystack[self.position + needle.len() - 1] & 0x3f) - as uint)) & 1 == 0 { + as usize)) & 1 == 0 { self.position += needle.len(); if !long_period { self.memory = 0; @@ -851,7 +852,7 @@ impl TwoWaySearcher { // Specifically, returns (i, p), where i is the starting index of v in some // critical factorization (u, v) and p = period(v) #[inline] - fn maximal_suffix(arr: &[u8], reversed: bool) -> (uint, uint) { + fn maximal_suffix(arr: &[u8], reversed: bool) -> (usize, usize) { let mut left = -1; // Corresponds to i in the paper let mut right = 0; // Corresponds to j in the paper let mut offset = 1; // Corresponds to k in the paper @@ -937,16 +938,16 @@ pub struct MatchIndices<'a> { #[unstable(feature = "core", reason = "type may be removed")] pub struct SplitStr<'a> { it: MatchIndices<'a>, - last_end: uint, + last_end: usize, finished: bool } #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Iterator for MatchIndices<'a> { - type Item = (uint, uint); + type Item = (usize, usize); #[inline] - fn next(&mut self) -> Option<(uint, uint)> { + fn next(&mut self) -> Option<(usize, usize)> { match self.searcher { Naive(ref mut searcher) => searcher.next(self.haystack.as_bytes(), self.needle.as_bytes()), @@ -991,8 +992,9 @@ Section: Comparing strings /// to compare &[u8] byte slices that are not necessarily valid UTF-8. #[inline] fn eq_slice_(a: &str, b: &str) -> bool { + // NOTE: In theory n should be libc::size_t and not usize, but libc is not available here #[allow(improper_ctypes)] - extern { fn memcmp(s1: *const i8, s2: *const i8, n: uint) -> i32; } + extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; } a.len() == b.len() && unsafe { memcmp(a.as_ptr() as *const i8, b.as_ptr() as *const i8, @@ -1049,7 +1051,7 @@ fn run_utf8_validation_iterator(iter: &mut slice::Iter) // ASCII characters are always valid, so only large // bytes need more examination. if first >= 128 { - let w = UTF8_CHAR_WIDTH[first as uint] as uint; + let w = UTF8_CHAR_WIDTH[first as usize] as usize; let second = next!(); // 2-byte encoding is for codepoints \u{0080} to \u{07ff} // first C2 80 last DF BF @@ -1124,7 +1126,7 @@ pub struct CharRange { /// Current `char` pub ch: char, /// Index of the first byte of the next `char` - pub next: uint, + pub next: usize, } /// Mask of the value bits of a continuation byte @@ -1209,10 +1211,10 @@ mod traits { /// // &s[3 .. 100]; /// ``` #[stable(feature = "rust1", since = "1.0.0")] - impl ops::Index> for str { + impl ops::Index> for str { type Output = str; #[inline] - fn index(&self, index: &ops::Range) -> &str { + fn index(&self, index: &ops::Range) -> &str { // is_char_boundary checks that the index is in [0, .len()] if index.start <= index.end && self.is_char_boundary(index.start) && @@ -1232,10 +1234,10 @@ mod traits { /// Panics when `end` does not point to a valid character, or is /// out of bounds. #[stable(feature = "rust1", since = "1.0.0")] - impl ops::Index> for str { + impl ops::Index> for str { type Output = str; #[inline] - fn index(&self, index: &ops::RangeTo) -> &str { + fn index(&self, index: &ops::RangeTo) -> &str { // is_char_boundary checks that the index is in [0, .len()] if self.is_char_boundary(index.end) { unsafe { self.slice_unchecked(0, index.end) } @@ -1252,10 +1254,10 @@ mod traits { /// Panics when `begin` does not point to a valid character, or is /// out of bounds. #[stable(feature = "rust1", since = "1.0.0")] - impl ops::Index> for str { + impl ops::Index> for str { type Output = str; #[inline] - fn index(&self, index: &ops::RangeFrom) -> &str { + fn index(&self, index: &ops::RangeFrom) -> &str { // is_char_boundary checks that the index is in [0, .len()] if self.is_char_boundary(index.start) { unsafe { self.slice_unchecked(index.start, self.len()) } @@ -1332,40 +1334,40 @@ pub trait StrExt { fn bytes<'a>(&'a self) -> Bytes<'a>; fn char_indices<'a>(&'a self) -> CharIndices<'a>; fn split<'a, P: CharEq>(&'a self, pat: P) -> Split<'a, P>; - fn splitn<'a, P: CharEq>(&'a self, count: uint, pat: P) -> SplitN<'a, P>; + fn splitn<'a, P: CharEq>(&'a self, count: usize, pat: P) -> SplitN<'a, P>; fn split_terminator<'a, P: CharEq>(&'a self, pat: P) -> SplitTerminator<'a, P>; - fn rsplitn<'a, P: CharEq>(&'a self, count: uint, pat: P) -> RSplitN<'a, P>; + fn rsplitn<'a, P: CharEq>(&'a self, count: usize, pat: P) -> RSplitN<'a, P>; fn match_indices<'a>(&'a self, sep: &'a str) -> MatchIndices<'a>; fn split_str<'a>(&'a self, pat: &'a str) -> SplitStr<'a>; fn lines<'a>(&'a self) -> Lines<'a>; fn lines_any<'a>(&'a self) -> LinesAny<'a>; - fn char_len(&self) -> uint; - fn slice_chars<'a>(&'a self, begin: uint, end: uint) -> &'a str; - unsafe fn slice_unchecked<'a>(&'a self, begin: uint, end: uint) -> &'a str; + fn char_len(&self) -> usize; + fn slice_chars<'a>(&'a self, begin: usize, end: usize) -> &'a str; + unsafe fn slice_unchecked<'a>(&'a self, begin: usize, end: usize) -> &'a str; fn starts_with(&self, pat: &str) -> bool; fn ends_with(&self, pat: &str) -> bool; fn trim_matches<'a, P: CharEq>(&'a self, pat: P) -> &'a str; fn trim_left_matches<'a, P: CharEq>(&'a self, pat: P) -> &'a str; fn trim_right_matches<'a, P: CharEq>(&'a self, pat: P) -> &'a str; - fn is_char_boundary(&self, index: uint) -> bool; - fn char_range_at(&self, start: uint) -> CharRange; - fn char_range_at_reverse(&self, start: uint) -> CharRange; - fn char_at(&self, i: uint) -> char; - fn char_at_reverse(&self, i: uint) -> char; + fn is_char_boundary(&self, index: usize) -> bool; + fn char_range_at(&self, start: usize) -> CharRange; + fn char_range_at_reverse(&self, start: usize) -> CharRange; + fn char_at(&self, i: usize) -> char; + fn char_at_reverse(&self, i: usize) -> char; fn as_bytes<'a>(&'a self) -> &'a [u8]; - fn find(&self, pat: P) -> Option; - fn rfind(&self, pat: P) -> Option; - fn find_str(&self, pat: &str) -> Option; + fn find(&self, pat: P) -> Option; + fn rfind(&self, pat: P) -> Option; + fn find_str(&self, pat: &str) -> Option; fn slice_shift_char<'a>(&'a self) -> Option<(char, &'a str)>; - fn subslice_offset(&self, inner: &str) -> uint; + fn subslice_offset(&self, inner: &str) -> usize; fn as_ptr(&self) -> *const u8; - fn len(&self) -> uint; + fn len(&self) -> usize; fn is_empty(&self) -> bool; fn parse(&self) -> Result; } #[inline(never)] -fn slice_error_fail(s: &str, begin: uint, end: uint) -> ! { +fn slice_error_fail(s: &str, begin: usize, end: usize) -> ! { assert!(begin <= end); panic!("index {} and/or {} in `{}` do not lie on character boundary", begin, end, s); @@ -1409,7 +1411,7 @@ impl StrExt for str { } #[inline] - fn splitn(&self, count: uint, pat: P) -> SplitN

{ + fn splitn(&self, count: usize, pat: P) -> SplitN

{ SplitN(CharSplitsN { iter: self.split(pat).0, count: count, @@ -1426,7 +1428,7 @@ impl StrExt for str { } #[inline] - fn rsplitn(&self, count: uint, pat: P) -> RSplitN

{ + fn rsplitn(&self, count: usize, pat: P) -> RSplitN

{ RSplitN(CharSplitsN { iter: self.split(pat).0, count: count, @@ -1470,9 +1472,9 @@ impl StrExt for str { } #[inline] - fn char_len(&self) -> uint { self.chars().count() } + fn char_len(&self) -> usize { self.chars().count() } - fn slice_chars(&self, begin: uint, end: uint) -> &str { + fn slice_chars(&self, begin: usize, end: usize) -> &str { assert!(begin <= end); let mut count = 0; let mut begin_byte = None; @@ -1496,9 +1498,9 @@ impl StrExt for str { } #[inline] - unsafe fn slice_unchecked(&self, begin: uint, end: uint) -> &str { + unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str { mem::transmute(Slice { - data: self.as_ptr().offset(begin as int), + data: self.as_ptr().offset(begin as isize), len: end - begin, }) } @@ -1550,7 +1552,7 @@ impl StrExt for str { } #[inline] - fn is_char_boundary(&self, index: uint) -> bool { + fn is_char_boundary(&self, index: usize) -> bool { if index == self.len() { return true; } match self.as_bytes().get(index) { None => false, @@ -1559,13 +1561,13 @@ impl StrExt for str { } #[inline] - fn char_range_at(&self, i: uint) -> CharRange { + fn char_range_at(&self, i: usize) -> CharRange { let (c, n) = char_range_at_raw(self.as_bytes(), i); CharRange { ch: unsafe { mem::transmute(c) }, next: n } } #[inline] - fn char_range_at_reverse(&self, start: uint) -> CharRange { + fn char_range_at_reverse(&self, start: usize) -> CharRange { let mut prev = start; prev = prev.saturating_sub(1); @@ -1574,14 +1576,14 @@ impl StrExt for str { } // Multibyte case is a fn to allow char_range_at_reverse to inline cleanly - fn multibyte_char_range_at_reverse(s: &str, mut i: uint) -> CharRange { + fn multibyte_char_range_at_reverse(s: &str, mut i: usize) -> CharRange { // while there is a previous byte == 10...... while i > 0 && s.as_bytes()[i] & !CONT_MASK == TAG_CONT_U8 { i -= 1; } let mut val = s.as_bytes()[i] as u32; - let w = UTF8_CHAR_WIDTH[val as uint] as uint; + let w = UTF8_CHAR_WIDTH[val as usize] as usize; assert!((w != 0)); val = utf8_first_byte!(val, w); @@ -1596,12 +1598,12 @@ impl StrExt for str { } #[inline] - fn char_at(&self, i: uint) -> char { + fn char_at(&self, i: usize) -> char { self.char_range_at(i).ch } #[inline] - fn char_at_reverse(&self, i: uint) -> char { + fn char_at_reverse(&self, i: usize) -> char { self.char_range_at_reverse(i).ch } @@ -1610,7 +1612,7 @@ impl StrExt for str { unsafe { mem::transmute(self) } } - fn find(&self, mut pat: P) -> Option { + fn find(&self, mut pat: P) -> Option { if pat.only_ascii() { self.bytes().position(|b| pat.matches(b as char)) } else { @@ -1621,7 +1623,7 @@ impl StrExt for str { } } - fn rfind(&self, mut pat: P) -> Option { + fn rfind(&self, mut pat: P) -> Option { if pat.only_ascii() { self.bytes().rposition(|b| pat.matches(b as char)) } else { @@ -1632,7 +1634,7 @@ impl StrExt for str { } } - fn find_str(&self, needle: &str) -> Option { + fn find_str(&self, needle: &str) -> Option { if needle.is_empty() { Some(0) } else { @@ -1653,10 +1655,10 @@ impl StrExt for str { } } - fn subslice_offset(&self, inner: &str) -> uint { - let a_start = self.as_ptr() as uint; + fn subslice_offset(&self, inner: &str) -> usize { + let a_start = self.as_ptr() as usize; let a_end = a_start + self.len(); - let b_start = inner.as_ptr() as uint; + let b_start = inner.as_ptr() as usize; let b_end = b_start + inner.len(); assert!(a_start <= b_start); @@ -1670,7 +1672,7 @@ impl StrExt for str { } #[inline] - fn len(&self) -> uint { self.repr().len } + fn len(&self) -> usize { self.repr().len } #[inline] fn is_empty(&self) -> bool { self.len() == 0 } @@ -1683,15 +1685,15 @@ impl StrExt for str { /// index of the next code point. #[inline] #[unstable(feature = "core")] -pub fn char_range_at_raw(bytes: &[u8], i: uint) -> (u32, usize) { +pub fn char_range_at_raw(bytes: &[u8], i: usize) -> (u32, usize) { if bytes[i] < 128u8 { return (bytes[i] as u32, i + 1); } // Multibyte case is a fn to allow char_range_at to inline cleanly - fn multibyte_char_range_at(bytes: &[u8], i: uint) -> (u32, usize) { + fn multibyte_char_range_at(bytes: &[u8], i: usize) -> (u32, usize) { let mut val = bytes[i] as u32; - let w = UTF8_CHAR_WIDTH[val as uint] as uint; + let w = UTF8_CHAR_WIDTH[val as usize] as usize; assert!((w != 0)); val = utf8_first_byte!(val, w); @@ -1718,7 +1720,7 @@ impl<'a> Iterator for Lines<'a> { #[inline] fn next(&mut self) -> Option<&'a str> { self.inner.next() } #[inline] - fn size_hint(&self) -> (uint, Option) { self.inner.size_hint() } + fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } } #[stable(feature = "rust1", since = "1.0.0")] @@ -1734,7 +1736,7 @@ impl<'a> Iterator for LinesAny<'a> { #[inline] fn next(&mut self) -> Option<&'a str> { self.inner.next() } #[inline] - fn size_hint(&self) -> (uint, Option) { self.inner.size_hint() } + fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } } #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index ac48481027d..0a3abd5d1ac 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -159,12 +159,12 @@ impl AsciiExt for u8 { #[inline] fn to_ascii_uppercase(&self) -> u8 { - ASCII_UPPERCASE_MAP[*self as uint] + ASCII_UPPERCASE_MAP[*self as usize] } #[inline] fn to_ascii_lowercase(&self) -> u8 { - ASCII_LOWERCASE_MAP[*self as uint] + ASCII_LOWERCASE_MAP[*self as usize] } #[inline] diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 0ac569b9c8e..deffc1fe8da 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -32,7 +32,6 @@ #![feature(no_std)] #![no_std] #![feature(slicing_syntax)] -#![feature(int_uint)] #![feature(core)] extern crate core; diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs index a38f911688d..61f447a3dd3 100644 --- a/src/libunicode/tables.rs +++ b/src/libunicode/tables.rs @@ -14,7 +14,7 @@ /// The version of [Unicode](http://www.unicode.org/) /// that the unicode parts of `CharExt` and `UnicodeStrPrelude` traits are based on. -pub const UNICODE_VERSION: (uint, uint, uint) = (7, 0, 0); +pub const UNICODE_VERSION: (u64, u64, u64) = (7, 0, 0); fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { use core::cmp::Ordering::{Equal, Less, Greater}; @@ -6977,7 +6977,7 @@ pub mod conversions { } } - fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option { + fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option { match table.binary_search_by(|&(key, _)| { if c == key { Equal } else if key < c { Less } @@ -7613,13 +7613,13 @@ pub mod charwidth { } } - pub fn width(c: char, is_cjk: bool) -> Option { - match c as uint { + pub fn width(c: char, is_cjk: bool) -> Option { + match c as usize { _c @ 0 => Some(0), // null is zero width cu if cu < 0x20 => None, // control sequences have no width cu if cu < 0x7F => Some(1), // ASCII cu if cu < 0xA0 => None, // more control sequences - _ => Some(bsearch_range_value_table(c, is_cjk, charwidth_table) as uint) + _ => Some(bsearch_range_value_table(c, is_cjk, charwidth_table) as usize) } } diff --git a/src/libunicode/u_char.rs b/src/libunicode/u_char.rs index 467fed5d246..c0f45ca4d72 100644 --- a/src/libunicode/u_char.rs +++ b/src/libunicode/u_char.rs @@ -36,7 +36,7 @@ pub trait CharExt { /// Panics if given a radix > 36. #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn is_digit(self, radix: uint) -> bool; + fn is_digit(self, radix: u32) -> bool; /// Converts a character to the corresponding digit. /// @@ -51,7 +51,7 @@ pub trait CharExt { /// Panics if given a radix outside the range [0..36]. #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn to_digit(self, radix: uint) -> Option; + fn to_digit(self, radix: u32) -> Option; /// Returns an iterator that yields the hexadecimal Unicode escape /// of a character, as `char`s. @@ -80,12 +80,12 @@ pub trait CharExt { /// Returns the amount of bytes this character would need if encoded in /// UTF-8. #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf8(self) -> uint; + fn len_utf8(self) -> usize; /// Returns the amount of bytes this character would need if encoded in /// UTF-16. #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf16(self) -> uint; + fn len_utf16(self) -> usize; /// Encodes this character as UTF-8 into the provided byte buffer, /// and then returns the number of bytes written. @@ -94,7 +94,7 @@ pub trait CharExt { /// and a `None` will be returned. #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf8(self, dst: &mut [u8]) -> Option; + fn encode_utf8(self, dst: &mut [u8]) -> Option; /// Encodes this character as UTF-16 into the provided `u16` buffer, /// and then returns the number of `u16`s written. @@ -103,7 +103,7 @@ pub trait CharExt { /// and a `None` will be returned. #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf16(self, dst: &mut [u16]) -> Option; + fn encode_utf16(self, dst: &mut [u16]) -> Option; /// Returns whether the specified character is considered a Unicode /// alphabetic code point. @@ -216,31 +216,31 @@ pub trait CharExt { /// `is_cjk` = `false`) if the context cannot be reliably determined. #[unstable(feature = "unicode", reason = "needs expert opinion. is_cjk flag stands out as ugly")] - fn width(self, is_cjk: bool) -> Option; + fn width(self, is_cjk: bool) -> Option; } #[stable(feature = "rust1", since = "1.0.0")] impl CharExt for char { #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn is_digit(self, radix: uint) -> bool { C::is_digit(self, radix) } + fn is_digit(self, radix: u32) -> bool { C::is_digit(self, radix) } #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn to_digit(self, radix: uint) -> Option { C::to_digit(self, radix) } + fn to_digit(self, radix: u32) -> Option { C::to_digit(self, radix) } #[stable(feature = "rust1", since = "1.0.0")] fn escape_unicode(self) -> char::EscapeUnicode { C::escape_unicode(self) } #[stable(feature = "rust1", since = "1.0.0")] fn escape_default(self) -> char::EscapeDefault { C::escape_default(self) } #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf8(self) -> uint { C::len_utf8(self) } + fn len_utf8(self) -> usize { C::len_utf8(self) } #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf16(self) -> uint { C::len_utf16(self) } + fn len_utf16(self) -> usize { C::len_utf16(self) } #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf8(self, dst: &mut [u8]) -> Option { C::encode_utf8(self, dst) } + fn encode_utf8(self, dst: &mut [u8]) -> Option { C::encode_utf8(self, dst) } #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf16(self, dst: &mut [u16]) -> Option { C::encode_utf16(self, dst) } + fn encode_utf16(self, dst: &mut [u16]) -> Option { C::encode_utf16(self, dst) } #[stable(feature = "rust1", since = "1.0.0")] fn is_alphabetic(self) -> bool { @@ -313,5 +313,5 @@ impl CharExt for char { #[unstable(feature = "unicode", reason = "needs expert opinion. is_cjk flag stands out as ugly")] - fn width(self, is_cjk: bool) -> Option { charwidth::width(self, is_cjk) } + fn width(self, is_cjk: bool) -> Option { charwidth::width(self, is_cjk) } } diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 15cf3986e6e..9bd8c5525a0 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -43,7 +43,7 @@ pub trait UnicodeStr { fn words<'a>(&'a self) -> Words<'a>; fn is_whitespace(&self) -> bool; fn is_alphanumeric(&self) -> bool; - fn width(&self, is_cjk: bool) -> uint; + fn width(&self, is_cjk: bool) -> usize; fn trim<'a>(&'a self) -> &'a str; fn trim_left<'a>(&'a self) -> &'a str; fn trim_right<'a>(&'a self) -> &'a str; @@ -57,7 +57,7 @@ impl UnicodeStr for str { #[inline] fn grapheme_indices(&self, is_extended: bool) -> GraphemeIndices { - GraphemeIndices { start_offset: self.as_ptr() as uint, iter: self.graphemes(is_extended) } + GraphemeIndices { start_offset: self.as_ptr() as usize, iter: self.graphemes(is_extended) } } #[inline] @@ -78,7 +78,7 @@ impl UnicodeStr for str { fn is_alphanumeric(&self) -> bool { self.chars().all(|c| c.is_alphanumeric()) } #[inline] - fn width(&self, is_cjk: bool) -> uint { + fn width(&self, is_cjk: bool) -> usize { self.chars().map(|c| c.width(is_cjk).unwrap_or(0)).sum() } @@ -101,28 +101,28 @@ impl UnicodeStr for str { /// External iterator for grapheme clusters and byte offsets. #[derive(Clone)] pub struct GraphemeIndices<'a> { - start_offset: uint, + start_offset: usize, iter: Graphemes<'a>, } impl<'a> Iterator for GraphemeIndices<'a> { - type Item = (uint, &'a str); + type Item = (usize, &'a str); #[inline] - fn next(&mut self) -> Option<(uint, &'a str)> { - self.iter.next().map(|s| (s.as_ptr() as uint - self.start_offset, s)) + fn next(&mut self) -> Option<(usize, &'a str)> { + self.iter.next().map(|s| (s.as_ptr() as usize - self.start_offset, s)) } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { self.iter.size_hint() } } impl<'a> DoubleEndedIterator for GraphemeIndices<'a> { #[inline] - fn next_back(&mut self) -> Option<(uint, &'a str)> { - self.iter.next_back().map(|s| (s.as_ptr() as uint - self.start_offset, s)) + fn next_back(&mut self) -> Option<(usize, &'a str)> { + self.iter.next_back().map(|s| (s.as_ptr() as usize - self.start_offset, s)) } } @@ -151,7 +151,7 @@ impl<'a> Iterator for Graphemes<'a> { type Item = &'a str; #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { let slen = self.string.len(); (cmp::min(slen, 1), Some(slen)) } @@ -378,8 +378,8 @@ static UTF8_CHAR_WIDTH: [u8; 256] = [ /// Given a first byte, determine how many bytes are in this UTF-8 character #[inline] -pub fn utf8_char_width(b: u8) -> uint { - return UTF8_CHAR_WIDTH[b as uint] as uint; +pub fn utf8_char_width(b: u8) -> usize { + return UTF8_CHAR_WIDTH[b as usize] as usize; } /// Determines if a vector of `u16` contains valid UTF-16 @@ -468,7 +468,7 @@ impl<'a> Iterator for Utf16Items<'a> { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { let (low, high) = self.iter.size_hint(); // we could be entirely valid surrogates (2 elements per // char), or entirely non-surrogates (1 element per char) @@ -534,7 +534,7 @@ impl Iterator for Utf16Encoder where I: Iterator { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { let (low, high) = self.chars.size_hint(); // every char gets either one u16 or two u16, // so this iterator is between 1 or 2 times as -- cgit 1.4.1-3-g733a5 From b1cd76906a4c7e40e3eb3569450d2dbd3be9fcab Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 15 Feb 2015 00:10:19 +0300 Subject: Fix the fallout --- src/libcore/fmt/float.rs | 10 +++++----- src/libcore/num/mod.rs | 8 ++++---- src/libfmt_macros/lib.rs | 2 +- src/libstd/num/f32.rs | 14 +++++++------- src/libstd/num/f64.rs | 14 +++++++------- src/libstd/num/strconv.rs | 14 +++++++------- src/libsyntax/parse/lexer/mod.rs | 2 +- src/libterm/terminfo/parm.rs | 2 +- src/test/run-pass/exponential-notation.rs | 10 +++++----- 9 files changed, 38 insertions(+), 38 deletions(-) (limited to 'src/libstd') diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 25bb959b9b3..8e09e52daee 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -53,7 +53,7 @@ pub enum SignFormat { SignNeg } -static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11; +static DIGIT_E_RADIX: u32 = ('e' as u32) - ('a' as u32) + 11; /// Converts a number to its string representation as a byte vector. /// This is meant to be a common base implementation for all numeric string @@ -87,7 +87,7 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11; /// between digit and exponent sign `'p'`. pub fn float_to_str_bytes_common( num: T, - radix: uint, + radix: u32, negative_zero: bool, sign: SignFormat, digits: SignificantDigits, @@ -156,7 +156,7 @@ pub fn float_to_str_bytes_common( deccum = deccum / radix_gen; deccum = deccum.trunc(); - let c = char::from_digit(current_digit.to_int().unwrap() as uint, radix); + let c = char::from_digit(current_digit.to_int().unwrap() as u32, radix); buf[end] = c.unwrap() as u8; end += 1; @@ -211,7 +211,7 @@ pub fn float_to_str_bytes_common( // See note in first loop. let current_digit = deccum.trunc().abs(); - let c = char::from_digit(current_digit.to_int().unwrap() as uint, + let c = char::from_digit(current_digit.to_int().unwrap() as u32, radix); buf[end] = c.unwrap() as u8; end += 1; @@ -228,7 +228,7 @@ pub fn float_to_str_bytes_common( let ascii2value = |chr: u8| { (chr as char).to_digit(radix).unwrap() }; - let value2ascii = |val: uint| { + let value2ascii = |val: u32| { char::from_digit(val, radix).unwrap() as u8 }; diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index b7c5c6640ce..d6c01ddc74a 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1432,12 +1432,12 @@ pub trait Float #[unstable(feature = "core", reason = "needs reevaluation")] pub trait FromStrRadix { type Err; - fn from_str_radix(str: &str, radix: uint) -> Result; + fn from_str_radix(str: &str, radix: u32) -> Result; } /// A utility function that just calls FromStrRadix::from_str_radix. #[unstable(feature = "core", reason = "needs reevaluation")] -pub fn from_str_radix(str: &str, radix: uint) +pub fn from_str_radix(str: &str, radix: u32) -> Result { FromStrRadix::from_str_radix(str, radix) } @@ -1501,7 +1501,7 @@ 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`. - fn from_str_radix(src: &str, radix: uint) + fn from_str_radix(src: &str, radix: u32) -> Result<$T, ParseFloatError> { use self::FloatErrorKind::*; use self::ParseFloatError as PFE; @@ -1661,7 +1661,7 @@ macro_rules! from_str_radix_int_impl { #[stable(feature = "rust1", since = "1.0.0")] impl FromStrRadix for $T { type Err = ParseIntError; - fn from_str_radix(src: &str, radix: uint) + fn from_str_radix(src: &str, radix: u32) -> Result<$T, ParseIntError> { use self::IntErrorKind::*; use self::ParseIntError as PIE; diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index fc8d18df815..baad31a61e1 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -422,7 +422,7 @@ impl<'a> Parser<'a> { Some((_, c)) => { match c.to_digit(10) { Some(i) => { - cur = cur * 10 + i; + cur = cur * 10 + i as usize; found = true; self.cur.next(); } diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 58b93665fe1..62ed824c3ba 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -369,7 +369,7 @@ impl Float for f32 { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_string(num: f32) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigAll, ExpNone, false); + num, 10, true, SignNeg, DigAll, ExpNone, false); r } @@ -382,7 +382,7 @@ pub fn to_string(num: f32) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_hex(num: f32) -> String { let (r, _) = strconv::float_to_str_common( - num, 16u, true, SignNeg, DigAll, ExpNone, false); + num, 16, true, SignNeg, DigAll, ExpNone, false); r } @@ -395,7 +395,7 @@ pub fn to_str_hex(num: f32) -> String { /// * radix - The base to use #[inline] #[unstable(feature = "std_misc", reason = "may be removed or relocated")] -pub fn to_str_radix_special(num: f32, rdx: uint) -> (String, bool) { +pub fn to_str_radix_special(num: f32, rdx: u32) -> (String, bool) { strconv::float_to_str_common(num, rdx, true, SignNeg, DigAll, ExpNone, false) } @@ -410,7 +410,7 @@ pub fn to_str_radix_special(num: f32, rdx: uint) -> (String, bool) { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exact(num: f32, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigExact(dig), ExpNone, false); + num, 10, true, SignNeg, DigExact(dig), ExpNone, false); r } @@ -425,7 +425,7 @@ pub fn to_str_exact(num: f32, dig: uint) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_digits(num: f32, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigMax(dig), ExpNone, false); + num, 10, true, SignNeg, DigMax(dig), ExpNone, false); r } @@ -441,7 +441,7 @@ pub fn to_str_digits(num: f32, dig: uint) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigExact(dig), ExpDec, upper); + num, 10, true, SignNeg, DigExact(dig), ExpDec, upper); r } @@ -457,7 +457,7 @@ pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_digits(num: f32, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigMax(dig), ExpDec, upper); + num, 10, true, SignNeg, DigMax(dig), ExpDec, upper); r } diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 8b17feeb70c..0e2ac97ca01 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -378,7 +378,7 @@ impl Float for f64 { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_string(num: f64) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigAll, ExpNone, false); + num, 10, true, SignNeg, DigAll, ExpNone, false); r } @@ -391,7 +391,7 @@ pub fn to_string(num: f64) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_hex(num: f64) -> String { let (r, _) = strconv::float_to_str_common( - num, 16u, true, SignNeg, DigAll, ExpNone, false); + num, 16, true, SignNeg, DigAll, ExpNone, false); r } @@ -404,7 +404,7 @@ pub fn to_str_hex(num: f64) -> String { /// * radix - The base to use #[inline] #[unstable(feature = "std_misc", reason = "may be removed or relocated")] -pub fn to_str_radix_special(num: f64, rdx: uint) -> (String, bool) { +pub fn to_str_radix_special(num: f64, rdx: u32) -> (String, bool) { strconv::float_to_str_common(num, rdx, true, SignNeg, DigAll, ExpNone, false) } @@ -419,7 +419,7 @@ pub fn to_str_radix_special(num: f64, rdx: uint) -> (String, bool) { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exact(num: f64, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigExact(dig), ExpNone, false); + num, 10, true, SignNeg, DigExact(dig), ExpNone, false); r } @@ -434,7 +434,7 @@ pub fn to_str_exact(num: f64, dig: uint) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_digits(num: f64, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigMax(dig), ExpNone, false); + num, 10, true, SignNeg, DigMax(dig), ExpNone, false); r } @@ -450,7 +450,7 @@ pub fn to_str_digits(num: f64, dig: uint) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigExact(dig), ExpDec, upper); + num, 10, true, SignNeg, DigExact(dig), ExpDec, upper); r } @@ -466,7 +466,7 @@ pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_digits(num: f64, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigMax(dig), ExpDec, upper); + num, 10, true, SignNeg, DigMax(dig), ExpDec, upper); r } diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 4ae7d3437fd..cf5e1eb0eb7 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -182,7 +182,7 @@ fn int_to_str_bytes_common(num: T, radix: uint, sign: SignFormat, mut f: F /// - Panics if `radix` > 25 and `exp_format` is `ExpBin` due to conflict /// between digit and exponent sign `'p'`. pub fn float_to_str_bytes_common( - num: T, radix: uint, negative_zero: bool, + num: T, radix: u32, negative_zero: bool, sign: SignFormat, digits: SignificantDigits, exp_format: ExponentFormat, exp_upper: bool ) -> (Vec, bool) { assert!(2 <= radix && radix <= 36); @@ -253,7 +253,7 @@ pub fn float_to_str_bytes_common( deccum = deccum / radix_gen; deccum = deccum.trunc(); - buf.push(char::from_digit(current_digit.to_int().unwrap() as uint, radix) + buf.push(char::from_digit(current_digit.to_int().unwrap() as u32, radix) .unwrap() as u8); // No more digits to calculate for the non-fractional part -> break @@ -310,7 +310,7 @@ pub fn float_to_str_bytes_common( let current_digit = deccum.trunc().abs(); buf.push(char::from_digit( - current_digit.to_int().unwrap() as uint, radix).unwrap() as u8); + current_digit.to_int().unwrap() as u32, radix).unwrap() as u8); // Decrease the deccumulator one fractional digit at a time deccum = deccum.fract(); @@ -324,7 +324,7 @@ pub fn float_to_str_bytes_common( let ascii2value = |chr: u8| { (chr as char).to_digit(radix).unwrap() }; - let value2ascii = |val: uint| { + let value2ascii = |val: u32| { char::from_digit(val, radix).unwrap() as u8 }; @@ -412,7 +412,7 @@ pub fn float_to_str_bytes_common( /// `to_str_bytes_common()`, for details see there. #[inline] pub fn float_to_str_common( - num: T, radix: uint, negative_zero: bool, + num: T, radix: u32, negative_zero: bool, sign: SignFormat, digits: SignificantDigits, exp_format: ExponentFormat, exp_capital: bool ) -> (String, bool) { let (bytes, special) = float_to_str_bytes_common(num, radix, @@ -422,8 +422,8 @@ pub fn float_to_str_common( // Some constants for from_str_bytes_common's input validation, // they define minimum radix values for which the character is a valid digit. -static DIGIT_P_RADIX: uint = ('p' as uint) - ('a' as uint) + 11u; -static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u; +static DIGIT_P_RADIX: u32 = ('p' as u32) - ('a' as u32) + 11; +static DIGIT_E_RADIX: u32 = ('e' as u32) - ('a' as u32) + 11; #[cfg(test)] mod tests { diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index ecc39925a40..cfd80b6755c 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -645,7 +645,7 @@ impl<'a> StringReader<'a> { /// Scan through any digits (base `radix`) or underscores, and return how /// many digits there were. - fn scan_digits(&mut self, radix: usize) -> usize { + fn scan_digits(&mut self, radix: u32) -> usize { let mut len = 0; loop { let c = self.curr; diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 016dc84b23b..82b5ec11d95 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -297,7 +297,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) PushParam => { // params are 1-indexed stack.push(mparams[match cur.to_digit(10) { - Some(d) => d - 1, + Some(d) => d as usize - 1, None => return Err("bad param number".to_string()) }].clone()); }, diff --git a/src/test/run-pass/exponential-notation.rs b/src/test/run-pass/exponential-notation.rs index 1fb434f7d76..bfe22712de8 100644 --- a/src/test/run-pass/exponential-notation.rs +++ b/src/test/run-pass/exponential-notation.rs @@ -19,18 +19,18 @@ macro_rules! t { pub fn main() { // Basic usage - t!(to_string(1.2345678e-5f64, 10u, true, SignNeg, DigMax(6), ExpDec, false), + t!(to_string(1.2345678e-5f64, 10, true, SignNeg, DigMax(6), ExpDec, false), "1.234568e-5"); // Hexadecimal output - t!(to_string(7.281738281250e+01f64, 16u, true, SignAll, DigMax(6), ExpBin, false), + t!(to_string(7.281738281250e+01f64, 16, true, SignAll, DigMax(6), ExpBin, false), "+1.2345p+6"); - t!(to_string(-1.777768135071e-02f64, 16u, true, SignAll, DigMax(6), ExpBin, false), + t!(to_string(-1.777768135071e-02f64, 16, true, SignAll, DigMax(6), ExpBin, false), "-1.2345p-6"); // Some denormals - t!(to_string(4.9406564584124654e-324f64, 10u, true, SignNeg, DigMax(6), ExpBin, false), + t!(to_string(4.9406564584124654e-324f64, 10, true, SignNeg, DigMax(6), ExpBin, false), "1p-1074"); - t!(to_string(2.2250738585072009e-308f64, 10u, true, SignNeg, DigMax(6), ExpBin, false), + t!(to_string(2.2250738585072009e-308f64, 10, true, SignNeg, DigMax(6), ExpBin, false), "1p-1022"); } -- cgit 1.4.1-3-g733a5 From f0f8be2a2e0aab2efef42208e19886790a0742f5 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 15 Feb 2015 19:07:14 +0530 Subject: Fix rollup (remove slicing_syntax) --- src/compiletest/compiletest.rs | 2 +- src/libcollections/lib.rs | 1 - src/libcollections/slice.rs | 1 - src/libcore/lib.rs | 2 +- src/libcoretest/lib.rs | 2 +- src/libfmt_macros/lib.rs | 1 - src/libgetopts/lib.rs | 1 - src/libgraphviz/lib.rs | 1 - src/liblog/lib.rs | 1 - src/librbml/lib.rs | 1 - src/librustc/lib.rs | 2 +- src/librustc_driver/lib.rs | 2 +- src/librustc_resolve/lib.rs | 1 - src/librustc_trans/lib.rs | 2 +- src/librustc_typeck/lib.rs | 2 +- src/librustdoc/lib.rs | 1 - src/libserialize/lib.rs | 1 - src/libstd/old_io/net/udp.rs | 1 - src/libsyntax/lib.rs | 1 - src/libterm/lib.rs | 1 - src/libtest/lib.rs | 2 +- src/libunicode/lib.rs | 1 - src/rustbook/main.rs | 2 +- src/test/run-pass/ranges-precedence.rs | 1 - 24 files changed, 9 insertions(+), 24 deletions(-) (limited to 'src/libstd') diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 385f1b9e791..6b6251a96c9 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -16,7 +16,7 @@ #![feature(io)] #![feature(path)] #![feature(rustc_private)] -#![feature(slicing_syntax, unboxed_closures)] +#![feature(unboxed_closures)] #![feature(std_misc)] #![feature(test)] #![feature(unicode)] diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 460c897b6ad..8325e7247d5 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -27,7 +27,6 @@ #![feature(box_patterns)] #![feature(core)] #![feature(hash)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(unboxed_closures)] #![feature(unicode)] diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index b3f398b9cdf..924589eb44c 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -52,7 +52,6 @@ //! interval `[a, b)`: //! //! ```rust -//! #![feature(slicing_syntax)] //! fn main() { //! let numbers = [0, 1, 2]; //! let last_numbers = &numbers[1..3]; diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index a122bcb2c7a..7243bd4f0cb 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -64,7 +64,7 @@ #![feature(int_uint)] #![feature(intrinsics, lang_items)] #![feature(on_unimplemented)] -#![feature(simd, unsafe_destructor, slicing_syntax)] +#![feature(simd, unsafe_destructor)] #![feature(staged_api)] #![feature(unboxed_closures)] diff --git a/src/libcoretest/lib.rs b/src/libcoretest/lib.rs index 50066ab07f5..2dfd81f32c2 100644 --- a/src/libcoretest/lib.rs +++ b/src/libcoretest/lib.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] #![feature(int_uint)] #![feature(unboxed_closures)] -#![feature(unsafe_destructor, slicing_syntax)] +#![feature(unsafe_destructor)] #![allow(deprecated)] // rand extern crate core; diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index baad31a61e1..1c7e97d784c 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -25,7 +25,6 @@ html_playground_url = "http://play.rust-lang.org/")] #![feature(int_uint)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(unicode)] diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index a3cae259fd3..ca184fb8736 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -91,7 +91,6 @@ #![deny(missing_docs)] #![feature(collections)] #![feature(int_uint)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![cfg_attr(test, feature(rustc_private))] diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 2d94ddaef18..a1a271bc5ab 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -273,7 +273,6 @@ #![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(slicing_syntax)] #![feature(int_uint)] #![feature(collections)] #![feature(core)] diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 1fedf49738c..5edb4a96a7d 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -168,7 +168,6 @@ #![deny(missing_docs)] #![feature(staged_api)] -#![feature(slicing_syntax)] #![feature(box_syntax)] #![feature(int_uint)] #![feature(core)] diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index 20af4dadfca..154dbbdb750 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -30,7 +30,6 @@ #![feature(int_uint)] #![feature(io)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] extern crate serialize; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index a4c4ea54386..f060d464e41 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -36,7 +36,7 @@ #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slicing_syntax, unsafe_destructor)] +#![feature(unsafe_destructor)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 50a68e8f1e3..9b8ca398b12 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -35,7 +35,7 @@ #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slicing_syntax, unsafe_destructor)] +#![feature(unsafe_destructor)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 848c3557b1b..874c8f2a940 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -24,7 +24,6 @@ #![feature(int_uint)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(std_misc)] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index c4d1416d975..21557379e3a 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -37,7 +37,7 @@ #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slicing_syntax, unsafe_destructor)] +#![feature(unsafe_destructor)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index ccfadaba244..7498dc8179d 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -83,7 +83,7 @@ This API is completely unstable and subject to change. #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slicing_syntax, unsafe_destructor)] +#![feature(unsafe_destructor)] #![feature(staged_api)] #[macro_use] extern crate log; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 9d45caf7669..b09c3f730fc 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -30,7 +30,6 @@ #![feature(os)] #![feature(path)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(std_misc)] #![feature(test)] diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 4579d1f19d3..6cada2e5614 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -33,7 +33,6 @@ Core encoding and decoding interfaces. #![feature(path)] #![feature(hash)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/libstd/old_io/net/udp.rs b/src/libstd/old_io/net/udp.rs index 5f1089bc63b..8dc19047de0 100644 --- a/src/libstd/old_io/net/udp.rs +++ b/src/libstd/old_io/net/udp.rs @@ -32,7 +32,6 @@ use sys_common; /// /// ```rust,no_run /// # #![allow(unused_must_use)] -/// #![feature(slicing_syntax)] /// /// use std::old_io::net::udp::UdpSocket; /// use std::old_io::net::ip::{Ipv4Addr, SocketAddr}; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 951e4dcf792..f4b0c867f42 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -35,7 +35,6 @@ #![feature(path)] #![feature(quote, unsafe_destructor)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 1bb038603c3..c4b3d2813af 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -57,7 +57,6 @@ #![feature(io)] #![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 cc468df87f3..860ce209d45 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -32,7 +32,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![feature(asm, slicing_syntax)] +#![feature(asm)] #![feature(box_syntax)] #![feature(collections)] #![feature(core)] diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 977cb783344..89b310d4949 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -31,7 +31,6 @@ html_playground_url = "http://play.rust-lang.org/")] #![feature(no_std)] #![no_std] -#![feature(slicing_syntax)] #![feature(core)] extern crate core; diff --git a/src/rustbook/main.rs b/src/rustbook/main.rs index 3e571bad09c..b29538ad620 100644 --- a/src/rustbook/main.rs +++ b/src/rustbook/main.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slicing_syntax, box_syntax)] +#![feature(box_syntax)] #![feature(collections)] #![feature(core)] #![feature(io)] diff --git a/src/test/run-pass/ranges-precedence.rs b/src/test/run-pass/ranges-precedence.rs index cd490948516..db414abb7ff 100644 --- a/src/test/run-pass/ranges-precedence.rs +++ b/src/test/run-pass/ranges-precedence.rs @@ -10,7 +10,6 @@ // Test that the precedence of ranges is correct -#![feature(slicing_syntax)] struct Foo { foo: uint, -- cgit 1.4.1-3-g733a5