diff options
| author | bors <bors@rust-lang.org> | 2014-07-13 21:01:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-07-13 21:01:28 +0000 |
| commit | ffd9966c79ad034fe16e66e6c6795473473a6f50 (patch) | |
| tree | e50643ce8f24f411e120b8e1381b026d5d9fadc2 /src/libstd | |
| parent | 7a6208f2cc1bbe29dc42b21d27e98894b8bacc04 (diff) | |
| parent | e0ede9c6b3894851b800a323757857eba07943b5 (diff) | |
| download | rust-ffd9966c79ad034fe16e66e6c6795473473a6f50.tar.gz rust-ffd9966c79ad034fe16e66e6c6795473473a6f50.zip | |
auto merge of #15591 : aturon/rust/box-cell-stability, r=alexcrichton
This PR is the outcome of the library stabilization meeting for the `liballoc::owned` and `libcore::cell` modules. Aside from the stability attributes, there are a few breaking changes: * The `owned` modules is now named `boxed`, to better represent its contents. (`box` was unavailable, since it's a keyword.) This will help avoid the misconception that `Box` plays a special role wrt ownership. * The `AnyOwnExt` extension trait is renamed to `BoxAny`, and its `move` method is renamed to `downcast`, in both cases to improve clarity. * The recently-added `AnySendOwnExt` extension trait is removed; it was not being used and is unnecessary. [breaking-change]
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/lru_cache.rs | 2 | ||||
| -rw-r--r-- | src/libstd/failure.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/fs.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/net/tcp.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/net/udp.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/net/unix.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/pipe.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/process.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/signal.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/stdio.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/timer.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/util.rs | 4 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 7 | ||||
| -rw-r--r-- | src/libstd/prelude.rs | 2 | ||||
| -rw-r--r-- | src/libstd/task.rs | 12 |
16 files changed, 26 insertions, 23 deletions
diff --git a/src/libstd/collections/lru_cache.rs b/src/libstd/collections/lru_cache.rs index a02402271d0..45301737adb 100644 --- a/src/libstd/collections/lru_cache.rs +++ b/src/libstd/collections/lru_cache.rs @@ -45,7 +45,7 @@ use iter::{range, Iterator}; use mem; use ops::Drop; use option::{Some, None, Option}; -use owned::Box; +use boxed::Box; use ptr; use result::{Ok, Err}; diff --git a/src/libstd/failure.rs b/src/libstd/failure.rs index 47ff85e2806..8c709d20d19 100644 --- a/src/libstd/failure.rs +++ b/src/libstd/failure.rs @@ -10,7 +10,7 @@ #![experimental] -use alloc::owned::Box; +use alloc::boxed::Box; use any::{Any, AnyRefExt}; use fmt; use io::{Writer, IoResult}; diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index 74ab19d0aa6..449ad6fa0da 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -62,7 +62,7 @@ use iter::Iterator; use kinds::Send; use libc; use option::{Some, None, Option}; -use owned::Box; +use boxed::Box; use path::{Path, GenericPath}; use path; use result::{Err, Ok}; diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 4ef2e51fcf0..db4df7a8a6f 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -229,7 +229,7 @@ use mem::transmute; use ops::{BitOr, BitAnd, Sub, Not}; use option::{Option, Some, None}; use os; -use owned::Box; +use boxed::Box; use result::{Ok, Err, Result}; use rt::rtio; use slice::{Vector, MutableVector, ImmutableVector}; diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs index 49322098348..642654ba6ed 100644 --- a/src/libstd/io/net/tcp.rs +++ b/src/libstd/io/net/tcp.rs @@ -29,7 +29,7 @@ use io::{Reader, Writer, Listener, Acceptor}; use from_str::FromStr; use kinds::Send; use option::{None, Some, Option}; -use owned::Box; +use boxed::Box; use rt::rtio::{IoFactory, LocalIo, RtioSocket, RtioTcpListener}; use rt::rtio::{RtioTcpAcceptor, RtioTcpStream}; use rt::rtio; diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs index 21903eb2643..5f7563e7467 100644 --- a/src/libstd/io/net/udp.rs +++ b/src/libstd/io/net/udp.rs @@ -19,7 +19,7 @@ use clone::Clone; use io::net::ip::{SocketAddr, IpAddr}; use io::{Reader, Writer, IoResult, IoError}; use kinds::Send; -use owned::Box; +use boxed::Box; use option::Option; use result::{Ok, Err}; use rt::rtio::{RtioSocket, RtioUdpSocket, IoFactory, LocalIo}; diff --git a/src/libstd/io/net/unix.rs b/src/libstd/io/net/unix.rs index c5ddda9945d..5e7c4214977 100644 --- a/src/libstd/io/net/unix.rs +++ b/src/libstd/io/net/unix.rs @@ -30,7 +30,7 @@ use c_str::ToCStr; use clone::Clone; use io::{Listener, Acceptor, Reader, Writer, IoResult, IoError}; use kinds::Send; -use owned::Box; +use boxed::Box; use rt::rtio::{IoFactory, LocalIo, RtioUnixListener}; use rt::rtio::{RtioUnixAcceptor, RtioPipe}; diff --git a/src/libstd/io/pipe.rs b/src/libstd/io/pipe.rs index a968f41a915..c476a99fee9 100644 --- a/src/libstd/io/pipe.rs +++ b/src/libstd/io/pipe.rs @@ -20,7 +20,7 @@ use prelude::*; use io::{IoResult, IoError}; use libc; use os; -use owned::Box; +use boxed::Box; use rt::rtio::{RtioPipe, LocalIo}; /// A synchronous, in-memory pipe. diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 6ef73023779..07574b72645 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -21,7 +21,7 @@ use io::{IoResult, IoError}; use io; use libc; use mem; -use owned::Box; +use boxed::Box; use rt::rtio::{RtioProcess, ProcessConfig, IoFactory, LocalIo}; use rt::rtio; use c_str::CString; diff --git a/src/libstd/io/signal.rs b/src/libstd/io/signal.rs index 4a7655a63ce..d46f437cddd 100644 --- a/src/libstd/io/signal.rs +++ b/src/libstd/io/signal.rs @@ -26,7 +26,7 @@ use iter::Iterator; use kinds::Send; use mem::drop; use option::{Some, None}; -use owned::Box; +use boxed::Box; use result::{Ok, Err}; use rt::rtio::{IoFactory, LocalIo, RtioSignal, Callback}; use slice::ImmutableVector; diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index cdd083202e0..45c084b3459 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -35,7 +35,7 @@ use iter::Iterator; use kinds::Send; use libc; use option::{Option, Some, None}; -use owned::Box; +use boxed::Box; use result::{Ok, Err}; use rt; use rt::local::Local; diff --git a/src/libstd/io/timer.rs b/src/libstd/io/timer.rs index 432461c4606..1c9e428dcad 100644 --- a/src/libstd/io/timer.rs +++ b/src/libstd/io/timer.rs @@ -20,7 +20,7 @@ and create receivers which will receive notifications after a period of time. use comm::{Receiver, Sender, channel}; use io::{IoResult, IoError}; use kinds::Send; -use owned::Box; +use boxed::Box; use rt::rtio::{IoFactory, LocalIo, RtioTimer, Callback}; /// A synchronous timer object diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 2acf12b76c0..e928323030c 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -13,7 +13,7 @@ use prelude::*; use cmp; use io; -use owned::Box; +use boxed::Box; use slice::bytes::MutableByteVector; /// Wraps a `Reader`, limiting the number of bytes that can be read from it. @@ -263,7 +263,7 @@ impl<T: Iterator<u8>> Reader for IterReader<T> { mod test { use io::{MemReader, MemWriter, BufReader}; use io; - use owned::Box; + use boxed::Box; use super::*; use prelude::*; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 1e1522a2bcc..ad6942712ac 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -138,7 +138,7 @@ extern crate rustrt; #[cfg(test)] pub use realstd::ops; #[cfg(test)] pub use realstd::cmp; #[cfg(test)] pub use realstd::ty; -#[cfg(test)] pub use realstd::owned; +#[cfg(test)] pub use realstd::boxed; #[cfg(test)] pub use realstd::gc; @@ -167,7 +167,10 @@ pub use core::unit; pub use core::result; pub use core::option; -pub use alloc::owned; +pub use alloc::boxed; +#[deprecated = "use boxed instead"] +pub use owned = boxed; + pub use alloc::rc; pub use core_collections::slice; diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index 21f80777293..a20ac112ac5 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -72,7 +72,7 @@ #[doc(no_inline)] pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}; #[doc(no_inline)] pub use num::{Signed, Unsigned, Primitive, Int, Float}; #[doc(no_inline)] pub use num::{FloatMath, ToPrimitive, FromPrimitive}; -#[doc(no_inline)] pub use owned::Box; +#[doc(no_inline)] pub use boxed::Box; #[doc(no_inline)] pub use path::{GenericPath, Path, PosixPath, WindowsPath}; #[doc(no_inline)] pub use ptr::RawPtr; #[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek}; diff --git a/src/libstd/task.rs b/src/libstd/task.rs index 72cc596085e..d7af92024eb 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -98,7 +98,7 @@ use comm::channel; use io::{Writer, stdio}; use kinds::{Send, marker}; use option::{None, Some, Option}; -use owned::Box; +use boxed::Box; use result::Result; use rt::local::Local; use rt::task; @@ -374,7 +374,7 @@ pub fn failing() -> bool { #[cfg(test)] mod test { use any::{Any, AnyRefExt}; - use owned::AnyOwnExt; + use boxed::BoxAny; use result; use result::{Ok, Err}; use str::StrAllocating; @@ -578,7 +578,7 @@ mod test { Err(e) => { type T = &'static str; assert!(e.is::<T>()); - assert_eq!(*e.move::<T>().unwrap(), "static string"); + assert_eq!(*e.downcast::<T>().unwrap(), "static string"); } Ok(()) => fail!() } @@ -592,7 +592,7 @@ mod test { Err(e) => { type T = String; assert!(e.is::<T>()); - assert_eq!(*e.move::<T>().unwrap(), "owned string".to_string()); + assert_eq!(*e.downcast::<T>().unwrap(), "owned string".to_string()); } Ok(()) => fail!() } @@ -606,9 +606,9 @@ mod test { Err(e) => { type T = Box<Any + Send>; assert!(e.is::<T>()); - let any = e.move::<T>().unwrap(); + let any = e.downcast::<T>().unwrap(); assert!(any.is::<u16>()); - assert_eq!(*any.move::<u16>().unwrap(), 413u16); + assert_eq!(*any.downcast::<u16>().unwrap(), 413u16); } Ok(()) => fail!() } |
