From 2fd4e604a46d1175f260a33efdfcacb7b48ed1ff Mon Sep 17 00:00:00 2001 From: Postmodern Date: Thu, 19 May 2016 17:07:29 -0700 Subject: [PATCH 1/4] Clarify the English translation of `?Sized` * It wasn't clear whether `?Sized` meant "not `Sized`" or "`Sized` or not `Sized`". According to #rust IRC, it does indeed mean "`Sized` or not `Sized`". * Use the same language as [Trait std::marker::Sized](https://doc.rust-lang.org/std/marker/trait.Sized.html) about how `Sized` is implicitly bound. --- src/doc/book/unsized-types.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/doc/book/unsized-types.md b/src/doc/book/unsized-types.md index 73b90355e4f1b..d94409a7b827d 100644 --- a/src/doc/book/unsized-types.md +++ b/src/doc/book/unsized-types.md @@ -47,7 +47,7 @@ pointers, can use this `impl`. # ?Sized If you want to write a function that accepts a dynamically sized type, you -can use the special bound, `?Sized`: +can use the special syntax, `?Sized`: ```rust struct Foo { @@ -55,6 +55,5 @@ struct Foo { } ``` -This `?`, read as “T may be `Sized`”, means that this bound is special: it -lets us match more kinds, not less. It’s almost like every `T` implicitly has -`T: Sized`, and the `?` undoes this default. +This `?Sized`, read as “T may or may not be `Sized`”, allowing us to match both constant size and unsized types. +All generic type parameters implicitly have the `Sized` bound, so `?Sized` can be used to opt-out of the implicit bound. From d021d7d7cf3aa222ac5bbca6d0c109e0d1f9a890 Mon Sep 17 00:00:00 2001 From: Postmodern Date: Thu, 19 May 2016 17:17:17 -0700 Subject: [PATCH 2/4] Keep line-width within 80 columns --- src/doc/book/unsized-types.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/doc/book/unsized-types.md b/src/doc/book/unsized-types.md index d94409a7b827d..12864f2067ed4 100644 --- a/src/doc/book/unsized-types.md +++ b/src/doc/book/unsized-types.md @@ -55,5 +55,6 @@ struct Foo { } ``` -This `?Sized`, read as “T may or may not be `Sized`”, allowing us to match both constant size and unsized types. -All generic type parameters implicitly have the `Sized` bound, so `?Sized` can be used to opt-out of the implicit bound. +This `?Sized`, read as “T may or may not be `Sized`”, allowing us to match both +constant size and unsized types. All generic type parameters implicitly have +the `Sized` bound, so `?Sized` can be used to opt-out of the implicit bound. From d8c086b08561b41576e2614ae3b360374ccf993d Mon Sep 17 00:00:00 2001 From: Postmodern Date: Thu, 19 May 2016 17:27:04 -0700 Subject: [PATCH 3/4] Grammar change --- src/doc/book/unsized-types.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/doc/book/unsized-types.md b/src/doc/book/unsized-types.md index 12864f2067ed4..746faeb81b2d8 100644 --- a/src/doc/book/unsized-types.md +++ b/src/doc/book/unsized-types.md @@ -55,6 +55,7 @@ struct Foo { } ``` -This `?Sized`, read as “T may or may not be `Sized`”, allowing us to match both -constant size and unsized types. All generic type parameters implicitly have -the `Sized` bound, so `?Sized` can be used to opt-out of the implicit bound. +This `?Sized`, read as “T may or may not be `Sized`”, which allows us to match +both constant size and unsized types. All generic type parameters implicitly +have the `Sized` bound, so `?Sized` can be used to opt-out of the implicit +bound. From 71af58accf8f773a7d410cf947940487f65ae70f Mon Sep 17 00:00:00 2001 From: Postmodern Date: Fri, 20 May 2016 17:47:34 -0700 Subject: [PATCH 4/4] Wording changes * Use "special bound syntax" instead of "special syntax". `?Sized` is technically a "bound", but `?Sized` is specialized syntax that _only_ works with `Sized`, and no other Trait. * Replace "constant size" with "sized". --- src/doc/book/unsized-types.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/book/unsized-types.md b/src/doc/book/unsized-types.md index 746faeb81b2d8..a23470d39fa09 100644 --- a/src/doc/book/unsized-types.md +++ b/src/doc/book/unsized-types.md @@ -47,7 +47,7 @@ pointers, can use this `impl`. # ?Sized If you want to write a function that accepts a dynamically sized type, you -can use the special syntax, `?Sized`: +can use the special bound syntax, `?Sized`: ```rust struct Foo { @@ -56,6 +56,6 @@ struct Foo { ``` This `?Sized`, read as “T may or may not be `Sized`”, which allows us to match -both constant size and unsized types. All generic type parameters implicitly -have the `Sized` bound, so `?Sized` can be used to opt-out of the implicit +both sized and unsized types. All generic type parameters implicitly +have the `Sized` bound, so the `?Sized` can be used to opt-out of the implicit bound.