Parse pinned method receivers
diff --git a/syntax/impls.rs b/syntax/impls.rs
index 7efbc55..c345822 100644
--- a/syntax/impls.rs
+++ b/syntax/impls.rs
@@ -233,35 +233,45 @@
impl PartialEq for Receiver {
fn eq(&self, other: &Receiver) -> bool {
let Receiver {
+ pinned,
ampersand: _,
lifetime,
mutability,
var: _,
ty,
shorthand: _,
+ pin_tokens: _,
} = self;
let Receiver {
+ pinned: pinned2,
ampersand: _,
lifetime: lifetime2,
mutability: mutability2,
var: _,
ty: ty2,
shorthand: _,
+ pin_tokens: _,
} = other;
- lifetime == lifetime2 && mutability.is_some() == mutability2.is_some() && ty == ty2
+ pinned == pinned2
+ && lifetime == lifetime2
+ && mutability.is_some() == mutability2.is_some()
+ && ty == ty2
}
}
impl Hash for Receiver {
fn hash<H: Hasher>(&self, state: &mut H) {
let Receiver {
+ pinned,
ampersand: _,
lifetime,
mutability,
var: _,
ty,
shorthand: _,
+ pin_tokens: _,
} = self;
+ pinned.hash(state);
lifetime.hash(state);
mutability.is_some().hash(state);
ty.hash(state);
diff --git a/syntax/mod.rs b/syntax/mod.rs
index 72e815b..51068c9 100644
--- a/syntax/mod.rs
+++ b/syntax/mod.rs
@@ -134,12 +134,14 @@
}
pub struct Receiver {
+ pub pinned: bool,
pub ampersand: Token![&],
pub lifetime: Option<Lifetime>,
pub mutability: Option<Token![mut]>,
pub var: Token![self],
pub ty: ResolvableName,
pub shorthand: bool,
+ pub pin_tokens: Option<(kw::Pin, Token![<], Token![>])>,
}
pub struct Variant {
diff --git a/syntax/parse.rs b/syntax/parse.rs
index 23fadff..bbddaa7 100644
--- a/syntax/parse.rs
+++ b/syntax/parse.rs
@@ -388,12 +388,14 @@
FnArg::Receiver(arg) => {
if let Some((ampersand, lifetime)) = &arg.reference {
receiver = Some(Receiver {
+ pinned: false,
ampersand: *ampersand,
lifetime: lifetime.clone(),
mutability: arg.mutability,
var: arg.self_token,
ty: ResolvableName::make_self(arg.self_token.span),
shorthand: true,
+ pin_tokens: None,
});
continue;
}
@@ -418,12 +420,14 @@
if let Type::Ref(reference) = ty {
if let Type::Ident(ident) = reference.inner {
receiver = Some(Receiver {
+ pinned: reference.pinned,
ampersand: reference.ampersand,
lifetime: reference.lifetime,
mutability: reference.mutability,
var: Token),
ty: ident,
shorthand: false,
+ pin_tokens: reference.pin_tokens,
});
continue;
}