-
Notifications
You must be signed in to change notification settings - Fork 13.3k
move errno -> IoError converter into std, bubble up OSRng errors #13115
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
Conversation
I was thinking for a bit that this is unfortunately leaking implementation details. On the other hand, I believe that generally accepted practice is that good RNGs are all seeded well, and the best seeds always come from the OS sources, all of which can reasonably fail. With that in mind, I'm not too worried about the details leaking. r=me with my comments |
Yeah, I was not so keen on that, but I can't see a sensible way around it (since internally squashing errors is barely sensible). I'm also a little concerned that most people will just call This is a general problem with |
(Updated, will squash. Apologies for my initial embarrassingly low quality version of the second last commit, I was doing it rather too late at night. :( ) |
r=me, and no worries! |
You may want to take a look at travis as well |
This also adds a direct `errno` -> `~str` converter, rather than only being possible to get a string for the very last error.
The various ...Rng::new() methods can hit IO errors from the OSRng they use, and it seems sensible to expose them at a higher level. Unfortunately, writing e.g. `StdRng::new().unwrap()` gives a much poorer error message than if it failed internally, but this is a problem with all `IoResult`s.
move errno -> IoError converter into std, bubble up OSRng errors Also adds a general errno -> `~str` converter to `std::os`, and makes the failure messages for the things using `OSRng` (e.g. (transitively) the task-local RNG, meaning hashmap initialisation failures aren't such a black box).
Remove duplicated `peel_middle_ty_refs` TODO: Should we move `ty::peel_mid_ty_refs_is_mutable` to super module too? changelog: none
move errno -> IoError converter into std, bubble up OSRng errors
Also adds a general errno ->
~str
converter tostd::os
, and makes the failure messages for the things usingOSRng
(e.g. (transitively) the task-local RNG, meaning hashmap initialisation failures aren't such a black box).