Represent Pin<P> in syntax tree
diff --git a/syntax/impls.rs b/syntax/impls.rs
index a4b393a..7efbc55 100644
--- a/syntax/impls.rs
+++ b/syntax/impls.rs
@@ -114,29 +114,39 @@
impl PartialEq for Ref {
fn eq(&self, other: &Ref) -> bool {
let Ref {
+ pinned,
ampersand: _,
lifetime,
mutability,
inner,
+ pin_tokens: _,
} = self;
let Ref {
+ pinned: pinned2,
ampersand: _,
lifetime: lifetime2,
mutability: mutability2,
inner: inner2,
+ pin_tokens: _,
} = other;
- lifetime == lifetime2 && mutability.is_some() == mutability2.is_some() && inner == inner2
+ pinned == pinned2
+ && lifetime == lifetime2
+ && mutability.is_some() == mutability2.is_some()
+ && inner == inner2
}
}
impl Hash for Ref {
fn hash<H: Hasher>(&self, state: &mut H) {
let Ref {
+ pinned,
ampersand: _,
lifetime,
mutability,
inner,
+ pin_tokens: _,
} = self;
+ pinned.hash(state);
lifetime.hash(state);
mutability.is_some().hash(state);
inner.hash(state);
diff --git a/syntax/mod.rs b/syntax/mod.rs
index 94c2cc8..72e815b 100644
--- a/syntax/mod.rs
+++ b/syntax/mod.rs
@@ -170,10 +170,12 @@
}
pub struct Ref {
+ pub pinned: bool,
pub ampersand: Token![&],
pub lifetime: Option<Lifetime>,
pub mutability: Option<Token![mut]>,
pub inner: Type,
+ pub pin_tokens: Option<(kw::Pin, Token![<], Token![>])>,
}
pub struct Slice {
diff --git a/syntax/parse.rs b/syntax/parse.rs
index a8a76d0..b275b5d 100644
--- a/syntax/parse.rs
+++ b/syntax/parse.rs
@@ -18,6 +18,7 @@
};
pub mod kw {
+ syn::custom_keyword!(Pin);
syn::custom_keyword!(Result);
}
@@ -625,10 +626,12 @@
_ => Type::Ref,
};
Ok(which(Box::new(Ref {
+ pinned: false,
ampersand: ty.and_token,
lifetime: ty.lifetime.clone(),
mutability: ty.mutability,
inner,
+ pin_tokens: None,
})))
}