diff --git a/src/lib.rs b/src/lib.rs index 8aacabd..db6a718 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -419,7 +419,7 @@ pub use crate::kind::Kind; pub use crate::loc::{BareSourceLocation, IncludedFrom, SourceLocation, SourceRange}; /// syntax tree root -#[derive(Debug)] +#[derive(Clone, Eq, PartialEq, Hash, Debug)] pub struct Node { pub id: Id, pub kind: T, diff --git a/src/loc.rs b/src/loc.rs index 7ede7d4..3377faa 100644 --- a/src/loc.rs +++ b/src/loc.rs @@ -5,19 +5,19 @@ use std::cell::{Cell, RefCell}; use std::fmt::{self, Debug}; use std::sync::Arc; -#[derive(Default)] +#[derive(Default, Clone, Eq, PartialEq, Hash)] pub struct SourceRange { pub begin: SourceLocation, pub end: SourceLocation, } -#[derive(Default)] +#[derive(Default, Clone, Eq, PartialEq, Hash)] pub struct SourceLocation { pub spelling_loc: Option, pub expansion_loc: Option, } -#[derive(Clone, Debug)] +#[derive(Clone, Eq, PartialEq, Hash, Debug)] pub struct BareSourceLocation { pub offset: usize, pub file: Arc, @@ -30,7 +30,7 @@ pub struct BareSourceLocation { pub is_macro_arg_expansion: bool, } -#[derive(Clone, Debug)] +#[derive(Clone, Eq, PartialEq, Hash, Debug)] pub struct IncludedFrom { pub included_from: Option>, pub file: Arc,