From 216dc856c5b48de7d9cdbe6259b2d0cd3c4e5042 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 11 Feb 2021 19:52:33 +0100 Subject: Wrap `BuiltinType` in code model --- crates/hir/src/from_id.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'crates/hir/src/from_id.rs') diff --git a/crates/hir/src/from_id.rs b/crates/hir/src/from_id.rs index c8c5fecd7..b5814da11 100644 --- a/crates/hir/src/from_id.rs +++ b/crates/hir/src/from_id.rs @@ -11,8 +11,9 @@ use hir_def::{ }; use crate::{ - code_model::GenericParam, Adt, AssocItem, DefWithBody, Field, GenericDef, Label, Local, - MacroDef, ModuleDef, Variant, VariantDef, + code_model::{BuiltinType, GenericParam}, + Adt, AssocItem, DefWithBody, Field, GenericDef, Label, Local, MacroDef, ModuleDef, Variant, + VariantDef, }; macro_rules! from_id { @@ -111,7 +112,7 @@ impl From for ModuleDef { ModuleDefId::StaticId(it) => ModuleDef::Static(it.into()), ModuleDefId::TraitId(it) => ModuleDef::Trait(it.into()), ModuleDefId::TypeAliasId(it) => ModuleDef::TypeAlias(it.into()), - ModuleDefId::BuiltinType(it) => ModuleDef::BuiltinType(it), + ModuleDefId::BuiltinType(it) => ModuleDef::BuiltinType(it.into()), } } } @@ -127,7 +128,7 @@ impl From for ModuleDefId { ModuleDef::Static(it) => ModuleDefId::StaticId(it.into()), ModuleDef::Trait(it) => ModuleDefId::TraitId(it.into()), ModuleDef::TypeAlias(it) => ModuleDefId::TypeAliasId(it.into()), - ModuleDef::BuiltinType(it) => ModuleDefId::BuiltinType(it), + ModuleDef::BuiltinType(it) => ModuleDefId::BuiltinType(it.into()), } } } @@ -274,3 +275,15 @@ impl From for ItemInNs { } } } + +impl From for BuiltinType { + fn from(inner: hir_def::builtin_type::BuiltinType) -> Self { + Self { inner } + } +} + +impl From for hir_def::builtin_type::BuiltinType { + fn from(it: BuiltinType) -> Self { + it.inner + } +} -- cgit v1.2.3