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

Fix checking of auto trait bounds in trait objects. #45772

Merged
merged 2 commits into from Nov 11, 2017

Conversation

Projects
None yet
@leodasvacas
Contributor

leodasvacas commented Nov 5, 2017

Any auto trait is allowed in trait object bounds. Fix duplicate check of type and lifetime parameter count, which we were emitting twice.

Note: This was the last use of Send in the compiler, meaning after a new stage0 we could remove the send lang item.

Fix checking of auto trait bounds in trait objects.
Any auto trait is allowed in trait object bounds.
Fix duplicate check of type and lifetime parameter count.
@rust-highfive

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Nov 5, 2017

Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

Collaborator

rust-highfive commented Nov 5, 2017

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@nikomatsakis

Code looks nice.

} else {
false
}
Def::Trait(trait_did) if tcx.trait_is_auto(trait_did) => {

This comment has been minimized.

@nikomatsakis

nikomatsakis Nov 6, 2017

Contributor

In principle we could easily extend this to arbitrary marker traits, I suppose?

@nikomatsakis

nikomatsakis Nov 6, 2017

Contributor

In principle we could easily extend this to arbitrary marker traits, I suppose?

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Nov 6, 2017

Contributor

Note: This was the last use of Send in the compiler, meaning after a new stage0 we could remove the send lang item.

Could we do it now, and just use #[cfg_attr(stage0, lang)]?

Oh, I guess that's annoying, for same reason as before. Forgive me, old habits die hard. =)

Contributor

nikomatsakis commented Nov 6, 2017

Note: This was the last use of Send in the compiler, meaning after a new stage0 we could remove the send lang item.

Could we do it now, and just use #[cfg_attr(stage0, lang)]?

Oh, I guess that's annoying, for same reason as before. Forgive me, old habits die hard. =)

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Nov 6, 2017

Contributor

OK -- thought this over. I don't think extending to arbitrary marker traits is something we can do without an RFC. But auto traits should be ok, since defining new auto traits is still unstable.

Contributor

nikomatsakis commented Nov 6, 2017

OK -- thought this over. I don't think extending to arbitrary marker traits is something we can do without an RFC. But auto traits should be ok, since defining new auto traits is still unstable.

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Nov 6, 2017

Contributor

Well, there are a few auto traits that are stable and are not Send nor Sync (e.g. UnwindSafe). I'm going to ask @rust-lang/lang team for an FCP here, just to play it safe.

Contributor

nikomatsakis commented Nov 6, 2017

Well, there are a few auto traits that are stable and are not Send nor Sync (e.g. UnwindSafe). I'm going to ask @rust-lang/lang team for an FCP here, just to play it safe.

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Nov 6, 2017

Contributor

@bors fcp merge

I'd like to propose that we merge this PR. It has the effect of enabling trait objects with arbitrary auto traits composed together. So, whereas before you could only do dyn (Trait + Send), you can now do dyn (Trait + Send + UnwindSafe), for example. I think this makes sense logically, and it fits with the oft-expressed intention to permit arbitrary object-safe traits to be composed (e.g., dyn (Foo + Bar)).

I don't feel an RFC is needed for this particular PR. However, to go further and support composition of arbitrary object-safe traits, I would like to have an RFC. This is not because I expect us to be against the basic idea, but just because there are various approaches we might take (e.g., I favor multiple vtables, but a case can be made for a single composed vtable) and I think it would benefit from a proper design cycle.

The change as implemented is "insta-stable". If we wanted, we could also make arbitrary extensions to the capabilities here, but require a feature-gate to go beyond Send/Sync. This might actually be better, so feel free to object if you think it would be.

Contributor

nikomatsakis commented Nov 6, 2017

@bors fcp merge

I'd like to propose that we merge this PR. It has the effect of enabling trait objects with arbitrary auto traits composed together. So, whereas before you could only do dyn (Trait + Send), you can now do dyn (Trait + Send + UnwindSafe), for example. I think this makes sense logically, and it fits with the oft-expressed intention to permit arbitrary object-safe traits to be composed (e.g., dyn (Foo + Bar)).

I don't feel an RFC is needed for this particular PR. However, to go further and support composition of arbitrary object-safe traits, I would like to have an RFC. This is not because I expect us to be against the basic idea, but just because there are various approaches we might take (e.g., I favor multiple vtables, but a case can be made for a single composed vtable) and I think it would benefit from a proper design cycle.

The change as implemented is "insta-stable". If we wanted, we could also make arbitrary extensions to the capabilities here, but require a feature-gate to go beyond Send/Sync. This might actually be better, so feel free to object if you think it would be.

@leodasvacas

This comment has been minimized.

Show comment
Hide comment
@leodasvacas

leodasvacas Nov 6, 2017

Contributor

@nikomatsakis I think you meant to invoke @rfcbot.

Contributor

leodasvacas commented Nov 6, 2017

@nikomatsakis I think you meant to invoke @rfcbot.

@withoutboats

This comment has been minimized.

Show comment
Hide comment
@withoutboats

withoutboats Nov 6, 2017

Contributor

@rfcbot fcp merge

Contributor

withoutboats commented Nov 6, 2017

@rfcbot fcp merge

@rfcbot

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot Nov 6, 2017

Team member @withoutboats has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

rfcbot commented Nov 6, 2017

Team member @withoutboats has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@eddyb

This comment has been minimized.

Show comment
Hide comment
@eddyb

eddyb Nov 6, 2017

Member

Oh, I guess that's annoying, for same reason as before. Forgive me, old habits die hard. =)

Wait, what's the explanation here?

Member

eddyb commented Nov 6, 2017

Oh, I guess that's annoying, for same reason as before. Forgive me, old habits die hard. =)

Wait, what's the explanation here?

@leodasvacas

This comment has been minimized.

Show comment
Hide comment
@leodasvacas

leodasvacas Nov 6, 2017

Contributor

@eddyb If we do it I imagine that when the stage0 is updated the build would start failing because the new stage0 dosen't know the send lang item.

Contributor

leodasvacas commented Nov 6, 2017

@eddyb If we do it I imagine that when the stage0 is updated the build would start failing because the new stage0 dosen't know the send lang item.

@eddyb

This comment has been minimized.

Show comment
Hide comment
@eddyb

eddyb Nov 6, 2017

Member

@leodasvacas But that's standard procedure - whoever updates the bootstrap compiler removes all the cfg{,_attr}(stage0) annotations.

Member

eddyb commented Nov 6, 2017

@leodasvacas But that's standard procedure - whoever updates the bootstrap compiler removes all the cfg{,_attr}(stage0) annotations.

@leodasvacas

This comment has been minimized.

Show comment
Hide comment
@leodasvacas

leodasvacas Nov 6, 2017

Contributor

@eddyb Ah, I was ignorant on the process here. I'll do it then.

Contributor

leodasvacas commented Nov 6, 2017

@eddyb Ah, I was ignorant on the process here. I'll do it then.

@cramertj

This comment has been minimized.

Show comment
Hide comment
@cramertj

cramertj Nov 6, 2017

Member

@rfcbot reviewed

Member

cramertj commented Nov 6, 2017

@rfcbot reviewed

Remove `send` lang item.
It's completely unused.
@leodasvacas

This comment has been minimized.

Show comment
Hide comment
@leodasvacas

leodasvacas Nov 7, 2017

Contributor

Removed the send lang item.

Contributor

leodasvacas commented Nov 7, 2017

Removed the send lang item.

@eddyb eddyb added the relnotes label Nov 7, 2017

@rfcbot

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot Nov 9, 2017

🔔 This is now entering its final comment period, as per the review above. 🔔

rfcbot commented Nov 9, 2017

🔔 This is now entering its final comment period, as per the review above. 🔔

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Nov 9, 2017

Contributor

@bors r+

Contributor

nikomatsakis commented Nov 9, 2017

@bors r+

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 9, 2017

Contributor

📌 Commit 7995f87 has been approved by nikomatsakis

Contributor

bors commented Nov 9, 2017

📌 Commit 7995f87 has been approved by nikomatsakis

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Nov 9, 2017

Contributor

@bors r-

Contributor

nikomatsakis commented Nov 9, 2017

@bors r-

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Nov 9, 2017

Contributor

Guess I should show some decorum and wait a bit for FCP.

Contributor

nikomatsakis commented Nov 9, 2017

Guess I should show some decorum and wait a bit for FCP.

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Nov 10, 2017

Contributor

@bors r+

I'm impatient. We can always back it out if something dramatic comes up.

Contributor

nikomatsakis commented Nov 10, 2017

@bors r+

I'm impatient. We can always back it out if something dramatic comes up.

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 10, 2017

Contributor

📌 Commit 7995f87 has been approved by nikomatsakis

Contributor

bors commented Nov 10, 2017

📌 Commit 7995f87 has been approved by nikomatsakis

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 11, 2017

Contributor

⌛️ Testing commit 7995f87 with merge e337312...

Contributor

bors commented Nov 11, 2017

⌛️ Testing commit 7995f87 with merge e337312...

bors added a commit that referenced this pull request Nov 11, 2017

Auto merge of #45772 - leodasvacas:fix-auto-bounds-in-trait-objects, …
…r=nikomatsakis

Fix checking of auto trait bounds in trait objects.

Any auto trait is allowed in trait object bounds. Fix duplicate check of type and lifetime parameter count, which we were [emitting twice](https://play.rust-lang.org/?gist=37dbbdbbec62dec423bb8f6d92f137cc&version=stable).

Note: This was the last use of `Send` in the compiler, meaning after a new `stage0` we could remove the `send` lang item.
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 11, 2017

Contributor

💔 Test failed - status-travis

Contributor

bors commented Nov 11, 2017

💔 Test failed - status-travis

@kennytm

This comment has been minimized.

Show comment
Hide comment
@kennytm

kennytm Nov 11, 2017

Member

@bors retry

[01:13:14] test process::tests::test_process_output_fail_to_start has been running for over 60 seconds


No output has been received in the last 30m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received

The build has been terminated
Member

kennytm commented Nov 11, 2017

@bors retry

[01:13:14] test process::tests::test_process_output_fail_to_start has been running for over 60 seconds


No output has been received in the last 30m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received

The build has been terminated
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 11, 2017

Contributor

⌛️ Testing commit 7995f87 with merge e528c7e...

Contributor

bors commented Nov 11, 2017

⌛️ Testing commit 7995f87 with merge e528c7e...

bors added a commit that referenced this pull request Nov 11, 2017

Auto merge of #45772 - leodasvacas:fix-auto-bounds-in-trait-objects, …
…r=nikomatsakis

Fix checking of auto trait bounds in trait objects.

Any auto trait is allowed in trait object bounds. Fix duplicate check of type and lifetime parameter count, which we were [emitting twice](https://play.rust-lang.org/?gist=37dbbdbbec62dec423bb8f6d92f137cc&version=stable).

Note: This was the last use of `Send` in the compiler, meaning after a new `stage0` we could remove the `send` lang item.
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 11, 2017

Contributor

💔 Test failed - status-travis

Contributor

bors commented Nov 11, 2017

💔 Test failed - status-travis

@kennytm

This comment has been minimized.

Show comment
Hide comment
@kennytm

kennytm Nov 11, 2017

Member

@bors retry

dist-arm-linux 3-hour timed out?

Member

kennytm commented Nov 11, 2017

@bors retry

dist-arm-linux 3-hour timed out?

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 11, 2017

Contributor

⌛️ Testing commit 7995f87 with merge 69ee5a8...

Contributor

bors commented Nov 11, 2017

⌛️ Testing commit 7995f87 with merge 69ee5a8...

bors added a commit that referenced this pull request Nov 11, 2017

Auto merge of #45772 - leodasvacas:fix-auto-bounds-in-trait-objects, …
…r=nikomatsakis

Fix checking of auto trait bounds in trait objects.

Any auto trait is allowed in trait object bounds. Fix duplicate check of type and lifetime parameter count, which we were [emitting twice](https://play.rust-lang.org/?gist=37dbbdbbec62dec423bb8f6d92f137cc&version=stable).

Note: This was the last use of `Send` in the compiler, meaning after a new `stage0` we could remove the `send` lang item.
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Nov 11, 2017

Contributor

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 69ee5a8 to master...

Contributor

bors commented Nov 11, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 69ee5a8 to master...

@bors bors merged commit 7995f87 into rust-lang:master Nov 11, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@gbutler69

This comment has been minimized.

Show comment
Hide comment
@gbutler69

gbutler69 Nov 13, 2017

Is there an RFC or other document explaining this change? Redox OS has a private fork of rust-lang/rust (for now) and I had to manually update libcore/marker.rs to remove the "send" attribute in order to build Redox OS on the latest nightly. I'd like to add some backing for this decision in the issue I submitted to the Redox people to ensure a proper chain of reasons why changes are being made (if possible). Thanks in advance.

gbutler69 commented on 7995f87 Nov 13, 2017

Is there an RFC or other document explaining this change? Redox OS has a private fork of rust-lang/rust (for now) and I had to manually update libcore/marker.rs to remove the "send" attribute in order to build Redox OS on the latest nightly. I'd like to add some backing for this decision in the issue I submitted to the Redox people to ensure a proper chain of reasons why changes are being made (if possible). Thanks in advance.

This comment has been minimized.

Show comment
Hide comment
@jonas-schievink

jonas-schievink Nov 13, 2017

Contributor

Language items are completely unstable and no RFC is required for modifying, adding, or removing them

Contributor

jonas-schievink replied Nov 13, 2017

Language items are completely unstable and no RFC is required for modifying, adding, or removing them

@leodasvacas

This comment has been minimized.

Show comment
Hide comment
@leodasvacas

leodasvacas Nov 13, 2017

Contributor

@gbutler69 It was removed because it was no longer in use. Keeping lang items to a minimal is good.

Contributor

leodasvacas commented Nov 13, 2017

@gbutler69 It was removed because it was no longer in use. Keeping lang items to a minimal is good.

@leodasvacas leodasvacas deleted the leodasvacas:fix-auto-bounds-in-trait-objects branch Nov 17, 2017

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