diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-01-06 14:03:46 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-01-07 09:45:28 +1300 |
| commit | 503709708c72401dbe091ed5c7e0494efabe0669 (patch) | |
| tree | f49a23475150a74cce2c203aa56a735d51564a1c /src/libstd | |
| parent | 6539cb417f4a7c2d9d1afce44c196578d2b67f38 (diff) | |
Change `std::kinds` to `std::markers`; flatten `std::kinds::marker`
[breaking-change]
Diffstat (limited to 'src/libstd')
27 files changed, 62 insertions, 59 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index a3fc38c34e8..ce9857f8243 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -21,7 +21,7 @@ use default::Default; use fmt::{self, Show}; use hash::{Hash, Hasher, RandomSipHasher}; use iter::{self, Iterator, IteratorExt, FromIterator, Extend, Map}; -use kinds::Sized; +use markers::Sized; use mem::{self, replace}; use num::{Int, UnsignedInt}; use ops::{Deref, FnMut, Index, IndexMut}; diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 211bfe2c10e..d67581a12b3 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -13,7 +13,7 @@ use borrow::BorrowFrom; use clone::Clone; use cmp::{Eq, PartialEq}; -use core::kinds::Sized; +use core::markers::Sized; use default::Default; use fmt::Show; use fmt; diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 1eb4408eedc..cdfde1958c6 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -16,7 +16,7 @@ use clone::Clone; use cmp; use hash::{Hash, Hasher}; use iter::{Iterator, count}; -use kinds::{Copy, Sized, marker}; +use markers::{Copy, Sized, self}; use mem::{min_align_of, size_of}; use mem; use num::{Int, UnsignedInt}; @@ -72,7 +72,7 @@ pub struct RawTable<K, V> { hashes: Unique<u64>, // Because K/V do not appear directly in any of the types in the struct, // inform rustc that in fact instances of K and V are reachable from here. - marker: marker::CovariantType<(K,V)>, + marker: markers::CovariantType<(K,V)>, } struct RawBucket<K, V> { @@ -562,7 +562,7 @@ impl<K, V> RawTable<K, V> { size: 0, capacity: 0, hashes: Unique::null(), - marker: marker::CovariantType, + marker: markers::CovariantType, }; } // No need for `checked_mul` before a more restrictive check performed @@ -601,7 +601,7 @@ impl<K, V> RawTable<K, V> { capacity: capacity, size: 0, hashes: Unique(hashes), - marker: marker::CovariantType, + marker: markers::CovariantType, } } @@ -651,7 +651,7 @@ impl<K, V> RawTable<K, V> { hashes_end: unsafe { self.hashes.0.offset(self.capacity as int) }, - marker: marker::ContravariantLifetime, + marker: markers::ContravariantLifetime, } } @@ -676,7 +676,7 @@ impl<K, V> RawTable<K, V> { iter: RawBuckets { raw: raw, hashes_end: hashes_end, - marker: marker::ContravariantLifetime, + marker: markers::ContravariantLifetime, }, table: self, } @@ -689,7 +689,7 @@ impl<K, V> RawTable<K, V> { iter: RawBuckets { raw: raw, hashes_end: hashes_end, - marker: marker::ContravariantLifetime::<'static>, + marker: markers::ContravariantLifetime::<'static>, }, table: self, } @@ -703,7 +703,7 @@ impl<K, V> RawTable<K, V> { raw: raw_bucket.offset(self.capacity as int), hashes_end: raw_bucket.hash, elems_left: self.size, - marker: marker::ContravariantLifetime, + marker: markers::ContravariantLifetime, } } } @@ -713,7 +713,7 @@ impl<K, V> RawTable<K, V> { struct RawBuckets<'a, K, V> { raw: RawBucket<K, V>, hashes_end: *mut u64, - marker: marker::ContravariantLifetime<'a>, + marker: markers::ContravariantLifetime<'a>, } // FIXME(#19839) Remove in favor of `#[derive(Clone)]` @@ -722,7 +722,7 @@ impl<'a, K, V> Clone for RawBuckets<'a, K, V> { RawBuckets { raw: self.raw, hashes_end: self.hashes_end, - marker: marker::ContravariantLifetime, + marker: markers::ContravariantLifetime, } } } @@ -754,7 +754,7 @@ struct RevMoveBuckets<'a, K, V> { raw: RawBucket<K, V>, hashes_end: *mut u64, elems_left: uint, - marker: marker::ContravariantLifetime<'a>, + marker: markers::ContravariantLifetime<'a>, } impl<'a, K, V> Iterator for RevMoveBuckets<'a, K, V> { diff --git a/src/libstd/hash.rs b/src/libstd/hash.rs index ac2b01e995e..34facdc7de6 100644 --- a/src/libstd/hash.rs +++ b/src/libstd/hash.rs @@ -63,7 +63,7 @@ pub use core::hash::{Hash, Hasher, Writer, hash, sip}; -use core::kinds::Sized; +use core::markers::Sized; use default::Default; use rand::Rng; use rand; diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 5bef473db99..deae56d8a30 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -232,7 +232,7 @@ use error::{FromError, Error}; use fmt; use int; use iter::{Iterator, IteratorExt}; -use kinds::Sized; +use markers::Sized; use mem::transmute; use ops::FnOnce; use option::Option; diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index f571bed3ba2..43d37543e16 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -34,7 +34,7 @@ use failure::LOCAL_STDERR; use fmt; use io::{Reader, Writer, IoResult, IoError, OtherIoError, Buffer, standard_error, EndOfFile, LineBufferedWriter, BufferedReader}; -use kinds::{Sync, Send}; +use markers::{Sync, Send}; use libc; use mem; use option::Option; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index b9f226c5aca..b258c13f12e 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -18,7 +18,7 @@ //! //! The [`ptr`](ptr/index.html) and [`mem`](mem/index.html) //! modules deal with unsafe pointers and memory manipulation. -//! [`kinds`](kinds/index.html) defines the special built-in traits, +//! [`markers`](markers/index.html) defines the special built-in traits, //! and [`raw`](raw/index.html) the runtime representation of Rust types. //! These are some of the lowest-level building blocks in Rust. //! @@ -151,7 +151,7 @@ extern crate libc; // Make std testable by not duplicating lang items. See #2912 #[cfg(test)] extern crate "std" as realstd; -#[cfg(test)] pub use realstd::kinds; +#[cfg(test)] pub use realstd::markers; #[cfg(test)] pub use realstd::ops; #[cfg(test)] pub use realstd::cmp; #[cfg(test)] pub use realstd::boxed; @@ -168,7 +168,8 @@ pub use core::default; pub use core::finally; pub use core::intrinsics; pub use core::iter; -#[cfg(not(test))] pub use core::kinds; +#[cfg(stage0)] #[cfg(not(test))] pub use core::markers as kinds; +#[cfg(not(test))] pub use core::markers; pub use core::mem; #[cfg(not(test))] pub use core::ops; pub use core::ptr; @@ -311,7 +312,9 @@ mod std { pub use vec; // used for vec![] pub use cell; // used for tls! pub use thread_local; // used for thread_local! - pub use kinds; // used for tls! + #[cfg(stage0)] + pub use markers as kinds; + pub use markers; // used for tls! pub use ops; // used for bitflags! // The test runner calls ::std::os::args() but really wants realstd diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index e3402984ae5..cd78489cb85 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -19,7 +19,7 @@ #[cfg(test)] use fmt::Show; use ops::{Add, Sub, Mul, Div, Rem, Neg}; -use kinds::Copy; +use markers::Copy; use clone::Clone; use cmp::{PartialOrd, PartialEq}; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 300ceec4b45..0e41d608086 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -37,7 +37,7 @@ use error::{FromError, Error}; use fmt; use io::{IoResult, IoError}; use iter::{Iterator, IteratorExt}; -use kinds::Copy; +use markers::Copy; use libc::{c_void, c_int, c_char}; use libc; use boxed::Box; diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index b020164158c..e263761acd1 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -61,7 +61,7 @@ #![experimental] -use core::kinds::Sized; +use core::markers::Sized; use ffi::CString; use clone::Clone; use fmt; diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index d9981ace030..03811364d30 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -16,7 +16,7 @@ use hash; use io::Writer; use iter::{AdditiveIterator, Extend}; use iter::{Iterator, IteratorExt, Map}; -use kinds::Sized; +use markers::Sized; use option::Option::{self, Some, None}; use slice::{AsSlice, Split, SliceExt, SliceConcatExt}; use str::{self, FromStr, StrExt}; diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index 9e9a483e1a5..bf8d2a3d63b 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -13,7 +13,7 @@ #![stable] // Reexported core operators -#[stable] #[doc(no_inline)] pub use kinds::{Copy, Send, Sized, Sync}; +#[stable] #[doc(no_inline)] pub use markers::{Copy, Send, Sized, Sync}; #[stable] #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce}; // Reexported functions diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index a79a6e35ebc..512bd2a3d6e 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -185,7 +185,7 @@ mod imp { extern crate libc; use io::{IoResult}; - use kinds::Sync; + use markers::Sync; use mem; use os; use rand::Rng; diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index e556888a470..036bb7b637b 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -23,7 +23,7 @@ #![allow(dead_code)] -use kinds::Send; +use markers::Send; use ops::FnOnce; use sys; use thunk::Thunk; diff --git a/src/libstd/sync/mpsc/blocking.rs b/src/libstd/sync/mpsc/blocking.rs index faff5f09f81..af6aa803f99 100644 --- a/src/libstd/sync/mpsc/blocking.rs +++ b/src/libstd/sync/mpsc/blocking.rs @@ -13,8 +13,8 @@ use thread::Thread; use sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; use sync::Arc; -use kinds::{Sync, Send}; -use kinds::marker::{NoSend, NoSync}; +use markers::{Sync, Send}; +use markers::{NoSend, NoSync}; use mem; use clone::Clone; diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 7c18b8a43fa..4d18d9e6e9d 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -319,7 +319,7 @@ use prelude::v1::*; use sync::Arc; use fmt; -use kinds::marker; +use markers; use mem; use cell::UnsafeCell; @@ -373,7 +373,7 @@ unsafe impl<T:Send> Send for Sender<T> { } pub struct SyncSender<T> { inner: Arc<RacyCell<sync::Packet<T>>>, // can't share in an arc - _marker: marker::NoSync, + _marker: markers::NoSync, } /// An error returned from the `send` function on channels. @@ -678,7 +678,7 @@ impl<T: Send> Drop for Sender<T> { impl<T: Send> SyncSender<T> { fn new(inner: Arc<RacyCell<sync::Packet<T>>>) -> SyncSender<T> { - SyncSender { inner: inner, _marker: marker::NoSync } + SyncSender { inner: inner, _marker: markers::NoSync } } /// Sends a value on this synchronous channel. diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index 16adbf5aa4f..ca7120b5ead 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -57,7 +57,7 @@ use core::prelude::*; use core::cell::Cell; -use core::kinds::marker; +use core::markers; use core::mem; use core::uint; @@ -70,7 +70,7 @@ pub struct Select { head: *mut Handle<'static, ()>, tail: *mut Handle<'static, ()>, next_id: Cell<uint>, - marker1: marker::NoSend, + marker1: markers::NoSend, } /// A handle to a receiver which is currently a member of a `Select` set of @@ -115,7 +115,7 @@ impl Select { /// rather much easier through the `select!` macro. pub fn new() -> Select { Select { - marker1: marker::NoSend, + marker1: markers::NoSend, head: 0 as *mut Handle<'static, ()>, tail: 0 as *mut Handle<'static, ()>, next_id: Cell::new(1), diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 6b3dd89f33b..bb5a6337646 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -11,7 +11,7 @@ use prelude::v1::*; use cell::UnsafeCell; -use kinds::marker; +use markers; use ops::{Deref, DerefMut}; use sync::poison::{self, TryLockError, TryLockResult, LockResult}; use sys_common::mutex as sys; @@ -166,7 +166,7 @@ pub struct MutexGuard<'a, T: 'a> { __lock: &'a StaticMutex, __data: &'a UnsafeCell<T>, __poison: poison::Guard, - __marker: marker::NoSend, + __marker: markers::NoSend, } /// Static initialization of a mutex. This constant can be used to initialize @@ -286,7 +286,7 @@ impl<'mutex, T> MutexGuard<'mutex, T> { __lock: lock, __data: data, __poison: guard, - __marker: marker::NoSend, + __marker: markers::NoSend, } }) } diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index aa2d957a3eb..11a5cad2c25 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -14,7 +14,7 @@ //! example use case would be for initializing an FFI library. use int; -use kinds::Sync; +use markers::Sync; use mem::drop; use ops::FnOnce; use sync::atomic::{AtomicInt, Ordering, ATOMIC_INT_INIT}; diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 4afd5bb63f4..f40c0cc0c0e 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -11,7 +11,7 @@ use prelude::v1::*; use cell::UnsafeCell; -use kinds::marker; +use markers; use ops::{Deref, DerefMut}; use sync::poison::{self, LockResult, TryLockError, TryLockResult}; use sys_common::rwlock as sys; @@ -113,7 +113,7 @@ pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock { pub struct RwLockReadGuard<'a, T: 'a> { __lock: &'a StaticRwLock, __data: &'a UnsafeCell<T>, - __marker: marker::NoSend, + __marker: markers::NoSend, } /// RAII structure used to release the exclusive write access of a lock when @@ -124,7 +124,7 @@ pub struct RwLockWriteGuard<'a, T: 'a> { __lock: &'a StaticRwLock, __data: &'a UnsafeCell<T>, __poison: poison::Guard, - __marker: marker::NoSend, + __marker: markers::NoSend, } impl<T: Send + Sync> RwLock<T> { @@ -309,7 +309,7 @@ impl<'rwlock, T> RwLockReadGuard<'rwlock, T> { RwLockReadGuard { __lock: lock, __data: data, - __marker: marker::NoSend, + __marker: markers::NoSend, } }) } @@ -322,7 +322,7 @@ impl<'rwlock, T> RwLockWriteGuard<'rwlock, T> { __lock: lock, __data: data, __poison: guard, - __marker: marker::NoSend, + __marker: markers::NoSend, } }) } diff --git a/src/libstd/sys/common/mutex.rs b/src/libstd/sys/common/mutex.rs index 567c26956ef..b86e6ce254a 100644 --- a/src/libstd/sys/common/mutex.rs +++ b/src/libstd/sys/common/mutex.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use kinds::Sync; +use markers::Sync; use sys::mutex as imp; /// An OS-based mutual exclusion lock. diff --git a/src/libstd/sys/unix/c.rs b/src/libstd/sys/unix/c.rs index ca419d1c7f4..968347bbfbc 100644 --- a/src/libstd/sys/unix/c.rs +++ b/src/libstd/sys/unix/c.rs @@ -165,8 +165,8 @@ mod signal { sa_restorer: *mut libc::c_void, } - unsafe impl ::kinds::Send for sigaction { } - unsafe impl ::kinds::Sync for sigaction { } + unsafe impl ::markers::Send for sigaction { } + unsafe impl ::markers::Sync for sigaction { } #[repr(C)] #[cfg(target_word_size = "32")] @@ -217,8 +217,8 @@ mod signal { sa_resv: [libc::c_int; 1], } - unsafe impl ::kinds::Send for sigaction { } - unsafe impl ::kinds::Sync for sigaction { } + unsafe impl ::markers::Send for sigaction { } + unsafe impl ::markers::Sync for sigaction { } #[repr(C)] pub struct sigset_t { diff --git a/src/libstd/sys/unix/mutex.rs b/src/libstd/sys/unix/mutex.rs index 81f8659d6ae..8da25c7880d 100644 --- a/src/libstd/sys/unix/mutex.rs +++ b/src/libstd/sys/unix/mutex.rs @@ -9,7 +9,7 @@ // except according to those terms. use cell::UnsafeCell; -use kinds::Sync; +use markers::Sync; use sys::sync as ffi; use sys_common::mutex; diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index cc82d38ae2a..630087e2291 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -128,7 +128,7 @@ use any::Any; use boxed::Box; use cell::UnsafeCell; use clone::Clone; -use kinds::{Send, Sync}; +use markers::{Send, Sync}; use ops::{Drop, FnOnce}; use option::Option::{self, Some, None}; use result::Result::{Err, Ok}; diff --git a/src/libstd/thread_local/mod.rs b/src/libstd/thread_local/mod.rs index e0cbaa8ca50..bf01b578b1f 100644 --- a/src/libstd/thread_local/mod.rs +++ b/src/libstd/thread_local/mod.rs @@ -346,7 +346,7 @@ mod imp { pub dtor_running: UnsafeCell<bool>, // should be Cell } - unsafe impl<T> ::kinds::Sync for Key<T> { } + unsafe impl<T> ::markers::Sync for Key<T> { } #[doc(hidden)] impl<T> Key<T> { @@ -472,7 +472,7 @@ mod imp { pub os: OsStaticKey, } - unsafe impl<T> ::kinds::Sync for Key<T> { } + unsafe impl<T> ::markers::Sync for Key<T> { } struct Value<T: 'static> { key: &'static Key<T>, diff --git a/src/libstd/thread_local/scoped.rs b/src/libstd/thread_local/scoped.rs index 714b71d5dbd..a643d2cb8ee 100644 --- a/src/libstd/thread_local/scoped.rs +++ b/src/libstd/thread_local/scoped.rs @@ -108,7 +108,7 @@ macro_rules! __scoped_thread_local_inner { const _INIT: __Key<$t> = __Key { inner: ::std::thread_local::scoped::__impl::KeyInner { inner: ::std::thread_local::scoped::__impl::OS_INIT, - marker: ::std::kinds::marker::InvariantType, + marker: ::std::markers::InvariantType, } }; @@ -211,7 +211,7 @@ mod imp { #[doc(hidden)] pub struct KeyInner<T> { pub inner: UnsafeCell<*mut T> } - unsafe impl<T> ::kinds::Sync for KeyInner<T> { } + unsafe impl<T> ::markers::Sync for KeyInner<T> { } #[doc(hidden)] impl<T> KeyInner<T> { @@ -224,16 +224,16 @@ mod imp { #[cfg(any(windows, target_os = "android", target_os = "ios", target_arch = "aarch64"))] mod imp { - use kinds::marker; + use markers; use sys_common::thread_local::StaticKey as OsStaticKey; #[doc(hidden)] pub struct KeyInner<T> { pub inner: OsStaticKey, - pub marker: marker::InvariantType<T>, + pub marker: markers::InvariantType<T>, } - unsafe impl<T> ::kinds::Sync for KeyInner<T> { } + unsafe impl<T> ::markers::Sync for KeyInner<T> { } #[doc(hidden)] impl<T> KeyInner<T> { diff --git a/src/libstd/thunk.rs b/src/libstd/thunk.rs index 067926042f1..ec9dd86f941 100644 --- a/src/libstd/thunk.rs +++ b/src/libstd/thunk.rs @@ -12,7 +12,7 @@ #![allow(missing_docs)] use alloc::boxed::Box; -use core::kinds::Send; +use core::markers::Send; use core::ops::FnOnce; pub struct Thunk<A=(),R=()> { |
