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

Add more docs for CoerceUnsized and Unsize #38816

Merged
merged 1 commit into from
Jan 10, 2017

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Jan 4, 2017

here be dragons

r? @ubsan @steveklabnik

Copy link
Contributor

@strega-nil strega-nil left a comment

Choose a reason for hiding this comment

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

Seems good on the technical aspects, otherwise.

/// `Unsize` is implemented for:
///
/// - `[T; N]` is `Unsize<[T]>`
/// - `T` is `Trait` when `T: Trait`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be T is Unsize<Trait> when T: Trait, in order to be consistent with the above sentence.

/// See the [DST coercion RfC][dst-coerce] and [the nomicon entry on coercion][nomicon-coerce]
/// for more details.
///
/// For builtin types, pointers to `T` will coerce to pointers to `U` if `T: Unsize<U>`
Copy link
Contributor

Choose a reason for hiding this comment

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

"For builtin types" sounds unclear; perhaps reword this to say something to the effect of "for builtin pointer types".

/// field and coerce that.
///
/// Generally, for smart pointers you will implement
/// `CoerceUnsized<Ptr<U>> for Ptr<T> where T: Unsize<U>, U: ?Sized`, with an
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; where U: ?Sized is, afaik, not valid syntax. Another argument for supporting it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The docs also output this form. There is no reason not to support it IMO.

@Manishearth
Copy link
Member Author

Updated.

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jan 4, 2017

📌 Commit 07e844f has been approved by GuillaumeGomez

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 4, 2017
…meGomez

Add more docs for CoerceUnsized and Unsize

here be dragons

r? @ubsan @steveklabnik
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jan 4, 2017
…meGomez

Add more docs for CoerceUnsized and Unsize

here be dragons

r? @ubsan @steveklabnik
@nrc
Copy link
Member

nrc commented Jan 5, 2017

cc @rust-lang/lang to make sure the docs fit our beliefs

@nikomatsakis nikomatsakis self-assigned this Jan 9, 2017
sanxiyn added a commit to sanxiyn/rust that referenced this pull request Jan 10, 2017
…meGomez

Add more docs for CoerceUnsized and Unsize

here be dragons

r? @ubsan @steveklabnik
bors added a commit that referenced this pull request Jan 10, 2017
Rollup of 11 pull requests

- Successful merges: #38606, #38607, #38623, #38664, #38799, #38816, #38836, #38839, #38841, #38849, #38874
- Failed merges: #38845
@bors bors merged commit 07e844f into rust-lang:master Jan 10, 2017
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.

6 participants