diff options
| author | bors <bors@rust-lang.org> | 2015-04-18 02:53:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-18 02:53:53 +0000 |
| commit | efa6a46a8eceb4ab792d5ec8e28cf3baaaa96491 (patch) | |
| tree | 89e7c7e0f3e09376ef09eac01fd7dacf26b90653 /src/libstd/io | |
| parent | 1284be4044420bc4c41767284ae26be61a38d331 (diff) | |
| parent | 986852911464df87088007e64780165cc538f9b9 (diff) | |
| download | rust-efa6a46a8eceb4ab792d5ec8e28cf3baaaa96491.tar.gz rust-efa6a46a8eceb4ab792d5ec8e28cf3baaaa96491.zip | |
Auto merge of #24133 - kballard:add-sync-to-io-error, r=alexcrichton
This allows `io::Error` values to be stored in `Arc` properly. Because this requires `Sync` of any value passed to `io::Error::new()` and modifies the relevant `convert::From` impls, this is a [breaking-change] Fixes #24049.
Diffstat (limited to 'src/libstd/io')
| -rw-r--r-- | src/libstd/io/error.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index a49039b1ec4..959c15fcfd6 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -12,7 +12,7 @@ use boxed::Box; use convert::Into; use error; use fmt; -use marker::Send; +use marker::{Send, Sync}; use option::Option::{self, Some, None}; use result; use sys; @@ -46,7 +46,7 @@ enum Repr { #[derive(Debug)] struct Custom { kind: ErrorKind, - error: Box<error::Error+Send>, + error: Box<error::Error+Send+Sync>, } /// A list specifying general categories of I/O error. @@ -146,7 +146,7 @@ impl Error { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn new<E>(kind: ErrorKind, error: E) -> Error - where E: Into<Box<error::Error+Send>> + where E: Into<Box<error::Error+Send+Sync>> { Error { repr: Repr::Custom(Box::new(Custom { @@ -223,3 +223,8 @@ impl error::Error for Error { } } } + +fn _assert_error_is_sync_send() { + fn _is_sync_send<T: Sync+Send>() {} + _is_sync_send::<Error>(); +} |
