From f7f398c9664dfbeabd8d25acbfcc255fdcca36c7 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 12 Feb 2023 11:20:53 -0800 Subject: [PATCH] Clone, Eq, PartialEq, Hash --- src/lib.rs | 2 +- src/loc.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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,