Add a note that shared references are Copy (#2107)

Add a note to the `Copy` slide noting that shared references are `Copy`.
A student asked about this today, and it's something I want to remember
to mention in future classes.
This commit is contained in:
Nicole L authored and GitHub committed 2024-05-30 10:19:33 -04:00
1 parent 8e668cdadd
commit 06264e8cc7
1 file changed
+7
+7
View File
@@ -57,4 +57,11 @@ In the above example, try the following:
`println!` for `p1`.
- Show that it works if you clone `p1` instead.
# More to Explore
- Shared references are `Copy`/`Clone`, mutable references are not. This is
because rust requires that mutable references be exclusive, so while it's
valid to make a copy of a shared reference, creating a copy of a mutable
reference would violate Rust's borrowing rules.
</details>