Skip to content

Error and .unwrap() do not agree on traits #21790

New issue

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

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

Already on GitHub? # to your account

Closed
maurer opened this issue Jan 30, 2015 · 4 comments · Fixed by #23541
Closed

Error and .unwrap() do not agree on traits #21790

maurer opened this issue Jan 30, 2015 · 4 comments · Fixed by #23541
Assignees
Labels
I-needs-decision Issue: In need of a decision.
Milestone

Comments

@maurer
Copy link
Contributor

maurer commented Jan 30, 2015

Error currently requires Display, while .unwrap() requires Debug.

I'm unsure of what each should require, but I think they should agree so that it is possible to have code which returns Result<_, Box<Error>> (which is useful to allow try! across functions returning different types of error codes), and be able to .unwrap() the results.

@Stebalien
Copy link
Contributor

There was a lengthy discussion about this towards the bottom of the RFC: rust-lang/rfcs#565.

@steveklabnik
Copy link
Member

/cc @aturon , I vaguely remember this might change? If not, then this should be in the RFCs repo.

@aturon
Copy link
Member

aturon commented Feb 16, 2015

Nominating for 1.0-beta P-backcompat-libs.

(The Error trait isn't #[stable] yet, but it probably will be for 1.0).

@pnkfelix
Copy link
Member

1.0 beta, P-backcompat-libs, I-needs-decision.

@pnkfelix pnkfelix added I-needs-decision Issue: In need of a decision. P-backcompat-libs labels Feb 19, 2015
@pnkfelix pnkfelix added this to the 1.0 beta milestone Feb 19, 2015
alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 23, 2015
This small commit stabilizes the `Error` trait as-is, except that `Send`
and `Debug` are added as constraints. The `Send` constraint is because
most uses of `Error` will be for trait objects, and by default we would
like these objects to be transferrable between threads. The `Debug`
constraint is to ensure that e.g. `Box<Error>` is `Debug`, and because
types that implement `Display` should certainly implement `Debug` in any case.

In the near future we expect to add `Any`-like downcasting features to
`Error`, but this is waiting on some additional
mechanisms (`Reflect`). It will be added before 1.0 via default methods.

[breaking-change]

r? @alexcrichton

Closes rust-lang#21790
# for free to join this conversation on GitHub. Already have an account? # 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.

6 participants