aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/yellow
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-27 08:01:31 +0100
committerAleksey Kladov <[email protected]>2018-08-27 08:01:31 +0100
commit8b0298ce095b6dd635f7ed35dc97f1874157040b (patch)
tree3d6f941f7612ba1800c1e2f9fbb0a94761999be7 /crates/libsyntax2/src/yellow
parent9b69c7df194d5f9081698745ed20414d7c7c2f1c (diff)
scopes
Diffstat (limited to 'crates/libsyntax2/src/yellow')
-rw-r--r--crates/libsyntax2/src/yellow/mod.rs2
-rw-r--r--crates/libsyntax2/src/yellow/syntax.rs10
2 files changed, 10 insertions, 2 deletions
diff --git a/crates/libsyntax2/src/yellow/mod.rs b/crates/libsyntax2/src/yellow/mod.rs
index 3c4510fe7..b94c794fe 100644
--- a/crates/libsyntax2/src/yellow/mod.rs
+++ b/crates/libsyntax2/src/yellow/mod.rs
@@ -66,7 +66,7 @@ impl SyntaxRoot {
66 } 66 }
67} 67}
68 68
69#[derive(Clone, Copy, PartialEq, Eq, Debug)] 69#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
70pub(crate) struct RedPtr(ptr::NonNull<RedNode>); 70pub(crate) struct RedPtr(ptr::NonNull<RedNode>);
71 71
72unsafe impl Send for RedPtr {} 72unsafe impl Send for RedPtr {}
diff --git a/crates/libsyntax2/src/yellow/syntax.rs b/crates/libsyntax2/src/yellow/syntax.rs
index 0045598d4..75b6cb7dc 100644
--- a/crates/libsyntax2/src/yellow/syntax.rs
+++ b/crates/libsyntax2/src/yellow/syntax.rs
@@ -1,4 +1,7 @@
1use std::{fmt, sync::Arc}; 1use std::{
2 fmt, sync::Arc,
3 hash::{Hasher, Hash},
4};
2 5
3use smol_str::SmolStr; 6use smol_str::SmolStr;
4 7
@@ -27,6 +30,11 @@ impl<R1: TreeRoot, R2: TreeRoot> PartialEq<SyntaxNode<R1>> for SyntaxNode<R2> {
27} 30}
28 31
29impl<R: TreeRoot> Eq for SyntaxNode<R> {} 32impl<R: TreeRoot> Eq for SyntaxNode<R> {}
33impl<R: TreeRoot> Hash for SyntaxNode<R> {
34 fn hash<H: Hasher>(&self, state: &mut H) {
35 self.red.hash(state)
36 }
37}
30 38
31pub type SyntaxNodeRef<'a> = SyntaxNode<RefRoot<'a>>; 39pub type SyntaxNodeRef<'a> = SyntaxNode<RefRoot<'a>>;
32 40