diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 2791149dd90..530fdf5cd87 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs @@ -15,6 +15,7 @@ pub struct HirInterner { macros: LocationIntener, fns: LocationIntener, structs: LocationIntener, + enums: LocationIntener, } impl HirInterner { @@ -213,6 +214,24 @@ pub(crate) fn id(&self, db: &impl AsRef) -> StructId { } } +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub struct EnumId(RawId); +impl_arena_id!(EnumId); + +pub(crate) type EnumLoc = ItemLoc; + +impl EnumId { + pub(crate) fn loc(self, db: &impl AsRef) -> EnumLoc { + db.as_ref().enums.id2loc(self) + } +} + +impl EnumLoc { + pub(crate) fn id(&self, db: &impl AsRef) -> EnumId { + db.as_ref().enums.loc2id(&self) + } +} + /// Def's are a core concept of hir. A `Def` is an Item (function, module, etc) /// in a specific module. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]