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.
This commit is contained in:
bors
2015-04-18 02:53:53 +00:00
2 changed files with 15 additions and 10 deletions

View File

@@ -50,7 +50,7 @@
use boxed::Box;
use convert::From;
use fmt::{self, Debug, Display};
use marker::Send;
use marker::{Send, Sync};
use num;
use option::Option;
use option::Option::None;
@@ -81,15 +81,15 @@ impl<'a, E: Error + 'a> From<E> for Box<Error + 'a> {
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, E: Error + Send + 'a> From<E> for Box<Error + Send + 'a> {
fn from(err: E) -> Box<Error + Send + 'a> {
impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<Error + Send + Sync + 'a> {
fn from(err: E) -> Box<Error + Send + Sync + 'a> {
Box::new(err)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl From<String> for Box<Error + Send> {
fn from(err: String) -> Box<Error + Send> {
impl From<String> for Box<Error + Send + Sync> {
fn from(err: String) -> Box<Error + Send + Sync> {
#[derive(Debug)]
struct StringError(String);
@@ -108,8 +108,8 @@ impl From<String> for Box<Error + Send> {
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> {
fn from(err: &'b str) -> Box<Error + Send + 'a> {
impl<'a, 'b> From<&'b str> for Box<Error + Send + Sync + 'a> {
fn from(err: &'b str) -> Box<Error + Send + Sync + 'a> {
From::from(String::from_str(err))
}
}