Skip to content

Impl Error for Box<T: Error> #30796

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

Merged
merged 1 commit into from
Feb 4, 2016
Merged

Conversation

GuillaumeGomez
Copy link
Member

Fixes #30349

@rust-highfive
Copy link
Contributor

r? @alexcrichton

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

@GuillaumeGomez GuillaumeGomez force-pushed the impl_box_error branch 3 times, most recently from 4113823 to 31f7f3a Compare January 10, 2016 22:17
@alexcrichton
Copy link
Member

I'd like to run crater over this to make sure it doesn't have too much intended breakage first.

@alexcrichton alexcrichton added the S-waiting-on-crater Status: Waiting on a crater run to be completed. label Jan 11, 2016
@GuillaumeGomez
Copy link
Member Author

Please do! :)

@alexcrichton
Copy link
Member

Crater reports one regressions which is spurious, so I think this is good to go.

@bors: r+ 31f7f3a835141605c579d00471ce1bb331f2f192

@alexcrichton alexcrichton removed the S-waiting-on-crater Status: Waiting on a crater run to be completed. label Jan 12, 2016
@alexcrichton
Copy link
Member

@bors: r-

er actually, can you define this for T: ?Sized instead of just T?

@GuillaumeGomez
Copy link
Member Author

I didn't because of a problem. Hold on, I try again to see why.

@GuillaumeGomez
Copy link
Member Author

That's the error I get by adding ?Sized:

#[stable(feature = "box_error", since = "1.7.0")]
impl<T: Error + ?Sized> Error for Box<T> {
    fn description(&self) -> &str {
        Error::description(&**self)
    }

    fn cause(&self) -> Option<&Error> {
        Error::cause(&**self)
    }
}

@alexcrichton
Copy link
Member

Hm right, that's what I remember getting in the past. I'm gonna hold off on r+'ing for now and tag this with T-libs to get some more discussion.

I'm a little worried that Box<Error> won't implement Error (which one might reasonably expect), but it does seem valuable that Box<MyCustomError> can be used with try! to return a Box<Error> (due to the From impl).

Curious on others' thoughts as well though

@alexcrichton
Copy link
Member

cc @rust-lang/libs

@alexcrichton alexcrichton added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jan 12, 2016
@bors
Copy link
Collaborator

bors commented Jan 23, 2016

☔ The latest upstream changes (presumably #31124) made this pull request unmergeable. Please resolve the merge conflicts.

@GuillaumeGomez
Copy link
Member Author

Any news on this?

@alexcrichton
Copy link
Member

Unfortunately we haven't had time yet in libs triage to come back around to this, but it's still on the agenda.

@alexcrichton
Copy link
Member

The libs team discussed this during triage today and the conclusion was to merge. We may want to ensure that Box<Error> implements Error somehow in the future, but in the meantime it seems like that shouldn't necessarily prevent this sort of impl from existing anyway. Thanks again for the PR @GuillaumeGomez!

@bors: r+ f9f2981

@bors
Copy link
Collaborator

bors commented Feb 4, 2016

⌛ Testing commit f9f2981 with merge 3c9442f...

@alexcrichton alexcrichton removed the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 4, 2016
@bors bors merged commit f9f2981 into rust-lang:master Feb 4, 2016
@GuillaumeGomez GuillaumeGomez deleted the impl_box_error branch February 4, 2016 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants