Track lifetimes on rust name types
diff --git a/syntax/impls.rs b/syntax/impls.rs
index 4504fe6..8c16f2d 100644
--- a/syntax/impls.rs
+++ b/syntax/impls.rs
@@ -1,5 +1,5 @@
use crate::syntax::{
- Array, ExternFn, Impl, Include, Receiver, Ref, Signature, SliceRef, Ty1, Type, Var,
+ Array, ExternFn, Impl, Include, Lifetimes, Receiver, Ref, Signature, SliceRef, Ty1, Type, Var,
};
use std::borrow::Borrow;
use std::hash::{Hash, Hasher};
@@ -81,6 +81,38 @@
}
}
+impl Eq for Lifetimes {}
+
+impl PartialEq for Lifetimes {
+ fn eq(&self, other: &Lifetimes) -> bool {
+ let Lifetimes {
+ lt_token: _,
+ lifetimes,
+ gt_token: _,
+ } = self;
+ let Lifetimes {
+ lt_token: _,
+ lifetimes: lifetimes2,
+ gt_token: _,
+ } = other;
+ lifetimes.iter().eq(lifetimes2)
+ }
+}
+
+impl Hash for Lifetimes {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ let Lifetimes {
+ lt_token: _,
+ lifetimes,
+ gt_token: _,
+ } = self;
+ lifetimes.len().hash(state);
+ for lifetime in lifetimes {
+ lifetime.hash(state);
+ }
+ }
+}
+
impl Eq for Ty1 {}
impl PartialEq for Ty1 {