diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-12-02 17:07:29 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-12-10 11:47:55 -0800 |
| commit | da50f7c288b8e6856b42fd923f3479af1c94b3bf (patch) | |
| tree | 8f1aa965704dc20ec8140fd7b7649e050ec9f0ee /src/libstd | |
| parent | 08a5b112ed7af90e31a355e409f637997e458fbc (diff) | |
| download | rust-da50f7c288b8e6856b42fd923f3479af1c94b3bf.tar.gz rust-da50f7c288b8e6856b42fd923f3479af1c94b3bf.zip | |
std: Remove deprecated functionality from 1.5
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/bench.rs | 15 | ||||
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 23 | ||||
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 27 | ||||
| -rw-r--r-- | src/libstd/fs.rs | 79 | ||||
| -rw-r--r-- | src/libstd/io/prelude.rs | 3 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 5 | ||||
| -rw-r--r-- | src/libstd/num/f32.rs | 28 | ||||
| -rw-r--r-- | src/libstd/num/f64.rs | 28 | ||||
| -rw-r--r-- | src/libstd/sys/windows/c.rs | 11 |
9 files changed, 40 insertions, 179 deletions
diff --git a/src/libstd/collections/hash/bench.rs b/src/libstd/collections/hash/bench.rs index ac21ae0f0aa..9fae9af2d54 100644 --- a/src/libstd/collections/hash/bench.rs +++ b/src/libstd/collections/hash/bench.rs @@ -14,7 +14,6 @@ extern crate test; use prelude::v1::*; use self::test::Bencher; -use iter::range_inclusive; #[bench] fn new_drop(b : &mut Bencher) { @@ -43,7 +42,7 @@ fn grow_by_insertion(b: &mut Bencher) { let mut m = HashMap::new(); - for i in range_inclusive(1, 1000) { + for i in 1..1001 { m.insert(i, i); } @@ -61,12 +60,12 @@ fn find_existing(b: &mut Bencher) { let mut m = HashMap::new(); - for i in range_inclusive(1, 1000) { + for i in 1..1001 { m.insert(i, i); } b.iter(|| { - for i in range_inclusive(1, 1000) { + for i in 1..1001 { m.contains_key(&i); } }); @@ -78,12 +77,12 @@ fn find_nonexisting(b: &mut Bencher) { let mut m = HashMap::new(); - for i in range_inclusive(1, 1000) { + for i in 1..1001 { m.insert(i, i); } b.iter(|| { - for i in range_inclusive(1001, 2000) { + for i in 1001..2001 { m.contains_key(&i); } }); @@ -95,7 +94,7 @@ fn hashmap_as_queue(b: &mut Bencher) { let mut m = HashMap::new(); - for i in range_inclusive(1, 1000) { + for i in 1..1001 { m.insert(i, i); } @@ -114,7 +113,7 @@ fn get_remove_insert(b: &mut Bencher) { let mut m = HashMap::new(); - for i in range_inclusive(1, 1000) { + for i in 1..1001 { m.insert(i, i); } diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 77c4149f992..38c080febf1 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1681,7 +1681,6 @@ mod test_map { use super::HashMap; use super::Entry::{Occupied, Vacant}; - use iter::range_inclusive; use cell::RefCell; use rand::{thread_rng, Rng}; @@ -1877,42 +1876,42 @@ mod test_map { for _ in 0..10 { assert!(m.is_empty()); - for i in range_inclusive(1, 1000) { + for i in 1..1001 { assert!(m.insert(i, i).is_none()); - for j in range_inclusive(1, i) { + for j in 1..i+1 { let r = m.get(&j); assert_eq!(r, Some(&j)); } - for j in range_inclusive(i+1, 1000) { + for j in i+1..1001 { let r = m.get(&j); assert_eq!(r, None); } } - for i in range_inclusive(1001, 2000) { + for i in 1001..2001 { assert!(!m.contains_key(&i)); } // remove forwards - for i in range_inclusive(1, 1000) { + for i in 1..1001 { assert!(m.remove(&i).is_some()); - for j in range_inclusive(1, i) { + for j in 1..i+1 { assert!(!m.contains_key(&j)); } - for j in range_inclusive(i+1, 1000) { + for j in i+1..1001 { assert!(m.contains_key(&j)); } } - for i in range_inclusive(1, 1000) { + for i in 1..1001 { assert!(!m.contains_key(&i)); } - for i in range_inclusive(1, 1000) { + for i in 1..1001 { assert!(m.insert(i, i).is_none()); } @@ -1920,11 +1919,11 @@ mod test_map { for i in (1..1001).rev() { assert!(m.remove(&i).is_some()); - for j in range_inclusive(i, 1000) { + for j in i..1001 { assert!(!m.contains_key(&j)); } - for j in range_inclusive(1, i-1) { + for j in 1..i { assert!(m.contains_key(&j)); } } diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 40fb450bea1..318ff410cba 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -211,18 +211,6 @@ impl CString { /// The only appropriate argument is a pointer obtained by calling /// `into_raw`. The length of the string will be recalculated /// using the pointer. - #[unstable(feature = "cstr_memory2", reason = "recently added", - issue = "27769")] - #[rustc_deprecated(since = "1.4.0", reason = "renamed to from_raw")] - pub unsafe fn from_ptr(ptr: *const c_char) -> CString { - CString::from_raw(ptr as *mut _) - } - - /// Retakes ownership of a CString that was transferred to C. - /// - /// The only appropriate argument is a pointer obtained by calling - /// `into_raw`. The length of the string will be recalculated - /// using the pointer. #[stable(feature = "cstr_memory", since = "1.4.0")] pub unsafe fn from_raw(ptr: *mut c_char) -> CString { let len = libc::strlen(ptr) + 1; // Including the NUL byte @@ -238,21 +226,6 @@ impl CString { /// this string. /// /// Failure to call `from_raw` will lead to a memory leak. - #[unstable(feature = "cstr_memory2", reason = "recently added", - issue = "27769")] - #[rustc_deprecated(since = "1.4.0", reason = "renamed to into_raw")] - pub fn into_ptr(self) -> *const c_char { - self.into_raw() as *const _ - } - - /// Transfers ownership of the string to a C caller. - /// - /// The pointer must be returned to Rust and reconstituted using - /// `from_raw` to be properly deallocated. Specifically, one - /// should *not* use the standard C `free` function to deallocate - /// this string. - /// - /// Failure to call `from_raw` will lead to a memory leak. #[stable(feature = "cstr_memory", since = "1.4.0")] pub fn into_raw(self) -> *mut c_char { Box::into_raw(self.inner) as *mut c_char diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index bfad2248359..25a05efd026 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1178,85 +1178,6 @@ impl Iterator for WalkDir { } } -/// Utility methods for paths. -#[unstable(feature = "path_ext_deprecated", - reason = "The precise set of methods exposed on this trait may \ - change and some methods may be removed. For stable code, \ - see the std::fs::metadata function.", - issue = "27725")] -#[rustc_deprecated(since = "1.5.0", reason = "replaced with inherent methods")] -pub trait PathExt { - /// Gets information on the file, directory, etc at this path. - /// - /// Consult the `fs::metadata` documentation for more info. - /// - /// This call preserves identical runtime/error semantics with - /// `fs::metadata`. - fn metadata(&self) -> io::Result<Metadata>; - - /// Gets information on the file, directory, etc at this path. - /// - /// Consult the `fs::symlink_metadata` documentation for more info. - /// - /// This call preserves identical runtime/error semantics with - /// `fs::symlink_metadata`. - fn symlink_metadata(&self) -> io::Result<Metadata>; - - /// Returns the canonical form of a path, normalizing all components and - /// eliminate all symlinks. - /// - /// This call preserves identical runtime/error semantics with - /// `fs::canonicalize`. - fn canonicalize(&self) -> io::Result<PathBuf>; - - /// Reads the symlink at this path. - /// - /// For more information see `fs::read_link`. - fn read_link(&self) -> io::Result<PathBuf>; - - /// Reads the directory at this path. - /// - /// For more information see `fs::read_dir`. - fn read_dir(&self) -> io::Result<ReadDir>; - - /// Boolean value indicator whether the underlying file exists on the local - /// filesystem. Returns false in exactly the cases where `fs::metadata` - /// fails. - fn exists(&self) -> bool; - - /// Whether the underlying implementation (be it a file path, or something - /// else) points at a "regular file" on the FS. Will return false for paths - /// to non-existent locations or directories or other non-regular files - /// (named pipes, etc). Follows links when making this determination. - fn is_file(&self) -> bool; - - /// Whether the underlying implementation (be it a file path, or something - /// else) is pointing at a directory in the underlying FS. Will return - /// false for paths to non-existent locations or if the item is not a - /// directory (eg files, named pipes, etc). Follows links when making this - /// determination. - fn is_dir(&self) -> bool; -} - -#[allow(deprecated)] -#[unstable(feature = "path_ext_deprecated", issue = "27725")] -impl PathExt for Path { - fn metadata(&self) -> io::Result<Metadata> { metadata(self) } - fn symlink_metadata(&self) -> io::Result<Metadata> { symlink_metadata(self) } - fn canonicalize(&self) -> io::Result<PathBuf> { canonicalize(self) } - fn read_link(&self) -> io::Result<PathBuf> { read_link(self) } - fn read_dir(&self) -> io::Result<ReadDir> { read_dir(self) } - fn exists(&self) -> bool { metadata(self).is_ok() } - - fn is_file(&self) -> bool { - metadata(self).map(|s| s.is_file()).unwrap_or(false) - } - - fn is_dir(&self) -> bool { - metadata(self).map(|s| s.is_dir()).unwrap_or(false) - } -} - /// Changes the permissions found on a file or a directory. /// /// # Examples diff --git a/src/libstd/io/prelude.rs b/src/libstd/io/prelude.rs index f588ec60589..8772d0f5b09 100644 --- a/src/libstd/io/prelude.rs +++ b/src/libstd/io/prelude.rs @@ -22,6 +22,3 @@ #[stable(feature = "rust1", since = "1.0.0")] pub use super::{Read, Write, BufRead, Seek}; -#[allow(deprecated)] -#[unstable(feature = "path_ext_deprecated", issue = "27725")] -pub use fs::PathExt; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 8e6c32ff2fc..c8b8caee84e 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -233,7 +233,6 @@ #![feature(const_fn)] #![feature(core_float)] #![feature(core_intrinsics)] -#![feature(core_simd)] #![feature(decode_utf16)] #![feature(drop_in_place)] #![feature(dropck_parametricity)] @@ -255,6 +254,7 @@ #![feature(rand)] #![feature(range_inclusive)] #![feature(raw)] +#![feature(repr_simd)] #![feature(reflect_marker)] #![feature(shared)] #![feature(slice_bytes)] @@ -334,9 +334,6 @@ pub use core::ptr; #[stable(feature = "rust1", since = "1.0.0")] pub use core::raw; #[stable(feature = "rust1", since = "1.0.0")] -#[allow(deprecated)] -pub use core::simd; -#[stable(feature = "rust1", since = "1.0.0")] pub use core::result; #[stable(feature = "rust1", since = "1.0.0")] pub use core::option; diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index c87becd741e..30bee80fbf6 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -18,7 +18,7 @@ use core::num; use intrinsics; use libc::c_int; -use num::{FpCategory, ParseFloatError}; +use num::FpCategory; #[stable(feature = "rust1", since = "1.0.0")] pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON}; @@ -126,16 +126,6 @@ mod cmath { #[cfg(not(test))] #[lang = "f32"] impl f32 { - /// Parses a float as with a given radix - #[unstable(feature = "float_from_str_radix", reason = "recently moved API", - issue = "27736")] - #[rustc_deprecated(since = "1.4.0", - reason = "unclear how useful or correct this is")] - #[allow(deprecated)] - pub fn from_str_radix(s: &str, radix: u32) -> Result<f32, ParseFloatError> { - num::Float::from_str_radix(s, radix) - } - /// Returns `true` if this value is `NaN` and false otherwise. /// /// ``` @@ -1712,11 +1702,9 @@ mod tests { #[test] fn test_ldexp() { - // We have to use from_str until base-2 exponents - // are supported in floating-point literals - let f1: f32 = f32::from_str_radix("1p-123", 16).unwrap(); - let f2: f32 = f32::from_str_radix("1p-111", 16).unwrap(); - let f3: f32 = f32::from_str_radix("1.Cp-12", 16).unwrap(); + let f1 = 2.0f32.powi(-123); + let f2 = 2.0f32.powi(-111); + let f3 = 1.75 * 2.0f32.powi(-12); assert_eq!(f32::ldexp(1f32, -123), f1); assert_eq!(f32::ldexp(1f32, -111), f2); assert_eq!(f32::ldexp(1.75f32, -12), f3); @@ -1734,11 +1722,9 @@ mod tests { #[test] fn test_frexp() { - // We have to use from_str until base-2 exponents - // are supported in floating-point literals - let f1: f32 = f32::from_str_radix("1p-123", 16).unwrap(); - let f2: f32 = f32::from_str_radix("1p-111", 16).unwrap(); - let f3: f32 = f32::from_str_radix("1.Cp-123", 16).unwrap(); + let f1 = 2.0f32.powi(-123); + let f2 = 2.0f32.powi(-111); + let f3 = 1.75 * 2.0f32.powi(-123); let (x1, exp1) = f1.frexp(); let (x2, exp2) = f2.frexp(); let (x3, exp3) = f3.frexp(); diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 6b9c753443b..d444b259445 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -18,7 +18,7 @@ use core::num; use intrinsics; use libc::c_int; -use num::{FpCategory, ParseFloatError}; +use num::FpCategory; #[stable(feature = "rust1", since = "1.0.0")] pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON}; @@ -83,16 +83,6 @@ mod cmath { #[cfg(not(test))] #[lang = "f64"] impl f64 { - /// Parses a float as with a given radix - #[unstable(feature = "float_from_str_radix", reason = "recently moved API", - issue = "27736")] - #[rustc_deprecated(since = "1.4.0", - reason = "unclear how useful or correct this is")] - #[allow(deprecated)] - pub fn from_str_radix(s: &str, radix: u32) -> Result<f64, ParseFloatError> { - num::Float::from_str_radix(s, radix) - } - /// Returns `true` if this value is `NaN` and false otherwise. /// /// ``` @@ -1569,11 +1559,9 @@ mod tests { #[test] fn test_ldexp() { - // We have to use from_str until base-2 exponents - // are supported in floating-point literals - let f1: f64 = f64::from_str_radix("1p-123", 16).unwrap(); - let f2: f64 = f64::from_str_radix("1p-111", 16).unwrap(); - let f3: f64 = f64::from_str_radix("1.Cp-12", 16).unwrap(); + let f1 = 2.0f64.powi(-123); + let f2 = 2.0f64.powi(-111); + let f3 = 1.75 * 2.0f64.powi(-12); assert_eq!(f64::ldexp(1f64, -123), f1); assert_eq!(f64::ldexp(1f64, -111), f2); assert_eq!(f64::ldexp(1.75f64, -12), f3); @@ -1591,11 +1579,9 @@ mod tests { #[test] fn test_frexp() { - // We have to use from_str until base-2 exponents - // are supported in floating-point literals - let f1: f64 = f64::from_str_radix("1p-123", 16).unwrap(); - let f2: f64 = f64::from_str_radix("1p-111", 16).unwrap(); - let f3: f64 = f64::from_str_radix("1.Cp-123", 16).unwrap(); + let f1 = 2.0f64.powi(-123); + let f2 = 2.0f64.powi(-111); + let f3 = 1.75 * 2.0f64.powi(-123); let (x1, exp1) = f1.frexp(); let (x2, exp2) = f2.frexp(); let (x3, exp3) = f3.frexp(); diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 7ef504fba81..5e0368f35cc 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -16,7 +16,10 @@ use os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort}; use os::raw::{c_char, c_short, c_ulonglong}; use libc::{wchar_t, size_t, c_void}; use ptr; -use simd; + +#[cfg_attr(not(stage0), repr(simd))] +#[repr(C)] +struct u64x2(u64, u64); pub use self::GET_FILEEX_INFO_LEVELS::*; pub use self::FILE_INFO_BY_HANDLE_CLASS::*; @@ -783,7 +786,7 @@ pub struct FLOATING_SAVE_AREA { #[cfg(target_arch = "x86_64")] #[repr(C)] pub struct CONTEXT { - _align_hack: [simd::u64x2; 0], // FIXME align on 16-byte + _align_hack: [u64x2; 0], // FIXME align on 16-byte pub P1Home: DWORDLONG, pub P2Home: DWORDLONG, pub P3Home: DWORDLONG, @@ -843,7 +846,7 @@ pub struct CONTEXT { #[cfg(target_arch = "x86_64")] #[repr(C)] pub struct M128A { - _align_hack: [simd::u64x2; 0], // FIXME align on 16-byte + _align_hack: [u64x2; 0], // FIXME align on 16-byte pub Low: c_ulonglong, pub High: c_longlong } @@ -851,7 +854,7 @@ pub struct M128A { #[cfg(target_arch = "x86_64")] #[repr(C)] pub struct FLOATING_SAVE_AREA { - _align_hack: [simd::u64x2; 0], // FIXME align on 16-byte + _align_hack: [u64x2; 0], // FIXME align on 16-byte _Dummy: [u8; 512] // FIXME: Fill this out } |
