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

Replace A+Send trait subtyping with upcast coercion #23423

Merged
merged 2 commits into from
Mar 17, 2015

Conversation

nikomatsakis
Copy link
Contributor

This upcast coercion currently never requires vtable changes. It should be generalized.

This is a [breaking-change] -- if you have an impl on an object type like impl SomeTrait, then this will no longer be applicable to object types like SomeTrait+Send. In the standard library, this primarily affected Any, and this PR adds impls for Any+Send as to keep the API the same in practice. An alternate workaround is to use UFCS form or standalone fns. For more details, see #18737 (comment).

r? @nrc

@nrc
Copy link
Member

nrc commented Mar 17, 2015

r+ with nits fixed

This upcast coercion currently preserves the vtable for the object, but
eventually it can be used to create a derived vtable. The upcast
coercion is not introduced into method dispatch; see comment on rust-lang#18737
for information about why. Fixes rust-lang#18737.
@nikomatsakis
Copy link
Contributor Author

I addressed the nits but also changed the approach for Any. Rather than using UFCS form, which felt very error prone, I added impls for Any+Send. This means that no code needs to be changed.

@nikomatsakis
Copy link
Contributor Author

@bors r=nrc 277b4f0

@bors
Copy link
Contributor

bors commented Mar 17, 2015

⌛ Testing commit 277b4f0 with merge c64d671...

bors added a commit that referenced this pull request Mar 17, 2015
This upcast coercion currently never requires vtable changes. It should be generalized. 

This is a [breaking-change] -- if you have an impl on an object type like `impl SomeTrait`, then this will no longer be applicable to object types like `SomeTrait+Send`. In the standard library, this primarily affected `Any`, and this PR adds impls for `Any+Send` as to keep the API the same in practice. An alternate workaround is to use UFCS form or standalone fns. For more details, see <#18737 (comment)>.

r? @nrc
@bors bors merged commit 277b4f0 into rust-lang:master Mar 17, 2015
@bors bors mentioned this pull request Mar 17, 2015
@nikomatsakis nikomatsakis deleted the issue-18737-trait-subtyping branch March 30, 2016 16:14
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.

3 participants