-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
BTreeMap: tag internal functions with preconditions as unsafe #68418
Conversation
While we're at this, is there a chance you could post the performance cost of moving the top-level "entry" functions in the node.rs module to being safe, and |
☔ The latest upstream changes (presumably #68423) made this pull request unmergeable. Please resolve the merge conflicts. |
…hared roots, or (fn insert) turn debug_assert into assert
c4f95b5
to
cc9ae53
Compare
If you mean really safe, as in making
But there is some cheating here: public function
|
I've sailed around My proposal then would be to turn debug_assert into assert in public functions, except |
So looking at the diff I think @RalfJung was right that this hides enough information that I'd rather not do it. Thanks for generating the diff though! It is I think notable that at least some of the |
I have added "unsafe because" information in my proposal. I'll open a new PR for that. |
…ark-Simulacrum BTreeMap: tag and explain unsafe internal functions or assert preconditions rust-lang#68418 concluded that it's not desirable to tag all internal functions with preconditions as being unsafe. This PR does it to some functions, documents why, and elsewhere enforces the preconditions with asserts.
#67686 ended up assuming that internal functions in node.rs that perform debug_assert, should either do a hard assert or should be declared unsafe. This set of commits does the latter, except for one function
insert
(because it would require removing the subtle unsafe blocks in its implementation).(at this moment the list of commits contains #67686 because I managed to start from a different master)
r? @Mark-Simulacrum