Skip to content

Add Sync to the bounds in io::Error - #24133

Merged
bors merged 1 commit into
rust-lang:masterfrom
lilyball:add-sync-to-io-error
Apr 18, 2015
Merged

Add Sync to the bounds in io::Error#24133
bors merged 1 commit into
rust-lang:masterfrom
lilyball:add-sync-to-io-error

Conversation

@lilyball

Copy link
Copy Markdown
Contributor

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 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]
Fixesrust-lang#24049.
@rust-highfive

Copy link
Copy Markdown
Contributor

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@lilyball

Copy link
Copy Markdown
ContributorAuthor

/cc @alexcrichton

@nikomatsakis

Copy link
Copy Markdown
Contributor

r? @alexcrichton

cc @aturon
this

@nikomatsakis

Copy link
Copy Markdown
Contributor

er, incomplete comment. I was going to say this feels like an API stabilization thing.

@alexcrichton

Copy link
Copy Markdown
Member

I think that if we go this route that we'll also want to knock out #24135 at the same time as it seems useful to be able to clone io::Error. I'll talk a bit with @aturon today and gauge his thoughts as well. Thanks for this though!

@alexcrichton

Copy link
Copy Markdown
Member

Ok I chatted with @aturon today about this, and our feeling is that this probably wants to go through an RFC. We couldn't really reach consensus among ourselves and would like to garner some broader opinions. Some specific points we had in mind were:

  • This is a breaking change happening in the beta period, and we currently have not made any breaking changes. There's a lot of discussion on this right now though!
  • It's hard to justify the Sync bound for something other than "so this can be in an Arc"
  • It's unclear how important a Clone implementation is for IoError as there aren't too many use cases for it today. Besides what you're describing, I don't think this has been encountered much elsewhere. Plus you can make an IoError cloneable today by using Rc if really necessary.

So to move forward here I'm going to close this for now. Could you open either an RFC or discuss post on this topic to see how others feel about it as well? Thanks!

@lilyball

Copy link
Copy Markdown
ContributorAuthor

Plus you can make an IoError cloneable today by using Rc if really necessary.

Only if I'm ok with my type not being Send. At the moment, my library that wants to clone io::Errors is Send if the underlying Write is Send and it seems a shame to lose that.

@lilyball

Copy link
Copy Markdown
ContributorAuthor

RFC submitted as rust-lang/rfcs#1057

@alexcrichton

Copy link
Copy Markdown
Member

The RFC has now been merged, so I've reopened this to merge it!

@bors: r+ 9868529

@bors

bors commented Apr 18, 2015

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 9868529 with merge efa6a46...

bors added a commit that referenced this pull request Apr 18, 2015
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.
@bors

bors commented Apr 18, 2015

Copy link
Copy Markdown
Collaborator

@bors
bors merged commit 9868529 into rust-lang:masterApr 18, 2015
@alexcrichtonalexcrichton added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 23, 2015
@pnkfelixpnkfelix added beta-accepted Accepted for backporting to the compiler in the beta channel. and removed beta-nominated Nominated for backporting to the compiler in the beta channel. labels Apr 23, 2015
@nrcnrc added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 23, 2015
@alexcrichtonalexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 23, 2015
@lilyball
lilyball deleted the add-sync-to-io-error branch May 15, 2015 05:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-acceptedAccepted for backporting to the compiler in the beta channel.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

std::io::Error is Send but not Sync

7 participants

@lilyball@rust-highfive@nikomatsakis@alexcrichton@bors@pnkfelix@nrc