logoalt Hacker News

wasmpersonyesterday at 11:15 PM1 replyview on HN

Now it's your example that's too simple. I can't present a counter-example that wouldn't look totally different: if you avoid the indexing operator then trivially incorrect code like that becomes unrepresentable. It's like if I said destructors help you avoid memory leaks and you asked how you'd avoid a leak in a single-function program that does nothing but call `Box::leak()`.

Again: I'm not disputing the fact that the rust index operator does a dynamic bounds check.


Replies

ueckertoday at 6:44 AM

If you agree with that Rust sometimes has to add dynamic bounds check, then you could have just agreed with my original comment.