Skip to content

book: Replace "an &mut" with "a mut". Fixes #30568 #30620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 30, 2015
Merged
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
4 changes: 2 additions & 2 deletions src/doc/book/choosing-your-guarantees.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,11 @@ With the former, the `RefCell<T>` is wrapping the `Vec<T>`, so the `Vec<T>` in i
mutable. At the same time, there can only be one mutable borrow of the whole `Vec` at a given time.
This means that your code cannot simultaneously work on different elements of the vector from
different `Rc` handles. However, we are able to push and pop from the `Vec<T>` at will. This is
similar to an `&mut Vec<T>` with the borrow checking done at runtime.
similar to a `&mut Vec<T>` with the borrow checking done at runtime.

With the latter, the borrowing is of individual elements, but the overall vector is immutable. Thus,
we can independently borrow separate elements, but we cannot push or pop from the vector. This is
similar to an `&mut [T]`[^3], but, again, the borrow checking is at runtime.
similar to a `&mut [T]`[^3], but, again, the borrow checking is at runtime.

In concurrent programs, we have a similar situation with `Arc<Mutex<T>>`, which provides shared
mutability and ownership.
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/lifetimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Then in our parameter list, we use the lifetimes we’ve named:
...(x: &'a i32)
```

If we wanted an `&mut` reference, we’d do this:
If we wanted a `&mut` reference, we’d do this:

```rust,ignore
...(x: &'a mut i32)
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/references-and-borrowing.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ the thing `y` points at. You’ll notice that `x` had to be marked `mut` as well
If it wasn’t, we couldn’t take a mutable borrow to an immutable value.

You'll also notice we added an asterisk (`*`) in front of `y`, making it `*y`,
this is because `y` is an `&mut` reference. You'll also need to use them for
this is because `y` is a `&mut` reference. You'll also need to use them for
accessing the contents of a reference as well.

Otherwise, `&mut` references are just like references. There _is_ a large
Expand Down