From 8b0298ce095b6dd635f7ed35dc97f1874157040b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 27 Aug 2018 10:01:31 +0300 Subject: scopes --- crates/libsyntax2/src/yellow/mod.rs | 2 +- crates/libsyntax2/src/yellow/syntax.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'crates/libsyntax2/src/yellow') 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 { } } -#[derive(Clone, Copy, PartialEq, Eq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] pub(crate) struct RedPtr(ptr::NonNull); unsafe 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 @@ -use std::{fmt, sync::Arc}; +use std::{ + fmt, sync::Arc, + hash::{Hasher, Hash}, +}; use smol_str::SmolStr; @@ -27,6 +30,11 @@ impl PartialEq> for SyntaxNode { } impl Eq for SyntaxNode {} +impl Hash for SyntaxNode { + fn hash(&self, state: &mut H) { + self.red.hash(state) + } +} pub type SyntaxNodeRef<'a> = SyntaxNode>; -- cgit v1.2.3