mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-26 01:04:35 +02:00
Update Speaker Notes for slices.md (#208)
It makes sense to add a speaker note about the question asked.
This commit is contained in:
parent
a517ff5816
commit
fe8fa8d232
@ -26,5 +26,9 @@ fn main() {
|
||||
* `s` is a reference to a slice of `i32`s. Notice that the type of `s` no longer mentions the array length. This allows us to performing computations on slices of different sizes.
|
||||
|
||||
* Slices always borrow from another object. In this example, `a` has to remain 'alive' so we can take a slice from it.
|
||||
|
||||
* The question about modifying `a[3]` can spark an interesting discussion, but the answer is that for memory safety reasons
|
||||
you cannot do it through `a` after you created a slice. But you can read the data from both `a` and `s` safely.
|
||||
More details will be explained in the borrow checker section.
|
||||
|
||||
</details>
|
||||
|
Loading…
x
Reference in New Issue
Block a user