summaryrefslogtreecommitdiff
path: root/info.toml
diff options
context:
space:
mode:
authorliv <mokou@fastmail.com>2023-09-04 14:32:01 +0200
committerGitHub <noreply@github.com>2023-09-04 14:32:01 +0200
commitabc3013096f20a41009086c0f5ccb1b2b13abf12 (patch)
tree0733e49cf4950bb8e4f70eb423765e0dcc48f113 /info.toml
parent6eb9bde786eb855b4f8e1db13e3f62b98a5ad65d (diff)
parent51e237d5f97610294798710ef8ba5349c2fd50c7 (diff)
Merge pull request #1660 from rust-lang/fix/move-semantics-tests
fix: refactor move semantics 1-4 into tests
Diffstat (limited to 'info.toml')
-rw-r--r--info.toml16
1 files changed, 6 insertions, 10 deletions
diff --git a/info.toml b/info.toml
index 1c16e80..d714e54 100644
--- a/info.toml
+++ b/info.toml
@@ -284,9 +284,9 @@ better. What do you think is the more commonly used pattern under Rust developer
[[exercises]]
name = "move_semantics1"
path = "exercises/move_semantics/move_semantics1.rs"
-mode = "compile"
+mode = "test"
hint = """
-So you've got the "cannot borrow immutable local variable `vec1` as mutable" error on the line
+So you've got the "cannot borrow immutable local variable `vec` as mutable" error on the line
where we push an element to the vector, right?
The fix for this is going to be adding one keyword, and the addition is NOT on the line where
we push to the vector (where the error is).
@@ -296,7 +296,7 @@ Also: Try accessing `vec0` after having called `fill_vec()`. See what happens!""
[[exercises]]
name = "move_semantics2"
path = "exercises/move_semantics/move_semantics2.rs"
-mode = "compile"
+mode = "test"
hint = """
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
@@ -309,16 +309,12 @@ Rust provides a couple of different ways to mitigate this issue, feel free to tr
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>`.
-3. Or, you could make `fill_vec` *mutably* borrow a reference to its argument (which will need to be
- mutable), modify it directly, then not return anything. This means that `vec0` will change over the
- course of the function, and makes `vec1` redundant (make sure to change the parameters of the `println!`
- statements if you go this route)
"""
[[exercises]]
name = "move_semantics3"
path = "exercises/move_semantics/move_semantics3.rs"
-mode = "compile"
+mode = "test"
hint = """
The difference between this one and the previous ones is that the first line
of `fn fill_vec` that had `let mut vec = vec;` is no longer there. You can,
@@ -328,7 +324,7 @@ an existing binding to be a mutable binding instead of an immutable one :)"""
[[exercises]]
name = "move_semantics4"
path = "exercises/move_semantics/move_semantics4.rs"
-mode = "compile"
+mode = "test"
hint = """
Stop reading whenever you feel like you have enough direction :) Or try
doing one step and then fixing the compiler errors that result!
@@ -337,7 +333,7 @@ So the end goal is to:
- so then `vec0` doesn't exist, so we can't pass it to `fill_vec`
- `fill_vec` has had its signature changed, which our call should reflect
- since we're not creating a new vec in `main` anymore, we need to create
- a new vec in `fill_vec`, similarly to the way we did in `main`"""
+ a new vec in `fill_vec`, and fill it with the expected values"""
[[exercises]]
name = "move_semantics5"