Request to add .clone() documentation to the 06_move_semantics README.md #2363
Replies: 1 comment
-
|
Hi @linda-yulu, I understand your frustration, but the hint 'Make both vectors vec0 and vec1 accessible at the same time' is actually a key part of the lesson. In Rust, when ownership is moved into a function, the original variable becomes inaccessible. By requiring both to be available simultaneously, the exercise leads you to the realization that you must either clone the data or use references to satisfy the compiler.
As shown above, the Rust compiler itself acts as a 'built-in mentor.' It often provides direct hints—like suggesting a .clone() call—to help you resolve ownership conflicts. This process of learning from diagnostics is the central concept behind Rustlings. If you are stuck, you can always check the provided solutions/ directory for the intended answer. Furthermore, if you truly believe the hint is insufficient, the project encourages you to open an issue to discuss a potential update. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
https://doc.rust-lang.org/std/vec/struct.Vec.html#impl-Clone-for-Vec%3CT,+A%3E
I struggled through the exercise until I realized that I needed a cloning function. The currently provided documentation does not provide sufficient information to complete this exercise.
Beta Was this translation helpful? Give feedback.
All reactions