Skip to content

DST custom coercions.#982

Merged
nikomatsakis merged 5 commits into
rust-lang:masterfrom
nrc:dst-coercions
Jun 3, 2015
Merged

DST custom coercions.#982
nikomatsakis merged 5 commits into
rust-lang:masterfrom
nrc:dst-coercions

Conversation

@nrc

@nrc nrc commented Mar 16, 2015

Copy link
Copy Markdown
Member

Custom coercions allow smart pointers to fully participate in the DST system.
In particular, they allow practical use of Rc<T> and Arc<T> where T is unsized.

This RFC subsumes part of RFC 401 coercions.

Rendered

[edited to add rendered link]

@nrc nrc self-assigned this Mar 17, 2015
Comment thread text/0000-dst-coercion.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't quite know what "simple substitution of type parameters" means... but I think we want to check that both of them are applications of the same base type constructor. e.g. Foo<X> and Foo<Y> are ok, but not Foo<X> and Bar<Y>.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I meant that there exists some Ts (where Ts = a sequence of T) and some Xs such that Target = [Ts/Xs]Self and Self is not in Xs. Which I think subsumes your requirement, but also precludes some pathalogical cases such as Target = Foo<T1, T2>, Self = Foo<X, X>.

@nikomatsakis

Copy link
Copy Markdown
Contributor

I read over the revised version -- it seems pretty good to me, I left a few comments.

Comment thread text/0000-dst-coercion.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be implementing CoerceUnsized<NonZero<U>>?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes

@nrc nrc added the T-lang Relevant to the language team, which will review and decide on the RFC. label May 15, 2015
@nikomatsakis

Copy link
Copy Markdown
Contributor

@nrc did you plan to incorporate @eddyb's feedback here?

@nrc

nrc commented May 21, 2015

Copy link
Copy Markdown
Member Author

I do, I had forgotten this was not merged yet.

@nikomatsakis

Copy link
Copy Markdown
Contributor

Hear ye, hear ye. This RFC is now in final comment period until June 2nd.

@nikomatsakis nikomatsakis added the final-comment-period Will be merged/postponed/closed in ~10 calendar days unless new substational objections are raised. label May 26, 2015
@nikomatsakis

Copy link
Copy Markdown
Contributor

This RFC has been accepted. It is not yet merged to allow @nrc to incorporate final comments reflecting the current design. (It has been partially implemented in the meantime.)

-- Language design subteam

Nick Cameron added 5 commits June 3, 2015 15:44
Custom coercions allow smart pointers to fully participate in the DST system.
In particular, they allow practical use of `Rc<T>` and `Arc<T>` where `T` is unsized.

This RFC subsumes part of [RFC 401 coercions](https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md).
@nrc nrc force-pushed the dst-coercions branch from 433245c to 4b99006 Compare June 3, 2015 05:05
@nrc

nrc commented Jun 3, 2015

Copy link
Copy Markdown
Member Author

@nikomatsakis updated

@nikomatsakis nikomatsakis merged commit 4b99006 into rust-lang:master Jun 3, 2015
nikomatsakis added a commit that referenced this pull request Jun 3, 2015
@nikomatsakis

Copy link
Copy Markdown
Contributor

Merged. Tracking issue is rust-lang/rust#18598

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-coercions Proposals relating to coercions. A-dst Proposals re. DSTs final-comment-period Will be merged/postponed/closed in ~10 calendar days unless new substational objections are raised. T-lang Relevant to the language team, which will review and decide on the RFC.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants