7 ms·
How does rust do bounds checking for slice accesses if the length is not stored?
by bennofs 5y ago
How does rust do bounds checking for slice accesses if the length is not stored?
- steveklabnik 5y agoLength and capacity are two different things; a slice is a pointer and a length, but a Vec<T> (and Go's slices) are a pointer, a length, and a capacity. That Rust and Go both have "slices" that are slightly different is, unfortunate, but that's just how it goes sometimes.