stabilisation
This commit is contained in:
parent
503709708c
commit
ba2a77b450
@ -29,18 +29,21 @@ use clone::Clone;
|
||||
|
||||
|
||||
/// Types able to be transferred across task boundaries.
|
||||
#[unstable = "will be overhauled with new lifetime rules; see RFC 458"]
|
||||
#[lang="send"]
|
||||
pub unsafe trait Send: 'static {
|
||||
// empty.
|
||||
}
|
||||
|
||||
/// Types with a constant size known at compile-time.
|
||||
#[stable]
|
||||
#[lang="sized"]
|
||||
pub trait Sized {
|
||||
// Empty.
|
||||
}
|
||||
|
||||
/// Types that can be copied by simply copying bits (i.e. `memcpy`).
|
||||
#[stable]
|
||||
#[lang="copy"]
|
||||
pub trait Copy {
|
||||
// Empty.
|
||||
@ -91,6 +94,7 @@ pub trait Copy {
|
||||
/// around the value(s) which can be mutated when behind a `&`
|
||||
/// reference; not doing this is undefined behaviour (for example,
|
||||
/// `transmute`-ing from `&T` to `&mut T` is illegal).
|
||||
#[unstable = "will be overhauled with new lifetime rules; see RFC 458"]
|
||||
#[lang="sync"]
|
||||
pub unsafe trait Sync {
|
||||
// Empty
|
||||
@ -134,6 +138,7 @@ pub unsafe trait Sync {
|
||||
/// `S<T>` is a subtype of `S<U>` if `T` is a subtype of `U`
|
||||
/// (for example, `S<&'static int>` is a subtype of `S<&'a int>`
|
||||
/// for some lifetime `'a`, but not the other way around).
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
#[lang="covariant_type"]
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct CovariantType<Sized? T>;
|
||||
@ -182,6 +187,7 @@ impl<Sized? T> Clone for CovariantType<T> {
|
||||
/// subtype of `S<U>` if `U` is a subtype of `T`; given that the
|
||||
/// function requires arguments of type `T`, it must also accept
|
||||
/// arguments of type `U`, hence such a conversion is safe.
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
#[lang="contravariant_type"]
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct ContravariantType<T: ?Sized>;
|
||||
@ -212,11 +218,14 @@ impl<T: ?Sized> Clone for ContravariantType<T> {
|
||||
/// The type system would infer that `value` is only read here and
|
||||
/// never written, but in fact `Cell` uses unsafe code to achieve
|
||||
/// interior mutability.
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
#[lang="invariant_type"]
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct InvariantType<T: ?Sized>;
|
||||
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
impl<T: ?Sized> Copy for InvariantType<T> {}
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
impl<T: ?Sized> Clone for InvariantType<T> {
|
||||
fn clone(&self) -> InvariantType<T> { *self }
|
||||
}
|
||||
@ -237,6 +246,7 @@ impl<T: ?Sized> Clone for InvariantType<T> {
|
||||
///
|
||||
/// For more information about variance, refer to this Wikipedia
|
||||
/// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
#[lang="covariant_lifetime"]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct CovariantLifetime<'a>;
|
||||
@ -253,6 +263,7 @@ pub struct CovariantLifetime<'a>;
|
||||
///
|
||||
/// For more information about variance, refer to this Wikipedia
|
||||
/// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
#[lang="contravariant_lifetime"]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct ContravariantLifetime<'a>;
|
||||
@ -264,6 +275,7 @@ pub struct ContravariantLifetime<'a>;
|
||||
/// pointer that is actually a pointer into memory with lifetime `'a`,
|
||||
/// and this pointer is itself stored in an inherently mutable
|
||||
/// location (such as a `Cell`).
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
#[lang="invariant_lifetime"]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct InvariantLifetime<'a>;
|
||||
@ -272,6 +284,7 @@ pub struct InvariantLifetime<'a>;
|
||||
/// be safely sent between tasks, even if it is owned. This is
|
||||
/// typically embedded in other types, such as `Gc`, to ensure that
|
||||
/// their instances remain thread-local.
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
#[lang="no_send_bound"]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct NoSend;
|
||||
@ -279,6 +292,7 @@ pub struct NoSend;
|
||||
/// A type which is considered "not POD", meaning that it is not
|
||||
/// implicitly copyable. This is typically embedded in other types to
|
||||
/// ensure that they are never copied, even if they lack a destructor.
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
#[lang="no_copy_bound"]
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[allow(missing_copy_implementations)]
|
||||
@ -287,12 +301,14 @@ pub struct NoCopy;
|
||||
/// A type which is considered "not sync", meaning that
|
||||
/// its contents are not threadsafe, hence they cannot be
|
||||
/// shared between tasks.
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
#[lang="no_sync_bound"]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct NoSync;
|
||||
|
||||
/// A type which is considered managed by the GC. This is typically
|
||||
/// embedded in other types.
|
||||
#[unstable = "likely to change with new variance strategy"]
|
||||
#[lang="managed_bound"]
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[allow(missing_copy_implementations)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user