Skip to content
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

Clarify the English translation of ?Sized #33747

Merged
merged 4 commits into from
May 21, 2016
Merged

Clarify the English translation of ?Sized #33747

merged 4 commits into from
May 21, 2016

Conversation

postmodern
Copy link
Contributor

  • 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 about how Sized is implicitly bound.
  • Refer to the syntax as ?Sized, since it's currently the only allowed trait that can follow ?.

* 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.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit, the line wrapping here is different to the rest of the file, it should probably be whatever the rest of the text is (looks like 80 chars?).

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: allowing -> allows

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I think this is still not quite right...
My understanding is that you should be able to remove the appositive (the part between the commas) and still have a valid sentence. So I think the word "which" here is extraneous.

I'd prefer if someone else could chime in here as well on the grammar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm horrible with grammar, so I'll defer.

@steveklabnik
Copy link
Member

Thanks for this @postmodern ! It is an area where, like the feature itself, the docs are a bit patched together....

* 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".
@postmodern
Copy link
Contributor Author

Edited yet again. I now refer to ?Sized as a "special bound syntax". While seasoned Rust developers may refer to?Sized as a bound, it is still specialized syntax that only works with Sized. The fact that I can't do ?MyTrait confused a beginner such as myself, and led me to making this pull request.

@Manishearth
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 21, 2016

📌 Commit 71af58a has been approved by Manishearth

Manishearth added a commit to Manishearth/rust that referenced this pull request May 21, 2016
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.
* Refer to the syntax as `?Sized`, since it's currently the only allowed trait that can follow `?`.
bors added a commit that referenced this pull request May 21, 2016
Rollup of 7 pull requests

- Successful merges: #33578, #33679, #33743, #33746, #33747, #33750, #33757
- Failed merges:
@bors bors merged commit 71af58a into rust-lang:master May 21, 2016
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`”, which allows us to match
both sized and unsized types. All generic type parameters implicitly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"which" should be removed from the first sentence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants