From 986852911464df87088007e64780165cc538f9b9 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Mon, 6 Apr 2015 16:30:18 -0700 Subject: Add `Sync` to the bounds in `io::Error` 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. --- src/libstd/io/error.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/libstd/io') diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index b84dcb8fb62..192ac1da30a 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: Box, } /// 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(kind: ErrorKind, error: E) -> Error - where E: Into> + where E: Into> { Error { repr: Repr::Custom(Box::new(Custom { @@ -217,3 +217,8 @@ impl error::Error for Error { } } } + +fn _assert_error_is_sync_send() { + fn _is_sync_send() {} + _is_sync_send::(); +} -- cgit 1.4.1-3-g733a5