Skip to content

Commit

Permalink
More updates to the ownership section.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwalton committed May 31, 2023
1 parent eb7f5d7 commit ff0e7cb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion docs/ch00-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hide_title: true

<div align="center">
<h1>The Rust Book (Abridged)</h1>
<p>v0.2.2 - Draft</p>
<p>v0.3.0 - Draft</p>
<p>By Jason Walton</p>
<p>Based on <a href="https://doc.rust-lang.org/stable/book/">"The Rust Programming Language"</a> by Steve Klabnik and Carol Nichols.</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/ch04-ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ let r2 = &mut s; // This is an error!
println!("{}, {}", r1, r2);
```

This restriction is imposed because it prevents data races. The compiler will stop us from creating data races at compile time!
This restriction is imposed because it prevents data races. The compiler will stop us from creating data races at compile time! Some people prefer to think about references in terms of "shared references" and "exclusive references" in stead of as "immutable" and "mutable".

The scope of a reference lasts only until it's last use, not until the end of the block, so this is fine:

Expand Down
Loading

0 comments on commit ff0e7cb

Please sign in to comment.