-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
librustc: Implement the fully-expanded, UFCS form of explicit self. #14022
Conversation
I will (and want to) review this, but probably not till Monday (other things in the meantime). That said, I have some concerns about the syntax we agreed upon, and I want to revisit it. Specifically, I think we should make it:
The reason being that this will be fully parsable and avoids all ambiguities. For example, one can write |
OK, so, I think this patch is pretty OK, modulo the concern about running region inference. Probably doesn't make sense to try and do anything more invasive (i.e., supporting arbitrary types), since I'm in the process of implementing #5527 which will permit that. |
@nikomatsakis Does that mean r+? :) |
@pcwalton seems like we should run region inference, if we're going to be checking the expected types. All that means is calling |
ping @pcwalton, any progress on this? |
Will get to it after these couple of other P-backcompat-lang issues I'm working on. |
@nikomatsakis We can't unify types with regions in them because we don't know the variance of the regions yet during astconv. Boo. I'm not sure how to solve that problem. :( |
Updated with a solution for the issue that @nikomatsakis brought up. r? @pnkfelix |
This is a prerequisite to fixing #15517. |
} | ||
|
||
impl<'a,'b> Foo<'a,'b> { | ||
// The number of errors is related to the way invariance works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm. I wonder if we should try to address that in some way. I'll file a ticket.
This makes two changes to region inference: (1) it allows region inference to relate early-bound regions; and (2) it allows regions to be related before variance runs. The former is needed because there is no relation between the two regions before region substitution happens, while the latter is needed because type collection has to run before variance. We assume that, before variance is inferred, that lifetimes are invariant. This is a conservative overapproximation. This relates to rust-lang#13885. This does not remove `~self` from the language yet, however. [breaking-change]
It'll be complex to port to the new explicit-self regime and it seems to be unused.
remove `~self` from the test suite.
r? @nikomatsakis