From e4ac8419e4caf5c96fcc44e198b7bf6cc769d7a5 Mon Sep 17 00:00:00 2001 From: Paul Weaver Date: Sun, 18 Apr 2021 23:36:41 +0100 Subject: [PATCH 1/3] Minor grammar fixes for Pin chapter --- src/5_pin.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/5_pin.md b/src/5_pin.md index a2bd592..475b033 100644 --- a/src/5_pin.md +++ b/src/5_pin.md @@ -35,7 +35,7 @@ for the names that were chosen. Naming is not easy, and I considered renaming `Unpin` and `!Unpin` in this book to make them easier to reason about. However, an experienced member of the Rust community convinced me that that there -is just too many nuances and edge-cases to consider which are easily overlooked when +are just too many nuances and edge-cases to consider which are easily overlooked when naively giving these markers different names, and I'm convinced that we'll just have to get used to them and use them as is. @@ -213,7 +213,7 @@ now. The struct is not self-referential anymore, it holds a pointer to a field in a different object. That means we can't rely on the lifetime of `test2.b` to be tied to the lifetime of `test2` anymore. -If your still not convinced, this should at least convince you: +If you're still not convinced, this should at least convince you: ```rust fn main() { @@ -550,7 +550,7 @@ to be moved even when pinned, so `Pin` will have no effect on such a type. 2. Getting a `&mut T` to a pinned T requires unsafe if `T: !Unpin`. In other words: requiring a pinned pointer to a type which is `!Unpin` prevents -the _user_ of that API from moving that value unless it choses to write `unsafe` +the _user_ of that API from moving that value unless they choose to write `unsafe` code. 3. Pinning does nothing special with memory allocation like putting it into some From 6911e5a8750cb58527745ba3758305388572317f Mon Sep 17 00:00:00 2001 From: Paul Weaver Date: Sun, 18 Apr 2021 23:41:56 +0100 Subject: [PATCH 2/3] Remove dead code line in Pin chapter --- src/5_pin.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/5_pin.md b/src/5_pin.md index 475b033..8a6e23d 100644 --- a/src/5_pin.md +++ b/src/5_pin.md @@ -289,7 +289,6 @@ struct Test { impl Test { fn new(txt: &str) -> Self { - let a = String::from(txt); Test { a: String::from(txt), b: std::ptr::null(), From 156ae48bbf9101054a79fdc6edd46a2bcffed57b Mon Sep 17 00:00:00 2001 From: Paul Weaver Date: Mon, 19 Apr 2021 00:22:35 +0100 Subject: [PATCH 3/3] Whitespace --- src/5_pin.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/5_pin.md b/src/5_pin.md index 8a6e23d..54e6b44 100644 --- a/src/5_pin.md +++ b/src/5_pin.md @@ -527,8 +527,8 @@ pub fn main() { let mut test1 = Test::new("test1"); let mut test2 = Test::new("test2"); - println!("a: {}, b: {}",test1.as_ref().a(), test1.as_ref().b()); - println!("a: {}, b: {}",test2.as_ref().a(), test2.as_ref().b()); + println!("a: {}, b: {}", test1.as_ref().a(), test1.as_ref().b()); + println!("a: {}, b: {}", test2.as_ref().a(), test2.as_ref().b()); } ```