diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-06-10 19:33:04 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-06-17 09:07:17 -0700 |
| commit | b4a2823cd6c6f1a560469587f902f3a1f49d3c79 (patch) | |
| tree | 162e8021fd73ffc7dfe0798dc99097138343977a /src/libstd | |
| parent | aa931e9c6f92557b99978f1cc562c99051190f79 (diff) | |
| download | rust-b4a2823cd6c6f1a560469587f902f3a1f49d3c79.tar.gz rust-b4a2823cd6c6f1a560469587f902f3a1f49d3c79.zip | |
More test fixes and fallout of stability changes
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/error.rs | 4 | ||||
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 5 | ||||
| -rw-r--r-- | src/libstd/io/buffered.rs | 5 | ||||
| -rw-r--r-- | src/libstd/io/lazy.rs | 3 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 1 | ||||
| -rw-r--r-- | src/libstd/rt/at_exit_imp.rs | 11 | ||||
| -rw-r--r-- | src/libstd/rt/mod.rs | 4 | ||||
| -rw-r--r-- | src/libstd/rt/unwind/gcc.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sync/future.rs | 9 | ||||
| -rw-r--r-- | src/libstd/sync/mod.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/mpsc_queue.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/spsc_queue.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sync/mutex.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/common/wtf8.rs | 26 | ||||
| -rw-r--r-- | src/libstd/thread/local.rs | 3 | ||||
| -rw-r--r-- | src/libstd/thread/mod.rs | 1 |
16 files changed, 30 insertions, 54 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 1677f95ca90..17e8859d63f 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -48,7 +48,7 @@ // reconsider what crate these items belong in. use any::TypeId; -use boxed::{self, Box}; +use boxed::Box; use convert::From; use fmt::{self, Debug, Display}; use marker::{Send, Sync, Reflect}; @@ -249,7 +249,7 @@ impl Error { if self.is::<T>() { unsafe { // Get the raw representation of the trait object - let raw = boxed::into_raw(self); + let raw = Box::into_raw(self); let to: TraitObject = transmute::<*mut Error, TraitObject>(raw); diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index d5df9b3aa72..becc697bcd9 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -8,9 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - use borrow::{Cow, ToOwned}; -use boxed::{self, Box}; +use boxed::Box; use clone::Clone; use convert::{Into, From}; use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; @@ -226,7 +225,7 @@ impl CString { // It is important that the bytes be sized to fit - we need // the capacity to be determinable from the string length, and // shrinking to fit is the only way to be sure. - boxed::into_raw(self.inner) as *const libc::c_char + Box::into_raw(self.inner) as *const libc::c_char } /// Returns the contents of this `CString` as a slice of bytes. diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 95363870cd0..1d0152e2751 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -465,6 +465,7 @@ pub struct BufStream<S: Write> { leading to issues like #17136")] #[deprecated(since = "1.2.0", reason = "use the crates.io `bufstream` crate instead")] +#[allow(deprecated)] impl<S: Read + Write> BufStream<S> { /// Creates a new buffered stream with explicitly listed capacities for the /// reader/writer buffer. @@ -516,6 +517,7 @@ impl<S: Read + Write> BufStream<S> { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl<S: Read + Write> BufRead for BufStream<S> { fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() } fn consume(&mut self, amt: usize) { self.inner.consume(amt) } @@ -524,6 +526,7 @@ impl<S: Read + Write> BufRead for BufStream<S> { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl<S: Read + Write> Read for BufStream<S> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { self.inner.read(buf) @@ -533,6 +536,7 @@ impl<S: Read + Write> Read for BufStream<S> { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl<S: Read + Write> Write for BufStream<S> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { self.inner.inner.get_mut().write(buf) @@ -545,6 +549,7 @@ impl<S: Read + Write> Write for BufStream<S> { #[unstable(feature = "buf_stream", reason = "unsure about semantics of buffering two directions, \ leading to issues like #17136")] +#[allow(deprecated)] impl<S: Write> fmt::Debug for BufStream<S> where S: fmt::Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let reader = &self.inner; diff --git a/src/libstd/io/lazy.rs b/src/libstd/io/lazy.rs index d398cb88af4..c3e309d182b 100644 --- a/src/libstd/io/lazy.rs +++ b/src/libstd/io/lazy.rs @@ -10,7 +10,6 @@ use prelude::v1::*; -use boxed; use cell::Cell; use rt; use sync::{StaticMutex, Arc}; @@ -60,7 +59,7 @@ impl<T: Send + Sync + 'static> Lazy<T> { }); let ret = (self.init)(); if registered.is_ok() { - self.ptr.set(boxed::into_raw(Box::new(ret.clone()))); + self.ptr.set(Box::into_raw(Box::new(ret.clone()))); } return ret } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 9f9435f4123..251f962c5e3 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -106,7 +106,6 @@ #![feature(alloc)] #![feature(allow_internal_unstable)] #![feature(associated_consts)] -#![feature(borrow_state)] #![feature(box_raw)] #![feature(box_syntax)] #![feature(char_internals)] diff --git a/src/libstd/rt/at_exit_imp.rs b/src/libstd/rt/at_exit_imp.rs index 19a17be4ccf..17d2940a6f1 100644 --- a/src/libstd/rt/at_exit_imp.rs +++ b/src/libstd/rt/at_exit_imp.rs @@ -16,13 +16,12 @@ // segfaults (the queue's memory is mysteriously gone), so // instead the cleanup is tied to the `std::rt` entry point. -use boxed; +use alloc::boxed::FnBox; use boxed::Box; -use vec::Vec; -use thunk::Thunk; use sys_common::mutex::Mutex; +use vec::Vec; -type Queue = Vec<Thunk<'static>>; +type Queue = Vec<Box<FnBox()>>; // NB these are specifically not types from `std::sync` as they currently rely // on poisoning and this module needs to operate at a lower level than requiring @@ -40,7 +39,7 @@ const ITERS: usize = 10; unsafe fn init() -> bool { if QUEUE.is_null() { let state: Box<Queue> = box Vec::new(); - QUEUE = boxed::into_raw(state); + QUEUE = Box::into_raw(state); } else if QUEUE as usize == 1 { // can't re-init after a cleanup return false @@ -71,7 +70,7 @@ pub fn cleanup() { } } -pub fn push(f: Thunk<'static>) -> bool { +pub fn push(f: Box<FnBox()>) -> bool { let mut ret = true; unsafe { LOCK.lock(); diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 1b8e81e2b79..1729d20da20 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -139,7 +139,9 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize { if failed { rt::DEFAULT_ERROR_CODE } else { - env::get_exit_status() as isize + #[allow(deprecated)] + fn exit_status() -> isize { env::get_exit_status() as isize } + exit_status() } } diff --git a/src/libstd/rt/unwind/gcc.rs b/src/libstd/rt/unwind/gcc.rs index 39b32a3f08e..84c6d6864a9 100644 --- a/src/libstd/rt/unwind/gcc.rs +++ b/src/libstd/rt/unwind/gcc.rs @@ -11,7 +11,6 @@ use prelude::v1::*; use any::Any; -use boxed; use libc::c_void; use rt::libunwind as uw; @@ -29,7 +28,7 @@ pub unsafe fn panic(data: Box<Any + Send + 'static>) -> ! { }, cause: Some(data), }; - let exception_param = boxed::into_raw(exception) as *mut uw::_Unwind_Exception; + let exception_param = Box::into_raw(exception) as *mut uw::_Unwind_Exception; let error = uw::_Unwind_RaiseException(exception_param); rtabort!("Could not unwind stack, error = {}", error as isize); diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index e3ddc1034a5..28dc124f033 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -32,10 +32,11 @@ reason = "futures as-is have yet to be deeply reevaluated with recent \ core changes to Rust's synchronization story, and will likely \ become stable in the future but are unstable until that time")] -#[deprecated(since = "1.2.0", - reason = "implementation does not match the quality of the \ - standard library and this will likely be prototyped \ - outside in crates.io first")] +#![deprecated(since = "1.2.0", + reason = "implementation does not match the quality of the \ + standard library and this will likely be prototyped \ + outside in crates.io first")] +#![allow(deprecated)] use core::prelude::*; use core::mem::replace; diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs index 91e9714fbef..ab8d4587cfd 100644 --- a/src/libstd/sync/mod.rs +++ b/src/libstd/sync/mod.rs @@ -30,6 +30,7 @@ pub use self::rwlock::{RwLockReadGuard, RwLockWriteGuard}; pub use self::rwlock::{RwLock, StaticRwLock, RW_LOCK_INIT}; pub use self::semaphore::{Semaphore, SemaphoreGuard}; +#[allow(deprecated)] pub use self::future::Future; pub mod mpsc; diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index f3edf0d68c7..d6d173e5e7e 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -42,7 +42,6 @@ pub use self::PopResult::*; use core::prelude::*; -use alloc::boxed; use alloc::boxed::Box; use core::ptr; use core::cell::UnsafeCell; @@ -80,7 +79,7 @@ unsafe impl<T: Send> Sync for Queue<T> { } impl<T> Node<T> { unsafe fn new(v: Option<T>) -> *mut Node<T> { - boxed::into_raw(box Node { + Box::into_raw(box Node { next: AtomicPtr::new(ptr::null_mut()), value: v, }) diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index 770068a66be..3cf75de5a46 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -35,7 +35,6 @@ use core::prelude::*; -use alloc::boxed; use alloc::boxed::Box; use core::ptr; use core::cell::UnsafeCell; @@ -78,7 +77,7 @@ unsafe impl<T: Send> Sync for Queue<T> { } impl<T> Node<T> { fn new() -> *mut Node<T> { - boxed::into_raw(box Node { + Box::into_raw(box Node { value: None, next: AtomicPtr::new(ptr::null_mut::<Node<T>>()), }) diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 64a5027cc89..41cd11e4c69 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -85,8 +85,6 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; /// To recover from a poisoned mutex: /// /// ``` -/// #![feature(sync_poison)] -/// /// use std::sync::{Arc, Mutex}; /// use std::thread; /// diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index 428c8560d88..8ea673d2162 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -28,7 +28,7 @@ use core::prelude::*; use core::char::{encode_utf8_raw, encode_utf16_raw}; -use core::str::{char_range_at_raw, next_code_point}; +use core::str::next_code_point; use ascii::*; use borrow::Cow; @@ -1149,30 +1149,6 @@ mod tests { } #[test] - fn wtf8_code_point_at() { - let mut string = Wtf8Buf::from_str("aé "); - string.push(CodePoint::from_u32(0xD83D).unwrap()); - string.push_char('💩'); - assert_eq!(string.code_point_at(0), CodePoint::from_char('a')); - assert_eq!(string.code_point_at(1), CodePoint::from_char('é')); - assert_eq!(string.code_point_at(3), CodePoint::from_char(' ')); - assert_eq!(string.code_point_at(4), CodePoint::from_u32(0xD83D).unwrap()); - assert_eq!(string.code_point_at(7), CodePoint::from_char('💩')); - } - - #[test] - fn wtf8_code_point_range_at() { - let mut string = Wtf8Buf::from_str("aé "); - string.push(CodePoint::from_u32(0xD83D).unwrap()); - string.push_char('💩'); - assert_eq!(string.code_point_range_at(0), (CodePoint::from_char('a'), 1)); - assert_eq!(string.code_point_range_at(1), (CodePoint::from_char('é'), 3)); - assert_eq!(string.code_point_range_at(3), (CodePoint::from_char(' '), 4)); - assert_eq!(string.code_point_range_at(4), (CodePoint::from_u32(0xD83D).unwrap(), 7)); - assert_eq!(string.code_point_range_at(7), (CodePoint::from_char('💩'), 11)); - } - - #[test] fn wtf8_code_points() { fn c(value: u32) -> CodePoint { CodePoint::from_u32(value).unwrap() } fn cp(string: &Wtf8Buf) -> Vec<Option<char>> { diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 2b5e3fb18eb..2c4b716cc6e 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -326,7 +326,6 @@ mod imp { // Due to rust-lang/rust#18804, make sure this is not generic! #[cfg(target_os = "linux")] unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { - use boxed; use mem; use ptr; use libc; @@ -360,7 +359,7 @@ mod imp { type List = Vec<(*mut u8, unsafe extern fn(*mut u8))>; if DTORS.get().is_null() { let v: Box<List> = box Vec::new(); - DTORS.set(boxed::into_raw(v) as *mut u8); + DTORS.set(Box::into_raw(v) as *mut u8); } let list: &mut List = &mut *(DTORS.get() as *mut List); list.push((t, dtor)); diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index da9cde8e3cd..dbb7d3233bc 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -404,6 +404,7 @@ pub fn spawn<F, T>(f: F) -> JoinHandle<T> where #[deprecated(since = "1.2.0", reason = "this unsafe API is unlikely to ever be stabilized \ in this form")] +#[allow(deprecated)] pub fn scoped<'a, T, F>(f: F) -> JoinGuard<'a, T> where T: Send + 'a, F: FnOnce() -> T, F: Send + 'a { |
