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

Take supertraits into account when calculating associated types #55687

Merged
merged 5 commits into from
Nov 11, 2018

Conversation

alexreg
Copy link
Contributor

@alexreg alexreg commented Nov 5, 2018

Fixes #24010 and #23856. Applies to trait aliases too.

As a by-product, this PR also makes repeated bindings of the same associated item in the same definition a hard error. This was previously a warning with a note about it becoming a hard error in the future. See #50589 for more info.

I talked about this with @nikomatsakis recently, but only very superficially, so this shouldn't stop anyone from assigning it to themself to review and r+.

N.B. The "WIP" commits represent imperfect attempts to solve the problem just for trait objects, but I've left them in for reference for the sake of whomever is reviewing this.

CC @carllerche @theemathas @durka @mbrubeck

@rust-highfive

This comment has been minimized.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 5, 2018
@alexreg
Copy link
Contributor Author

alexreg commented Nov 5, 2018

r? @nikomatsakis

(If someone else would rather take it, feel free to r? yourself, per above.)

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Nov 5, 2018
@rust-highfive

This comment has been minimized.

@pietroalbini
Copy link
Member

@craterbot run start=6cfc6033955dd2685dfa7baeec6f6bc3bfdfe2f1 end=6cfc6033955dd2685dfa7baeec6f6bc3bfdfe2f1+rustflags=-Dduplicate_associated_type_bindings mode=check-only

@craterbot
Copy link
Collaborator

👌 Experiment pr-55687 created and queued.
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 5, 2018
@craterbot
Copy link
Collaborator

🚧 Experiment pr-55687 is now running on agent aws-1.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@rust-highfive

This comment has been minimized.

Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

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

First pass, will review in detail when back on a pc

src/test/run-pass/traits/trait-alias-objects.rs Outdated Show resolved Hide resolved
src/librustc_typeck/astconv.rs Outdated Show resolved Hide resolved
src/librustc_typeck/astconv.rs Outdated Show resolved Hide resolved
@pietroalbini
Copy link
Member

Uh, woops.

@craterbot abort

@craterbot
Copy link
Collaborator

🗑️ Experiment pr-55687 deleted!

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Nov 6, 2018
@pietroalbini
Copy link
Member

Wrong commit hash...

@craterbot run start=24e66c28980442a48d9458f1a4f9b76cc722dc8a end=24e66c28980442a48d9458f1a4f9b76cc722dc8a+rustflags=-Dduplicate_associated_type_bindings mode=check-only

@craterbot
Copy link
Collaborator

👌 Experiment pr-55687 created and queued.
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 6, 2018
@craterbot
Copy link
Collaborator

🚧 Experiment pr-55687 is now running on agent aws-1.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@pietroalbini
Copy link
Member

@craterbot abort

@craterbot
Copy link
Collaborator

🗑️ Experiment pr-55687 deleted!

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Nov 6, 2018
@pietroalbini
Copy link
Member

...forgot this is not my local branch...

@craterbot run start=master#24e66c28980442a48d9458f1a4f9b76cc722dc8a end=master#24e66c28980442a48d9458f1a4f9b76cc722dc8a+rustflags=-Dduplicate_associated_type_bindings mode=check-only

@craterbot
Copy link
Collaborator

👌 Experiment pr-55687 created and queued.
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@rust-highfive rust-highfive assigned scalexm and unassigned nikomatsakis Nov 7, 2018
@nikomatsakis
Copy link
Contributor

Seems like @scalexm is on this? =)

@alexreg alexreg force-pushed the fix-24010 branch 2 times, most recently from 92ac02a to 19d71f2 Compare November 7, 2018 18:06
@rust-highfive

This comment has been minimized.

@craterbot
Copy link
Collaborator

🎉 Experiment pr-55687 is completed!
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Nov 7, 2018
@alexreg alexreg force-pushed the fix-24010 branch 2 times, most recently from 5825653 to 4c1d24a Compare November 7, 2018 21:51
@scalexm
Copy link
Member

scalexm commented Nov 7, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Nov 7, 2018

📌 Commit 90a1438 has been approved by scalexm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 7, 2018
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Nov 10, 2018
Take supertraits into account when calculating associated types

Fixes rust-lang#24010 and rust-lang#23856. Applies to trait aliases too.

As a by-product, this PR also makes repeated bindings of the same associated item in the same definition a hard error. This was previously a warning with a note about it becoming a hard error in the future. See rust-lang#50589 for more info.

I talked about this with @nikomatsakis recently, but only very superficially, so this shouldn't stop anyone from assigning it to themself to review and r+.

N.B. The "WIP" commits represent imperfect attempts to solve the problem just for trait objects, but I've left them in for reference for the sake of whomever is reviewing this.

CC @carllerche @theemathas @durka @mbrubeck
bors added a commit that referenced this pull request Nov 11, 2018
Rollup of 17 pull requests

Successful merges:

 - #55630 (resolve: Filter away macro prelude in modules with `#[no_implicit_prelude]` on 2018 edition)
 - #55687 (Take supertraits into account when calculating associated types)
 - #55745 (Convert `outlives_components`' return value to a `SmallVec` outparam.)
 - #55764 (Fix Rc/Arc allocation layout)
 - #55792 (Prevent ICE in const-prop array oob check)
 - #55799 (Removed unneeded instance of `// revisions` from a lint test)
 - #55800 (Fix ICE in `return_type_impl_trait`)
 - #55801 (NLL: Update box insensitivity test)
 - #55802 (Don't inline virtual calls (take 2))
 - #55816 (Use `SmallVec` to avoid allocations in `from_decimal_string`.)
 - #55819 (Typecheck patterns of all match arms first, so we get types for bindings)
 - #55822 (ICE with #![feature(nll)] and elided lifetimes)
 - #55828 (Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value`)
 - #55839 (Fix docstring spelling mistakes)
 - #55844 (Fix documentation typos.)
 - #55845 (Set BINARYEN_TRAP_MODE=clamp)
 - #55856 (rustdoc: refactor: move all static-file include!s into a single module)
@bors bors merged commit 90a1438 into rust-lang:master Nov 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
9 participants