]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/marker.rs
removed weird example
[rust.git] / src / libcore / marker.rs
index 0a31cb01ca28f79dca7f9d1f389cdd5e638f442f..ab64d09f9d43f1a768117e89e6d63b9757057178 100644 (file)
 
 use clone::Clone;
 
-/// Types able to be transferred across task boundaries.
+/// Types able to be transferred across thread boundaries.
 #[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 {
     // empty.
 }
@@ -38,6 +39,7 @@ pub unsafe trait Send: 'static {
 /// Types with a constant size known at compile-time.
 #[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 {
     // Empty.
 }
@@ -48,7 +50,7 @@ pub trait Sized {
 /// words:
 ///
 /// ```
-/// #[derive(Show)]
+/// #[derive(Debug)]
 /// struct Foo;
 ///
 /// let x = Foo;
@@ -64,7 +66,7 @@ pub trait Sized {
 ///
 /// ```
 /// // we can just derive a `Copy` implementation
-/// #[derive(Show, Copy)]
+/// #[derive(Debug, Copy)]
 /// struct Foo;
 ///
 /// let x = Foo;
@@ -147,11 +149,11 @@ pub trait Copy {
     // Empty.
 }
 
-/// Types that can be safely shared between tasks when aliased.
+/// Types that can be safely shared between threads when aliased.
 ///
 /// The precise definition is: a type `T` is `Sync` if `&T` is
 /// thread-safe. In other words, there is no possibility of data races
-/// when passing `&T` references between tasks.
+/// when passing `&T` references between threads.
 ///
 /// As one would expect, primitive types like `u8` and `f64` are all
 /// `Sync`, and so are simple aggregate types containing them (like
@@ -195,6 +197,7 @@ pub trait Copy {
 #[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 {
     // Empty
 }
@@ -305,19 +308,6 @@ 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(feature = "core",
            reason = "likely to change with new variance strategy")]
 #[lang="invariant_type"]