BTreeMap: tag internal functions with preconditions as unsafe#68418
BTreeMap: tag internal functions with preconditions as unsafe#68418ssomers wants to merge 2 commits intorust-lang:masterfrom ssomers:btreemap_prefer_unsafe
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
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