In types definitions, mut T doesn’t exist. Only &mut T

  • &mut T
  • mut T

In variable bindings, mut is used like this:

  • let mut foo: T = ...

Note that mut in type and variable bindings serve a distinctly different role:

  • Types:
    • &mut T means we borrow T mutably - we are guaranteed exclusive mutable access.
    • Notice that mut T does not make sense in the first place, because we already control mutability via Ownership rules.
  • Bindings:
    • let mut means the value can be mutated.
    • Allows lending to functions that accept &mut T arguments

We can rebind T as mutable, but we cannot convert &T to &mut T. (implied by point 1 of Borrowing rules.)