| ▲ | wasmperson 2 hours ago | ||||||||||||||||
This isn't entirely true. Rust's indexing operator performs a dynamic check but the language and stdlib have a number of ways to access array elements without indexing, which is effectively a form of static checking. For example, the following loop is statically guaranteed to not go OOB, and will not emit any unnecessary bounds checks:
I suspect most techniques you could think of to statically avoid bounds checks are possible in rust's type system. | |||||||||||||||||
| ▲ | uecker an hour ago | parent [-] | ||||||||||||||||
These are not terribly interesting cases though, as it would also be impossible to get an oob access in other languages either. | |||||||||||||||||
| |||||||||||||||||