about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorBarosl LEE <github@barosl.com>2015-01-21 02:16:47 +0900
committerBarosl LEE <github@barosl.com>2015-01-21 02:16:47 +0900
commite63443d536a0e6157dce0cfb39dfcd2d614fb357 (patch)
treeeb169eeac748e5ceefae1bbb0d31b40b24edd683 /src/libstd
parent409c9972a954b56eb278c91666d33b09aeb00c6a (diff)
parent97a2b2638d36fbd9f69c80bd146cdbe9d87e7bcc (diff)
downloadrust-e63443d536a0e6157dce0cfb39dfcd2d614fb357.tar.gz
rust-e63443d536a0e6157dce0cfb39dfcd2d614fb357.zip
Rollup merge of #21312 - michaelsproul:remove-error-send-bound, r=aturon
As discussed with @aturon, this PR removes the `Send` bound from `std::error::Error`, allowing us to implement `Error` for error types containing non-`Send` types. Current examples include `PoisonError` and `TryLockError` from `std::sync` which contain a Guard that we don't want sent between tasks.

[breaking-change]
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/error.rs4
-rw-r--r--src/libstd/io/mod.rs6
-rw-r--r--src/libstd/os.rs6
3 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index 9963e4861b7..ff128461978 100644
--- a/src/libstd/error.rs
+++ b/src/libstd/error.rs
@@ -18,7 +18,7 @@
 //! chain information:
 //!
 //! ```
-//! trait Error: Send {
+//! trait Error {
 //!     fn description(&self) -> &str;
 //!
 //!     fn detail(&self) -> Option<String> { None }
@@ -87,7 +87,7 @@ use string::{FromUtf8Error, FromUtf16Error};
 
 /// Base functionality for all errors in Rust.
 #[unstable = "the exact API of this trait may change"]
-pub trait Error: Send {
+pub trait Error {
     /// A short description of the error; usually a static string.
     fn description(&self) -> &str;
 
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index e2b71cd43af..dc21416df7b 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -234,7 +234,7 @@ use error::{FromError, Error};
 use fmt;
 use int;
 use iter::{Iterator, IteratorExt};
-use marker::Sized;
+use marker::{Sized, Send};
 use mem::transmute;
 use ops::FnOnce;
 use option::Option;
@@ -363,8 +363,8 @@ impl Error for IoError {
     }
 }
 
-impl FromError<IoError> for Box<Error> {
-    fn from_error(err: IoError) -> Box<Error> {
+impl FromError<IoError> for Box<Error + Send> {
+    fn from_error(err: IoError) -> Box<Error + Send> {
         box err
     }
 }
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index fc0c838a3f1..78db6c158a8 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 marker::Copy;
+use marker::{Copy, Send};
 use libc::{c_void, c_int, c_char};
 use libc;
 use boxed::Box;
@@ -937,8 +937,8 @@ impl Error for MapError {
     fn detail(&self) -> Option<String> { Some(format!("{:?}", self)) }
 }
 
-impl FromError<MapError> for Box<Error> {
-    fn from_error(err: MapError) -> Box<Error> {
+impl FromError<MapError> for Box<Error + Send> {
+    fn from_error(err: MapError) -> Box<Error + Send> {
         box err
     }
 }