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

Implement trait aliases (RFC 1733) #55101

Merged
merged 10 commits into from Nov 3, 2018
Merged

Conversation

alexreg
Copy link
Contributor

@alexreg alexreg commented Oct 15, 2018

Extends groundwork done in #45047, and fully implements rust-lang/rfcs#1733.

CC @durka @nikomatsakis

@rust-highfive
Copy link
Collaborator

r? @zackmdavis

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 15, 2018
@rust-highfive

This comment has been minimized.

@petrochenkov petrochenkov self-assigned this Oct 15, 2018
@alexreg
Copy link
Contributor Author

alexreg commented Oct 15, 2018

@petrochenkov Don't even bother reviewing yet. A lot of work to go. I'll let you know when things are at a decent stage. :-) I think @nikomatsakis is going to comment with some more guidance shortly.

@zackmdavis zackmdavis removed their assignment Oct 15, 2018
src/librustc/traits/select.rs Show resolved Hide resolved
src/librustc/traits/select.rs Outdated Show resolved Hide resolved
src/librustc/ty/mod.rs Outdated Show resolved Hide resolved
@@ -2977,7 +2988,7 @@ fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
.map(|id| tcx.hir.local_def_id(id.node_id))
.collect()
}
hir::ItemKind::TraitAlias(..) => vec![],
hir::ItemKind::TraitAlias(..) => todo,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should just return vec!. Trait aliases do not define any associated items themselves. The associated item resolution code does have a notion of walking the superpredicates when doing lookups, I would think we should build on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense.

src/libsyntax/feature_gate.rs Show resolved Hide resolved
src/librustc/traits/select.rs Show resolved Hide resolved
@nikomatsakis nikomatsakis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 16, 2018
@alexreg
Copy link
Contributor Author

alexreg commented Oct 16, 2018

@nikomatsakis Okay, I'm making decent headway now I think. Any advice on writing confirm_trait_alias_candidate in traits/project.rs, or the VtableTraitAlias arm for resolve_associated_item in ty/instance.rs? I'm presuming they should behave somewhat similar to for the VtableImpl case, but some of the code is very tied down to VtableImpl and VtableImplData it seems...

@rust-highfive

This comment has been minimized.

@alexreg
Copy link
Contributor Author

alexreg commented Oct 18, 2018

@nikomatsakis Great. I’ll fix that quickly, but it’s basically already working fine. Any advice on trait objects? :-)

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@alexreg alexreg force-pushed the trait-aliases branch 2 times, most recently from db6052d to 81b3a6e Compare October 19, 2018 02:30
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@alexreg alexreg changed the title [WIP] Implement trait aliases Implement trait aliases Oct 22, 2018
@alexreg alexreg changed the title Implement trait aliases Implement trait aliases (RFC 1733) Oct 22, 2018
@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 2, 2018
@pietroalbini
Copy link
Member

@bors retry r-

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 2, 2018
@pietroalbini pietroalbini added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 2, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Nov 3, 2018

@bors r=nikomatsakis

this was correct all along, some RUST_LOG debugging on @alexreg's side caused the failure they were seeing

@bors
Copy link
Contributor

bors commented Nov 3, 2018

📌 Commit 4171685 has been approved by nikomatsakis

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 3, 2018
@bors
Copy link
Contributor

bors commented Nov 3, 2018

⌛ Testing commit 4171685 with merge a3f0f51...

bors added a commit that referenced this pull request Nov 3, 2018
Implement trait aliases (RFC 1733)

Extends groundwork done in #45047, and fully implements rust-lang/rfcs#1733.

CC @durka @nikomatsakis
@bors
Copy link
Contributor

bors commented Nov 3, 2018

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

@bors bors merged commit 4171685 into rust-lang:master Nov 3, 2018
@alexreg alexreg deleted the trait-aliases branch November 4, 2018 19:27
@alexreg alexreg added A-traits Area: Trait system F-trait_alias `#![feature(trait_alias)]` labels Nov 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system F-trait_alias `#![feature(trait_alias)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants