]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/marker.rs
removed weird example
[rust.git] / src / libcore / marker.rs
index 688f0484401529233794fdea918635d4a8ecab98..ab64d09f9d43f1a768117e89e6d63b9757057178 100644 (file)
 //! implemented using unsafe code. In that case, you may want to embed
 //! some of the marker types below into your type.
 
-#![stable]
+#![stable(feature = "rust1", since = "1.0.0")]
 
 use clone::Clone;
 
 /// Types able to be transferred across thread boundaries.
-#[unstable = "will be overhauled with new lifetime rules; see RFC 458"]
+#[unstable(feature = "core",
+           reason = "will be overhauled with new lifetime rules; see RFC 458")]
 #[lang="send"]
 #[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
 pub unsafe trait Send: 'static {
@@ -36,7 +37,7 @@ pub unsafe trait Send: 'static {
 }
 
 /// Types with a constant size known at compile-time.
-#[stable]
+#[stable(feature = "rust1", since = "1.0.0")]
 #[lang="sized"]
 #[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"]
 pub trait Sized {
@@ -49,7 +50,7 @@ pub trait Sized {
 /// words:
 ///
 /// ```
-/// #[derive(Show)]
+/// #[derive(Debug)]
 /// struct Foo;
 ///
 /// let x = Foo;
@@ -65,7 +66,7 @@ pub trait Sized {
 ///
 /// ```
 /// // we can just derive a `Copy` implementation
-/// #[derive(Show, Copy)]
+/// #[derive(Debug, Copy)]
 /// struct Foo;
 ///
 /// let x = Foo;
@@ -142,7 +143,7 @@ pub trait Sized {
 /// to consider though: if you think your type may _not_ be able to implement `Copy` in the future,
 /// then it might be prudent to not implement `Copy`. This is because removing `Copy` is a breaking
 /// change: that second example would fail to compile if we made `Foo` non-`Copy`.
-#[stable]
+#[stable(feature = "rust1", since = "1.0.0")]
 #[lang="copy"]
 pub trait Copy {
     // Empty.
@@ -193,7 +194,8 @@ 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"]
+#[unstable(feature = "core",
+           reason = "will be overhauled with new lifetime rules; see RFC 458")]
 #[lang="sync"]
 #[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]
 pub unsafe trait Sync {
@@ -238,7 +240,8 @@ 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"]
+#[unstable(feature = "core",
+           reason = "likely to change with new variance strategy")]
 #[lang="covariant_type"]
 #[derive(PartialEq, Eq, PartialOrd, Ord)]
 pub struct CovariantType<T: ?Sized>;
@@ -287,7 +290,8 @@ fn clone(&self) -> CovariantType<T> { *self }
 /// 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"]
+#[unstable(feature = "core",
+           reason = "likely to change with new variance strategy")]
 #[lang="contravariant_type"]
 #[derive(PartialEq, Eq, PartialOrd, Ord)]
 pub struct ContravariantType<T: ?Sized>;
@@ -304,27 +308,17 @@ fn clone(&self) -> ContravariantType<T> { *self }
 ///
 /// For more information about variance, refer to this Wikipedia
 /// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
-///
-/// # Example
-///
-/// The Cell type is an example which uses unsafe code to achieve
-/// "interior" mutability:
-///
-/// ```
-/// struct Cell<T> { value: 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"]
+#[unstable(feature = "core",
+           reason = "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"]
+#[unstable(feature = "core",
+           reason = "likely to change with new variance strategy")]
 impl<T: ?Sized> Copy for InvariantType<T> {}
-#[unstable = "likely to change with new variance strategy"]
+#[unstable(feature = "core",
+           reason = "likely to change with new variance strategy")]
 impl<T: ?Sized> Clone for InvariantType<T> {
     fn clone(&self) -> InvariantType<T> { *self }
 }
@@ -345,7 +339,8 @@ fn clone(&self) -> InvariantType<T> { *self }
 ///
 /// 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"]
+#[unstable(feature = "core",
+           reason = "likely to change with new variance strategy")]
 #[lang="covariant_lifetime"]
 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
 pub struct CovariantLifetime<'a>;
@@ -362,7 +357,8 @@ fn clone(&self) -> InvariantType<T> { *self }
 ///
 /// 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"]
+#[unstable(feature = "core",
+           reason = "likely to change with new variance strategy")]
 #[lang="contravariant_lifetime"]
 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
 pub struct ContravariantLifetime<'a>;
@@ -374,7 +370,8 @@ fn clone(&self) -> InvariantType<T> { *self }
 /// 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"]
+#[unstable(feature = "core",
+           reason = "likely to change with new variance strategy")]
 #[lang="invariant_lifetime"]
 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
 pub struct InvariantLifetime<'a>;
@@ -382,7 +379,8 @@ fn clone(&self) -> InvariantType<T> { *self }
 /// 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"]
+#[unstable(feature = "core",
+           reason = "likely to change with new variance strategy")]
 #[lang="no_copy_bound"]
 #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
 #[allow(missing_copy_implementations)]
@@ -390,7 +388,8 @@ fn clone(&self) -> InvariantType<T> { *self }
 
 /// A type which is considered managed by the GC. This is typically
 /// embedded in other types.
-#[unstable = "likely to change with new variance strategy"]
+#[unstable(feature = "core",
+           reason = "likely to change with new variance strategy")]
 #[lang="managed_bound"]
 #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
 #[allow(missing_copy_implementations)]