Hacker News new | past | comments | ask | show | jobs | submit login

> ("unsafe { myvec[0] }")

Part of the point in my post is that this does not remove the bounds check. This unsafe block does nothing.

This actually might be a better example than the one I picked...




And just as in the OP, the compiler makes it clear that this unsafe block does nothing:

    warning: unnecessary `unsafe` block
     --> src/main.rs:4:3
      |
    4 |   unsafe { myvec[0]; }
      |   ^^^^^^ unnecessary `unsafe` block
      |




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: