From 5e791071ea9ad9bb6f4ff366da80a32da6ed5e73 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sat, 6 Sep 2025 16:25:57 +0200 Subject: [PATCH 1/3] docs: improve language in references section --- src/references/exclusive.md | 2 +- src/references/slices.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/references/exclusive.md b/src/references/exclusive.md index 291718c5cb27..88ef8cea7a5b 100644 --- a/src/references/exclusive.md +++ b/src/references/exclusive.md @@ -28,7 +28,7 @@ Key points: making an `&point.0` or changing `point.0` while `x_coord` is alive. - Be sure to note the difference between `let mut x_coord: &i32` and - `let x_coord: &mut i32`. The first one represents a shared reference which can + `let x_coord: &mut i32`. The first one represents a shared reference that can be bound to different values, while the second represents an exclusive reference to a mutable value. diff --git a/src/references/slices.md b/src/references/slices.md index c82fe86457aa..625ac4f14dc2 100644 --- a/src/references/slices.md +++ b/src/references/slices.md @@ -47,7 +47,7 @@ fn main() { buffer. - You can't grow a slice to point to a larger section of the backing buffer. The slice loses information about the underlying buffer and so you can't - know how larger the slice can be grown. + know how large the slice can be grown. - To get a larger slice you have to back to the original buffer and create a larger slice from there. From 9886083c29ba3b7ef714d638f15468db3db05183 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sat, 6 Sep 2025 18:44:59 +0200 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Dmitri Gribenko --- src/references/exclusive.md | 4 ++-- src/references/slices.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/references/exclusive.md b/src/references/exclusive.md index 88ef8cea7a5b..20243195839a 100644 --- a/src/references/exclusive.md +++ b/src/references/exclusive.md @@ -28,8 +28,8 @@ Key points: making an `&point.0` or changing `point.0` while `x_coord` is alive. - Be sure to note the difference between `let mut x_coord: &i32` and - `let x_coord: &mut i32`. The first one represents a shared reference that can - be bound to different values, while the second represents an exclusive + `let x_coord: &mut i32`. The first one is a shared reference that can + be bound to different values, while the second is an exclusive reference to a mutable value. diff --git a/src/references/slices.md b/src/references/slices.md index 625ac4f14dc2..db4c29edb3a3 100644 --- a/src/references/slices.md +++ b/src/references/slices.md @@ -46,7 +46,7 @@ fn main() { - You can't append elements of the slice, since it doesn't own the backing buffer. - You can't grow a slice to point to a larger section of the backing buffer. - The slice loses information about the underlying buffer and so you can't + A slice does not have information about the length of the underlying buffer and so you can't know how large the slice can be grown. - To get a larger slice you have to back to the original buffer and create a larger slice from there. From 42090cdd48b41503ba949c3c508463e275be50e1 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sat, 6 Sep 2025 19:02:46 +0200 Subject: [PATCH 3/3] Fix formatting --- src/references/exclusive.md | 6 +++--- src/references/slices.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/references/exclusive.md b/src/references/exclusive.md index 20243195839a..67b6d309dc1d 100644 --- a/src/references/exclusive.md +++ b/src/references/exclusive.md @@ -28,8 +28,8 @@ Key points: making an `&point.0` or changing `point.0` while `x_coord` is alive. - Be sure to note the difference between `let mut x_coord: &i32` and - `let x_coord: &mut i32`. The first one is a shared reference that can - be bound to different values, while the second is an exclusive - reference to a mutable value. + `let x_coord: &mut i32`. The first one is a shared reference that can be bound + to different values, while the second is an exclusive reference to a mutable + value. diff --git a/src/references/slices.md b/src/references/slices.md index db4c29edb3a3..cdc5dc0f2ea5 100644 --- a/src/references/slices.md +++ b/src/references/slices.md @@ -45,9 +45,9 @@ fn main() { - You can't "grow" a slice once it's created: - You can't append elements of the slice, since it doesn't own the backing buffer. - - You can't grow a slice to point to a larger section of the backing buffer. - A slice does not have information about the length of the underlying buffer and so you can't - know how large the slice can be grown. + - You can't grow a slice to point to a larger section of the backing buffer. A + slice does not have information about the length of the underlying buffer + and so you can't know how large the slice can be grown. - To get a larger slice you have to back to the original buffer and create a larger slice from there.