This repository has been archived on 2023-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
rustlings-exercises-completed/exercises/move_semantics
frogtd d75759e829
fix(move_semantics5): change &mut *y to &mut x (#814)
Instead of having to explain why 
```rs
let mut x = 100; 
let y = &mut x;
let mut z_owned = *y;
let z = &mut z_owned;
*y += 100;
*z += 1000;
```
and 
```rs
let mut x = 100; 
let y = &mut x;
let z = &mut *y;
*y += 100;
*z += 1000;
```
are different, you still get the point across about having only one mutable reference.
As it stands, this exercise does too much (dereferencing and having only one mutable reference), and by doing so confuses people.

Example of someone being confused by this:
<https://discord.com/channels/273534239310479360/273541522815713281/872689531428692040>
2021-09-25 10:52:18 +02:00
..
move_semantics1.rs Merge branch 'master' into refactor-hints 2019-11-11 17:21:06 +01:00
move_semantics2.rs fix: line numbers in several exercises and hints 2019-11-14 08:21:56 +01:00
move_semantics3.rs Merge branch 'master' into refactor-hints 2019-11-11 17:21:06 +01:00
move_semantics4.rs fix(move_semantics4): Remove redundant "instead" (#640) 2021-02-07 12:22:13 +01:00
move_semantics5.rs fix(move_semantics5): change &mut *y to &mut x (#814) 2021-09-25 10:52:18 +02:00
README.md docs(exercises): updated all exercises readme files 2021-04-23 19:54:31 +02:00

Move Semantics

These exercises are adapted from pnkfelix's Rust Tutorial -- Thank you Felix!!!

Further information

For this section, the book links are especially important.