-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[ER] Three Vec functions #82336
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
Comments
@leonardo-m this can't work because the standard library isn't recompiled between debug and release builds, it's always compiled in release mode. Adding a |
I think |
I see, thank for the answers. |
This was discussed and rejected in #77480. Some relevant comments:
So |
Some member functions that could be added to Vec:
This is similar to
Vec::remove
but likeVec::pop
it returns anOption
, avoiding panics:(In alternative
Vec::pop_front
could often suffice).Probably this was already suggested elsewhere:
They contain a
debug_assert!()
to test the bounds only in debug builds. I think suchdebug_assert
can't be added toget_unchecked
/get_unchecked_mut
because the semantics is different. They are unsafe, but they add a bit of safety during debug runs.The text was updated successfully, but these errors were encountered: