## Autumn of Rust
<img src="https://i.imgur.com/0cFdjSJ.png" width="300"/>
---
## Borrow Checker

---
## Memory Safety
---
## What do we want to be safe?
---

---
## Undefined behaviour
---
## Example
```rust
// Flip a coin
if coin is heads {
print("the password is 'secret'")
} else {
print("the password is '123456'")
}
```
---
## What if it wasn't you flipping the coin?
---
## Segfaults

---
## Computers don't work in a set order
---
## Double Free
*When you do cleaning twice for fun!*
---
## Use After Free
*Just because garbage day has passed doesn't mean that we can't dumpster dive!*
---
## Buffer Overflow
*Don't have enough space? Just overwrite your neighbours!*
---
## Memory Leak
*Why clean up when we're done? The user can just reboot their computer, right?*
---

---
## Compilers!
---
## Parser -> Syntax -> Semantics
---
## Trains
---
:dragon_face:
---
## Painting the dragon
:dragon_face: :lower_left_paintbrush:
---
## Sharing the dragon
:dragon_face:
:woman: :frame_with_picture:
:man: :frame_with_picture:
:woman: :frame_with_picture:
---
## Moved
```rust
fn double_num(num: i32) -> i32 {
return num * 2;
}
```
---
## Borrowed (immutably)
```rust
fn double_num(num: &i32) -> i32 {
// Can't be changed
}
```
---
## Borrowed (mutably)
```rust
fn double_num(num: &mut i32) {
num = num * 2;
}
```
{"metaMigratedAt":"2023-06-17T11:43:31.120Z","metaMigratedFrom":"YAML","title":"Autumn of Rust","breaks":true,"slideOptions":"{\"center\":true,\"transition\":\"slide\"}","contributors":"[{\"id\":\"db349910-53c1-45a5-aa34-1ac5434980b0\",\"add\":1809,\"del\":157}]"}