top | item 29017473

(no title)

bennofs | 4 years ago

How does rust do bounds checking for slice accesses if the length is not stored?

discuss

order

steveklabnik|4 years ago

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.