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

Implement error interoperation #17747

Closed
alexcrichton opened this issue Oct 3, 2014 · 2 comments · Fixed by #17753
Closed

Implement error interoperation #17747

alexcrichton opened this issue Oct 3, 2014 · 2 comments · Fixed by #17753
Assignees
Labels
B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented.

Comments

@alexcrichton
Copy link
Member

Tracking issue for rust-lang/rfcs#201

I'm not nominating this because this is a library issue, which is handled with stabilization rather than nomination.

@alexcrichton alexcrichton added the B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. label Oct 3, 2014
@aturon aturon self-assigned this Oct 3, 2014
aturon added a commit to aturon/rust that referenced this issue Oct 31, 2014
As per [RFC 70](https://github.com/rust-lang/rfcs/blob/master/active/0070-error-chaining.md)

Closes rust-lang#17747

Note that the `error` module must live in `std` in order to refer to `String`.

Note that, until multidispatch lands, the `FromError` trait cannot be
usefully implemented outside of the blanket impl given here.
bors added a commit that referenced this issue Oct 31, 2014
This PR:

* Adds the error interoperation traits (`Error` and `FromError`) to a new module, `std::error`, as per [RFC 70](https://github.com/rust-lang/rfcs/blob/master/active/0070-error-chaining.md). Note that this module must live in `std` in order to refer to `String`.

    Note that, until multidispatch lands, the `FromError` trait cannot be
usefully implemented outside of the blanket impl given here.

* Incorporates `std::error::FromError` into the `try!` macro.

* Implements `Error` for most existing error enumerations.

Closes #17747
aturon added a commit to aturon/rust that referenced this issue Oct 31, 2014
As per [RFC 70](https://github.com/rust-lang/rfcs/blob/master/active/0070-error-chaining.md)

Closes rust-lang#17747

Note that the `error` module must live in `std` in order to refer to `String`.

Note that, until multidispatch lands, the `FromError` trait cannot be
usefully implemented outside of the blanket impl given here.
bors added a commit that referenced this issue Oct 31, 2014
This PR:

* Adds the error interoperation traits (`Error` and `FromError`) to a new module, `std::error`, as per [RFC 70](https://github.com/rust-lang/rfcs/blob/master/active/0070-error-chaining.md). Note that this module must live in `std` in order to refer to `String`.

    Note that, until multidispatch lands, the `FromError` trait cannot be
usefully implemented outside of the blanket impl given here.

* Incorporates `std::error::FromError` into the `try!` macro.

* Implements `Error` for most existing error enumerations.

Closes #17747
aturon added a commit to aturon/rust that referenced this issue Nov 2, 2014
As per [RFC 70](https://github.com/rust-lang/rfcs/blob/master/active/0070-error-chaining.md)

Closes rust-lang#17747

Note that the `error` module must live in `std` in order to refer to `String`.

Note that, until multidispatch lands, the `FromError` trait cannot be
usefully implemented outside of the blanket impl given here.
bors added a commit that referenced this issue Nov 3, 2014
This PR:

* Adds the error interoperation traits (`Error` and `FromError`) to a new module, `std::error`, as per [RFC 70](https://github.com/rust-lang/rfcs/blob/master/active/0070-error-chaining.md). Note that this module must live in `std` in order to refer to `String`.

    Note that, until multidispatch lands, the `FromError` trait cannot be
usefully implemented outside of the blanket impl given here.

* Incorporates `std::error::FromError` into the `try!` macro.

* Implements `Error` for most existing error enumerations.

Closes #17747
@michaelsproul
Copy link
Contributor

In the error chaining RFC the return type of Error::detail is Option<&str>, yet in the implementing PR (#17753), the return type is Option<String> and remains this way. I think a string slice is better, as it prevents allocations in the common case where you store an Option<String>. I don't have very good internet access at the moment, but I could have a PR up in a few days if you think this change is worthwhile.

@aturon
Copy link
Member

aturon commented Dec 27, 2014

@michaelsproul The reason the API was changed was to support another pattern: that you lazily perform the allocation and creation of the string, based on more meaningful fields that are part of the error type. But that does mean you have to create a fresh copy each time.

It just occurred to me that the best solution might instead be to use the fmt infrastructure; I left a comment on an open RFC raising this question.

RalfJung pushed a commit to RalfJung/rust that referenced this issue Aug 1, 2024
fix: Errors on method call inferences with elided lifetimes

Fixes rust-lang#17734

Currently, we are matching non-lifetime(type or const) generic arg to liftime argument position while building substs for method calling when there are elided lifetimes.
This mismatch just make a subst for error lifetime and while this alone is not much a trouble, it also makes the mismatched type or const generic arg cannot be used in its proper place and this makes type inference failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants