-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 associated items #17307
Comments
there is debate about whether this contains P-backcompat-lang issues for 1.0, or if the 1.0 issues are solely P-backcompat-libs. Leaving as I-nominated so that people can take a week teasing apart the sub-issues that stem from the RFC. |
leaving I-nominated for anohter week again! assigning to myself to spawn off subissues. |
punting for another week... |
@pnkfelix Want to coordinate this work this week? I want to do an evaluation of how much of associated items has landed in terms of what we need for the libraries, and that could help inform the division into subissues/nominations. Let me know. |
@aturon sure, happy to coordinate. I'm going to actually look at it now; I will either open subissues directly, or, if I do not feel comfortable doing so, then I'll email you with my findings. |
Okay I think I've opened all the subbugs I can think of, and my spreadsheet (google doc) at least represents a hackish sketch of what might need to do be done (though I did not look at Anyway, if this sits idle until the next triage meeting, my official recommendation is that we nominate one or more of the tickets that I opened that point to this ticket, and then we remove the nomination from this ticket (since it is a metabug, quite literally now). |
@pnkfelix Thanks for doing this! One further issue: right now, associated types are (largely) working, and multidispatch is on the way. But associated constants, lifetimes and inherent items are not implemented. We may want to break those into further issues, so we can triage each part separately. For example, I don't think associated constants need to be 1.0 (we can work around it reasonably in the libraries), but associated lifetimes probably are (because we intend not to allow lifetimes as "input" parameters on a trait, but you need some way to talk about them.) |
@pnkfelix The new issues appear to focus on rolling out the features for the libraries, but don't mention actually implementing them :-) but probably they can be triaged together? |
@aturon oh yes I see; you are right, we still need issues for the language changes themselves. But the triage can focus on the library back-compat and stabilization issues, right? That was driving my focus |
@pnkfelix Yep, sounds fine -- and honestly, those issues can probably cover both the implementation and the library work, since the two go hand-in-hand. |
removing i-nominated tag. yay |
Implement multidispatch and conditional dispatch. Because we do not attempt to preserve crate concatenation, this is a backwards compatible change. This is not yet fully integrated into method dispatch, so "UFCS"-style wrappers must be used to take advantage of the new features (see the run-pass tests). cc #17307 (multidispatch) cc #5527 (trait reform -- conditional dispatch) Because we no longer preserve crate concatenability, this deviates slightly from what was specified in the RFC. The motivation for this change is described in [this blog post](http://smallcultfollowing.com/babysteps/blog/2014/09/30/multi-and-conditional-dispatch-in-traits/). I will post an amendment to the RFC in due course but do not anticipate great controversy on this point -- particularly as the RFCs more important features (e.g., conditional dispatch) just don't work without the change.
I have been working on this a little. I am going to repurpose this issue to mean specifically bounds that are not builtin types, since builtin type bounds are covered by #17921 |
Should there be a work item for defaults for associated types? (I think this is in the RFC) |
@nick29581 I added it to the list, but didn't create an issue yet. |
#19129 (ICE implementing trait with generic parameter and associated type) should be on this list. Unfortunately it prevents the fix for #17388 from really helping much; even though some of the previously affected traits now compile, you can't actually implement any functions associated with those traits. |
@quantheory Added, thanks! |
Adding |
Meta-note: the top-level comment includes all bugs listed so far that have not yet been fixed. |
Found a possible bug wrt to traits which have types which are Deref: #20502 |
cc me |
I updated the list in this issue. A lot of items are done now! |
Has #8995 been lost from this list somehow? |
This has basically all long since been implemented, so closing. |
This isn't implemented yet: #8995 |
I tried to write a Subgraph struct that implements the graph traits (backed by any graph implementation) but got stuck because of lifetimes. This changes allowed me to make some progress. May be it can be simplified with associated lifetimes. See rust-lang/rust#17307.
What happened to associated const bounds as in the following? An omission perhaps? trait Foo {
const Bar: usize;
}
fn baz<T: Foo<Bar = 1>>() {} |
Tracking issue for rust-lang/rfcs#195
This meta-bug contains links to the most significant tasks remaining for associated items. For a comprehensive listing of bugs, please search using the A-associated-items label.
Post 1.0 Tasks
Completed Tasks
Trait<Out=Type>
syntax (Support theTrait<Output=Type>
syntax #18432)T::Type
syntax (SupportT::Type
shorthand for referencing associated types #18433)T::Foo
resolution to use where clauses, not bounds #20300)Declined tasks
Permit unqualified references to associated types of the trait within the trait definition (Permit unqualified references to associated types of the trait within the trait definition #18764)Update library code for associated lifetimes (see Issue identify traits in libstd that should use associated lifetimes #17828),The text was updated successfully, but these errors were encountered: