Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needs decision: should Error inherit from Send? #23774

Closed
aturon opened this issue Mar 27, 2015 · 6 comments · Fixed by #23799
Closed

Needs decision: should Error inherit from Send? #23774

aturon opened this issue Mar 27, 2015 · 6 comments · Fixed by #23799
Labels
I-needs-decision Issue: In need of a decision.

Comments

@aturon
Copy link
Member

aturon commented Mar 27, 2015

The Error trait was recently changed, once again, to inherit from Send. This was done mostly because

  1. We suspect that many people will wind up using Box<Error>, especially once Error incorporated downcasting,
  2. We worried that, after setting up such APIs, people would end up wanting to send Box<Error> between threads and not be able to, and,
  3. We suspected that most errors would or could be made Send anyway.

However, there are some cases in important libraries like Iron that involve non-Send errors, at least at the moment.

We need to make a final decision here. Should we instead require people to know about and use Box<Error + Send> when they need it?

@aturon aturon added A-libs I-needs-decision Issue: In need of a decision. labels Mar 27, 2015
@aturon
Copy link
Member Author

aturon commented Mar 27, 2015

cc @reem @acrichto @nikomatsakis

@reem
Copy link
Contributor

reem commented Mar 27, 2015

cc @alexcrichton :)

@reem
Copy link
Contributor

reem commented Mar 27, 2015

@aturon note that this is blocking iron from building, so a swift decision would be quite appreciated

@nikomatsakis
Copy link
Contributor

My feeling, as summarized to @aturon over IRC: better to be more general. If it turns out that people forget the Send a lot (and they probably will), we can always introduce an alias or something for Error+Send, and converting from Error to Error+Send ought to... mostly be compatible.

reem added a commit to reem/rust that referenced this issue Mar 28, 2015
The Send bound is an unnecessary restriction, and though provided as a
convenience, can't be removed by downstream code.

The removal of this bound is a [breaking-change] since it
removes an implicit Send bound on all `E: Error` and all
`Error` trait objects.

To migrate, consider if your code actually requires the Send
bound and, if so, add it explicitly.

Fixes rust-lang#23774
@Manishearth
Copy link
Member

Does anyone think this needs an RfC? Though I believe the original Error RfC doesn't mention the Send bound so perhaps it's okay.

@aturon
Copy link
Member Author

aturon commented Mar 28, 2015

@Manishearth Yeah, I would consider this a relatively minor implementation detail. It's gone back and forth a few times since the original reform. I'm personally OK changing it a final time without an RFC.

bors added a commit that referenced this issue Mar 28, 2015
The Send bound is an unnecessary restriction, and though provided as a convenience, can't be removed by downstream code.

The removal of this bound is a [breaking-change] since it removes an implicit Send bound on all `E: Error` and all `Error` trait objects.

To migrate, consider if your code actually requires the Send bound and, if so, add it explicitly.

Fixes #23774

r? @aturon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-needs-decision Issue: In need of a decision.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants