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

Your comment is misleading. The code in question is inside a function of the signature

    extract_last_path_segment(&str, &str)
This is pure Rust, no C interface involved.



Per my comment above linking the real implementation: the comment is perhaps misleading about the cause but its claim is largely true. Rust code tends not to look like this.


Well, unsafe Rust does tend to look like this. You were claiming that it is only for interfacing with C code, but unsafe is also used for performance, as in the snippet above. You were IMHO incorrectly dismissing the parent comment based on that. (On the other hand, the code in question could probably rewritten in safe Rust while still avoiding the bound checks. It would be less straight forward though.)




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

Search: