librustc: Implement the fully-expanded, UFCS form of explicit self.
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 #13885. This does not remove `~self` from the language yet, however. [breaking-change]
This commit is contained in:
parent
459ffc2adc
commit
357d5cd96c
25 changed files with 633 additions and 157 deletions
|
@ -949,12 +949,14 @@ pub enum RetStyle {
|
|||
pub enum ExplicitSelf_ {
|
||||
/// No self
|
||||
SelfStatic,
|
||||
/// `self
|
||||
/// `self`
|
||||
SelfValue(Ident),
|
||||
/// `&'lt self`, `&'lt mut self`
|
||||
SelfRegion(Option<Lifetime>, Mutability, Ident),
|
||||
/// `~self`
|
||||
SelfUniq(Ident)
|
||||
SelfUniq(Ident),
|
||||
/// `self: TYPE`
|
||||
SelfExplicit(P<Ty>, Ident),
|
||||
}
|
||||
|
||||
pub type ExplicitSelf = Spanned<ExplicitSelf_>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue