Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Calling get_unchecked on this array ends up as get_unchecked on the slice containing that whole array, which ends up as as get_unchecked on the slice index, and in the end it is...

Dereferencing a raw pointer. One of the three specific things I said unsafe Rust can in fact do.

This is not a "funny syntax" thing, a[6] is the idiomatic and obvious way to express this in Rust, and, it isn't allowed because it's a buffer overflow. Whereas a[6] is also the idiomatic and obvious way to express this in C and the result is Undefined Behaviour.



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

Search: