From 0ffbe1c938fb681061d45f68ef815c880a2e008d Mon Sep 17 00:00:00 2001 From: mcc Date: Thu, 25 Mar 2021 18:50:59 -0400 Subject: [PATCH 1/2] Fix various grammatical errors around ?Sized * Section 10.2 contains two sentences which are not sentences (I.E., they do not contain verbs). Patch makes the sentences grammatical and less ambugious, also links on the phrase ?Sized to the stdlib doc for Sized which is the clearest explanation of what ?Sized does I can find. * Section 10.6 contains the text '? is only used to declare that the Sized trait may not be implemented for a type parameter or associated type'. 'May not' makes it sound as if it is prohibited to implement the Sized trait, whereas in fact the text means that the type may at its option fail to implement the sized trait. Patch clarifies. --- src/dynamically-sized-types.md | 6 +++--- src/trait-bounds.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dynamically-sized-types.md b/src/dynamically-sized-types.md index ca40dfec4..86c9a5db6 100644 --- a/src/dynamically-sized-types.md +++ b/src/dynamically-sized-types.md @@ -11,10 +11,10 @@ types">DSTs. Such types can only be used in certain cases: * Pointers to slices also store the number of elements of the slice. * Pointers to trait objects also store a pointer to a vtable. * DSTs can be provided as - type arguments when a bound of `?Sized`. By default any type parameter - has a `Sized` bound. + type arguments when the type parameter has the special lifetime bound [`?Sized`][sized] specified. (In other words by default any type parameter on a non-trait item + has a `Sized` bound, and specifying the `?Sized` bound removes it.) * Traits may be implemented for DSTs. Unlike type parameters `Self: ?Sized` by default in trait + types">DSTs. Unlike type parameters on other kinds of items, `Self: ?Sized` is the default in trait definitions. * Structs may contain a DST as the last field, this makes the struct itself a diff --git a/src/trait-bounds.md b/src/trait-bounds.md index fe677a9a1..55bd91956 100644 --- a/src/trait-bounds.md +++ b/src/trait-bounds.md @@ -77,8 +77,8 @@ Trait and lifetime bounds are also used to name [trait objects]. ## `?Sized` -`?` is only used to declare that the [`Sized`] trait may not be -implemented for a type parameter or associated type. `?Sized` may +`?` is only used to declare that the [`Sized`] trait may be +unimplemented for a type parameter or associated type. `?Sized` may not be used as a bound for other types. ## Lifetime bounds From 0e1705d3601fce918c81f9a041ac895a93f8d769 Mon Sep 17 00:00:00 2001 From: mcc Date: Thu, 25 Mar 2021 22:33:20 -0400 Subject: [PATCH 2/2] Fix incorrect link on ?sized in last commit --- src/dynamically-sized-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynamically-sized-types.md b/src/dynamically-sized-types.md index 86c9a5db6..ad35c7a8c 100644 --- a/src/dynamically-sized-types.md +++ b/src/dynamically-sized-types.md @@ -11,7 +11,7 @@ types">DSTs. Such types can only be used in certain cases: * Pointers to slices also store the number of elements of the slice. * Pointers to trait objects also store a pointer to a vtable. * DSTs can be provided as - type arguments when the type parameter has the special lifetime bound [`?Sized`][sized] specified. (In other words by default any type parameter on a non-trait item + type arguments when the type parameter has the special lifetime bound [`?Sized`](trait-bounds.html#sized) specified. (In other words by default any type parameter on a non-trait item has a `Sized` bound, and specifying the `?Sized` bound removes it.) * Traits may be implemented for DSTs. Unlike type parameters on other kinds of items, `Self: ?Sized` is the default in trait