-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Elaborate predicates on associated types' associated types (and so on) #30704
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Hmm. I have to think about this more deeply. This may be the right way to go about things, but it does feel a bit frightening. |
I feel like if I knew more about how the compiler internals were organized (in particular, the semantics of The code in this PR is the product of only a few days of poking around the compiler and frankly isn't what I wanted to write. I wanted to be able to differentiate between the different notions of Being able to pluck out both major notions of I'd love to discuss it, though! EDIT: In this edit, in which I learn that |
Travis failure is for missing license boilerplate in the new test. |
@sanxiyn Yes - I'll tidy up preferably after making sure whatever approach ends up in the PR is okay. :-) |
cc me |
Maybe it'd be better if the expanded scope of elaboration happens only when the |
☔ The latest upstream changes (presumably #31304) made this pull request unmergeable. Please resolve the merge conflicts. |
This take is not the take to take, probably. |
This elaborates predicates of the form
<<<Self as S>::A as X>::B as Y>: Z
for traits with supertraitS
(and naturally the chain of projections can go on to the recursion limit).I don't know if the overall way I wrote this is koscher or not, so I've not tidied up yet. I've left a few comments in the code directed at reviewers (those will of course be cleaned up).
I would have liked to tackle predicates of the form
<Self as Super>::A: X
for traits with supertraits that are subtraits (wc?) ofSuper
, but after playing around with it I couldn't see how to do it.Specifically, given the following (where
-->
is the usual implication):I couldn't figure out how to prove
<<Self as A>::T as U>
whenever<Self as B>
, because it looks like obligations passed intolibrustc/middle/traits/select.rs
code only keep track of one notion ofSelf
(so when proving<<Self as A>::T as U>
:<Self as A>
is known and accessible but<Self as B>
is not accessible despite being known somewhere in the aether). I'd love for someone to tell me that I'm horribly wrong. :-DAll tests appear to be passing on my local machine, save for some
run-pass-valgrind
ones and onerun-pass
dealing with LTO, but those never passed on my machine to begin with so meh.cc #20671