Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upimpl Fail for NoneError? #59
Comments
This comment has been minimized.
This comment has been minimized.
|
Oh, blast. I just realised this isn't actually possible, because |
Celti
closed this
Nov 18, 2017
This comment has been minimized.
This comment has been minimized.
Emilgardis
commented
Nov 28, 2017
|
Why is this closed? This is something that I really want, and something other users of this crate will want. |
This comment has been minimized.
This comment has been minimized.
vitvakatu
commented
Nov 28, 2017
|
Yep, I'm voting for re-opening |
This comment has been minimized.
This comment has been minimized.
|
As stated in the comment where I closed it, this isn't technically possible — implementing |
This comment has been minimized.
This comment has been minimized.
Emilgardis
commented
Nov 28, 2017
|
Then this issue should track that progress. |
This comment has been minimized.
This comment has been minimized.
Emilgardis
commented
Nov 28, 2017
•
|
FWIW Here are all the related links As far I can see, unlike @Celti mentioned, there haven't been any discussion about making std::option::NoneError: std::error::Error or Display , could you link that for us? |
This comment has been minimized.
This comment has been minimized.
|
Implementing Fail for NoneError would be an orphan rules violation because of the blanket impls for type that implement |
This comment has been minimized.
This comment has been minimized.
dvdplm
commented
Jan 5, 2018
|
@withoutboats Thank you for weighing in. Do you think making the necessary changes in std for this to happen is a good idea or are there hidden downsides? |
This comment has been minimized.
This comment has been minimized.
xnorme
commented
Jul 10, 2018
|
What is the current state regarding this issue? |
Celti commentedNov 18, 2017
Using the currently (but probably not for very much longer) unstable
Trytrait, one can use the question mark operator onOption<T>types, coercing them into aResult<T, NoneError>. Unfortunately,NoneErrordoes not implstd::error::Error, meaning theFailis not implemented forNoneError(and it being an external type, we can't implement it in our own crates).I think this would be particularly useful in light of the pattern described in “Using the
Errortype” — throwing aNoneErrorfits right into the kind of rapid prototyping, "just show the user the error and exit" limited error handling that that exemplifies.Would a PR with this change go amiss?