Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/borrowing/interior-mutability/refcell.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: <borrowed> }`.

## More to Explore

Expand Down
2 changes: 1 addition & 1 deletion src/iterators/collect.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn main() {

<details>

- 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`.

Expand Down
2 changes: 1 addition & 1 deletion src/iterators/helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/lifetimes/exercise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
};
Expand All @@ -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");
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/encapsulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pattern-matching/destructuring-structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() {
<details>

- 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
Expand Down
2 changes: 1 addition & 1 deletion src/pattern-matching/exercise.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/unsafe-rust/unsafe-functions/extern-c.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/unsafe-rust/unsafe.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).

<details>
Expand Down
Loading