From 3fe6f422f9ef13b9171dbeab0c5c427f729f9983 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 4 Jan 2019 16:15:50 +0300 Subject: remove id arena --- crates/ra_hir/src/arena.rs | 66 ---------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 crates/ra_hir/src/arena.rs (limited to 'crates/ra_hir/src/arena.rs') diff --git a/crates/ra_hir/src/arena.rs b/crates/ra_hir/src/arena.rs deleted file mode 100644 index d4f9d9cb9..000000000 --- a/crates/ra_hir/src/arena.rs +++ /dev/null @@ -1,66 +0,0 @@ -//! A simple id-based arena, similar to https://github.com/fitzgen/id-arena. -//! We use our own version for more compact id's and to allow inherent impls -//! on Ids. - -use std::{ - fmt, - hash::{Hash, Hasher}, - marker::PhantomData, -}; - -pub struct Id { - idx: u32, - _ty: PhantomData T>, -} - -impl fmt::Debug for Id { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("Id").field(&self.idx).finish() - } -} -impl Copy for Id {} -impl Clone for Id { - fn clone(&self) -> Id { - *self - } -} - -impl PartialEq for Id { - fn eq(&self, other: &Id) -> bool { - self.idx == other.idx - } -} - -impl Eq for Id {} - -impl Hash for Id { - fn hash(&self, h: &mut H) { - self.idx.hash(h); - } -} - -#[derive(Debug, PartialEq, Eq)] -pub(crate) struct ArenaBehavior { - _ty: PhantomData, -} - -impl id_arena::ArenaBehavior for ArenaBehavior { - type Id = Id; - fn new_arena_id() -> u32 { - 0 - } - fn new_id(_arena_id: u32, index: usize) -> Id { - Id { - idx: index as u32, - _ty: PhantomData, - } - } - fn index(id: Id) -> usize { - id.idx as usize - } - fn arena_id(_id: Id) -> u32 { - 0 - } -} - -pub(crate) type Arena = id_arena::Arena>; -- cgit v1.2.3