-
Notifications
You must be signed in to change notification settings - Fork 84
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
should get_unchecked and get_unchecked_mut be using unreachable!() ? #40
Comments
If they are reachable, it should probably be changed to a The functions are here to avoid any extra bounds checking. |
I wonder if there's a way to be even less safe, by unwrapping the |
Relevant: rust-lang/rfcs#1863 |
Making them less safe can now be done by using Currently the compiler isn't inserting any trap ( EDIT: I have a commit implementing this change, but I'm not opening a PR because I don't think this is worth making a breaking change for. |
I think the bad branches in those functions are reachable, if the caller passes in a key that's been removed. Should those branches be ordinary panics? Or should those functions maybe return
Option<&T>
/Option<&mut T>
, like theget
andget_mut
functions do? (Or is it possible these functions don't have any callers in the wild, and we can remove them?)The text was updated successfully, but these errors were encountered: