logoalt Hacker News

mlindnerlast Wednesday at 8:51 PM2 repliesview on HN

If the API cannot be made safe then it must be marked unsafe.


Replies

aw1621107last Wednesday at 9:28 PM

I mean, remove() is already marked unsafe?

Otherwise there's the question of where exactly the API boundaries are. In the most general case, your unsafe boundary is going to be the module boundary; as long as what you publicly expose is safe modulo bugs, you're good. In this case the fix was in a crate-internal function, so I suppose one could argue that the public API was/is fine.

That being said, I'm not super-familiar with the code in question so I can't definitively say that there's no way to make internal changes to reduce the risk of similar errors.