Hacker News new | ask | show | jobs
by bennofs 1696 days ago
How does rust do bounds checking for slice accesses if the length is not stored?
1 comments

Length 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.