From b9c0c2abb79769852119dc9a595e63ee74eeba03 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 20 Apr 2019 12:34:36 +0200 Subject: Chalk integration - add proper canonicalization logic - add conversions from/to Chalk IR --- crates/ra_hir/src/generics.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src/generics.rs') diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs index 1c71e21ea..2e52c5871 100644 --- a/crates/ra_hir/src/generics.rs +++ b/crates/ra_hir/src/generics.rs @@ -9,7 +9,7 @@ use ra_syntax::ast::{self, NameOwner, TypeParamsOwner, TypeBoundsOwner}; use crate::{ db::DefDatabase, - Name, AsName, Function, Struct, Enum, Trait, TypeAlias, ImplBlock, Container, path::Path, type_ref::TypeRef + Name, AsName, Function, Struct, Enum, Trait, TypeAlias, ImplBlock, Container, path::Path, type_ref::TypeRef, AdtDef }; /// Data about a generic parameter (to a function, struct, impl, ...). @@ -157,6 +157,15 @@ impl From for GenericDef { } } +impl From for GenericDef { + fn from(adt: crate::adt::AdtDef) -> Self { + match adt { + AdtDef::Struct(s) => s.into(), + AdtDef::Enum(e) => e.into(), + } + } +} + pub trait HasGenericParams { fn generic_params(self, db: &impl DefDatabase) -> Arc; } -- cgit v1.2.3