diff --git a/src/borrowing/interior-mutability/refcell.md b/src/borrowing/interior-mutability/refcell.md index 41dfdd84a177..8c38659a11e9 100644 --- a/src/borrowing/interior-mutability/refcell.md +++ b/src/borrowing/interior-mutability/refcell.md @@ -47,7 +47,7 @@ fn main() { - The extra block in the example is to end the borrow created by the call to `borrow_mut` before we print the cell. Trying to print a borrowed `RefCell` - just shows the message `"{borrowed}"`. + just shows `RefCell { value: }`. ## More to Explore diff --git a/src/iterators/collect.md b/src/iterators/collect.md index 5fd989404813..992ab9d4d541 100644 --- a/src/iterators/collect.md +++ b/src/iterators/collect.md @@ -24,7 +24,7 @@ fn main() {
-- Any iterator can be collected in to a `Vec`, `VecDeque`, or `HashSet`. +- Any iterator can be collected into a `Vec`, `VecDeque`, or `HashSet`. Iterators that produce key-value pairs (i.e. a two-element tuple) can also be collected into `HashMap` and `BTreeMap`. diff --git a/src/iterators/helpers.md b/src/iterators/helpers.md index cbb51b1328cf..e42dd1dd60e6 100644 --- a/src/iterators/helpers.md +++ b/src/iterators/helpers.md @@ -34,7 +34,7 @@ fn main() { where you can find all the documentation about them. - Many of these helper methods take the original iterator and produce a new - iterator with different behavior. These are know as "iterator adapter + iterator with different behavior. These are known as "iterator adapter methods". - Some methods, like `sum` and `count`, consume the iterator and pull all of the diff --git a/src/lifetimes/exercise.rs b/src/lifetimes/exercise.rs index 3e0e0a551bed..87dfe2d10365 100644 --- a/src/lifetimes/exercise.rs +++ b/src/lifetimes/exercise.rs @@ -88,7 +88,7 @@ impl<'a> FieldValue<'a> { /// Parse a VARINT, returning the parsed value and the remaining bytes. fn parse_varint(data: &[u8]) -> (u64, &[u8]) { - for i in 0..7 { + for i in 0..10 { let Some(b) = data.get(i) else { panic!("Not enough bytes for varint"); }; @@ -103,7 +103,7 @@ fn parse_varint(data: &[u8]) -> (u64, &[u8]) { } } - // More than 7 bytes is invalid. + // More than 10 bytes is invalid. panic!("Too many bytes for varint"); } diff --git a/src/modules/encapsulation.md b/src/modules/encapsulation.md index 7d28977ffefb..a3ae79702089 100644 --- a/src/modules/encapsulation.md +++ b/src/modules/encapsulation.md @@ -75,7 +75,7 @@ fn main() { ## More to Explore - If students want more information about privacy (or lack thereof) in enums, - you can bring up `#[doc_hidden]` and `#[non_exhaustive]` and show how they're + you can bring up `#[doc(hidden)]` and `#[non_exhaustive]` and show how they're used to limit what can be done with an enum. - Module privacy still applies when there are `impl` blocks in other modules diff --git a/src/pattern-matching/destructuring-structs.md b/src/pattern-matching/destructuring-structs.md index 66f3289316c6..4e8f5e941c1c 100644 --- a/src/pattern-matching/destructuring-structs.md +++ b/src/pattern-matching/destructuring-structs.md @@ -36,7 +36,7 @@ fn main() {
- Change the literal values in `m` to match with the other patterns. -- Add a new field to `Movement` and make changes to the pattern as needed. +- Add a new field to `Move` and make changes to the pattern as needed. - Note how `delta: (x, 0)` is a nested pattern. ## More to Explore diff --git a/src/pattern-matching/exercise.md b/src/pattern-matching/exercise.md index 095e3d192bde..74d65317e18c 100644 --- a/src/pattern-matching/exercise.md +++ b/src/pattern-matching/exercise.md @@ -71,7 +71,7 @@ Create a new Cargo library project with cargo new --lib evaluator ``` -Copy and paste the code below into a the `src/lib.rs` file. +Copy and paste the code below into the `src/lib.rs` file. Then begin implementing `eval`. Use `cargo test` to ensure that the final library passes the tests. It may be helpful to use `todo!()` and get the tests diff --git a/src/unsafe-rust/unsafe-functions/extern-c.md b/src/unsafe-rust/unsafe-functions/extern-c.md index 80a025032e76..2298c6c0ae49 100644 --- a/src/unsafe-rust/unsafe-functions/extern-c.md +++ b/src/unsafe-rust/unsafe-functions/extern-c.md @@ -7,8 +7,9 @@ SPDX-License-Identifier: CC-BY-4.0 You can declare foreign functions for access from Rust with `unsafe extern`. This is unsafe because the compiler has no way to reason about their behavior. -Functions declared in an `extern` block must be marked as `safe` or `unsafe`, -depending on whether they have preconditions for safe use: +Functions declared in an `extern` block can be marked as `safe` or `unsafe`, +depending on whether they have preconditions for safe use. Functions without +either qualifier are `unsafe` to call: ```rust,editable # // Copyright 2025 Google LLC diff --git a/src/unsafe-rust/unsafe.md b/src/unsafe-rust/unsafe.md index 082199aca808..868d7cb7bd8b 100644 --- a/src/unsafe-rust/unsafe.md +++ b/src/unsafe-rust/unsafe.md @@ -29,7 +29,7 @@ Unsafe Rust gives you access to five new capabilities: - Implement `unsafe` traits. We will briefly cover unsafe capabilities next. For full details, please see -[Chapter 19.1 in the Rust Book](https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html) +[Chapter 20.1 in the Rust Book](https://doc.rust-lang.org/book/ch20-01-unsafe-rust.html) and the [Rustonomicon](https://doc.rust-lang.org/nomicon/).