Skip to content

Instantly share code, notes, and snippets.

@tfogal
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfogal/9984008 to your computer and use it in GitHub Desktop.
Save tfogal/9984008 to your computer and use it in GitHub Desktop.
rust errors in english
* cannot index a value of type `std::vec::Vec<T>`
Rust's vector type doesn't implement whatever-it-needs to be able to use the standard indexing operator ("[]") with it. Use .get(idx) or .get_mut(idx) instead.
* error: cannot move out of dereference of `&`-pointer
The thing rust is highlighting is used in a context where it must be 'moved'. "moved" seems to imply the same semantics as C++'s 'std::move'.
One fix is to make the receiver accept a &T of whatever T it wants, and fix the call site appropriately. A better fix is to just rewrite the code so that the receiver isn't used at all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment