Course lesson
Rustlings move_semantics3: Specifying that a function argument is mutable
README for this exercise.
- Duration
- 0 min
- Access
- Free
- Transcript
- Available
README for this exercise.
Course lesson
README for this exercise.
README for this exercise.
Chris Biscardi: In move_semantics3, we're supposed to make a compile without adding any new lines and just changing existing ones. In this case, we can't borrow a vec as mutable inside of fill_vec on line 20. In contrast, for the last two move_semantics, we aren't creating a new vec inside of the fill_vec function this time.
If we specify that we want to mutate vec in our type signature, we can then mutate vec and our tests pass.
Course lesson
README for this exercise.