summaryrefslogtreecommitdiff
path: root/rustlings-macros/info.toml
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-06-21 17:02:50 +0200
committermo8it <mo8it@proton.me>2024-06-21 17:02:50 +0200
commit68142aff7f439f3a797b4e97a275ca7800eebc45 (patch)
treec24d390310af71a3967808e7b79dc0f420433f25 /rustlings-macros/info.toml
parent946c29679e27433ff455bdb30343551757d87769 (diff)
move_semantics2 solution
Diffstat (limited to 'rustlings-macros/info.toml')
-rw-r--r--rustlings-macros/info.toml14
1 files changed, 4 insertions, 10 deletions
diff --git a/rustlings-macros/info.toml b/rustlings-macros/info.toml
index bfe32cd..fb0126c 100644
--- a/rustlings-macros/info.toml
+++ b/rustlings-macros/info.toml
@@ -352,16 +352,10 @@ When running this exercise for the first time, you'll notice an error about
"borrow of moved value". In Rust, when an argument is passed to a function and
it's not explicitly returned, you can't use the original variable anymore.
We call this "moving" a variable. When we pass `vec0` into `fill_vec`, it's
-being "moved" into `vec1`, meaning we can't access `vec0` anymore after the
-fact.
-
-Rust provides a couple of different ways to mitigate this issue, feel free to
-try them all:
-1. You could make another, separate version of the data that's in `vec0` and
- pass that to `fill_vec` instead.
-2. Make `fill_vec` borrow its argument instead of taking ownership of it,
- and then copy the data within the function (`vec.clone()`) in order to
- return an owned `Vec<i32>`.
+being "moved" into `vec1`, meaning we can't access `vec0` anymore.
+
+You could make another, separate version of the data that's in `vec0` and
+pass it to `fill_vec` instead.
"""
[[exercises]]