Hacker News new | ask | show | jobs
by bobbylarrybobby 1299 days ago
For someone looking for an example of this, here's a SO post: https://stackoverflow.com/questions/74592882/extend-a-string...

Tl;dr Rust can't distinguish between a `Vec` whose length is mutable (which might need to reallocate) and one whose elements are mutable (which can provide mutable references to its elements but will never have to move them), so it prevents mutation in a case where it would be safe.

1 comments

Isn't the latter just a mutable slice?