Skip to content

Commit

Permalink
add both incoming and previous
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelraz committed Dec 24, 2024
1 parent a204374 commit bb09617
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions training-slides/src/shared-mutability.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ println!("{} {} {} {}", a, b, c, c2);
```

The code works, but you *have* to use shadowing with `let a = &mut x.a;` or else the compiler will error. The borrowchecker is particularly frail here - replacing `Foo` with `x = [1,2,3]` and trying to borrow indexes will make it error out.
Which does work but doesn't solve the problem of declaring `let mut x` to begin with.

## `RefCell`

Expand Down

0 comments on commit bb09617

Please sign in to comment.