Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/has_source.rs')
| -rw-r--r-- | crates/hir/src/has_source.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs index f8b01db3e3..a28b2d577a 100644 --- a/crates/hir/src/has_source.rs +++ b/crates/hir/src/has_source.rs @@ -11,7 +11,7 @@ use syntax::ast; use crate::{ db::HirDatabase, Adt, Const, Enum, Field, FieldSource, Function, Impl, LifetimeParam, Macro, - Module, Static, Struct, Trait, TypeAlias, TypeOrConstParam, Union, Variant, + Module, Static, Struct, Trait, TraitAlias, TypeAlias, TypeOrConstParam, Union, Variant, }; pub trait HasSource { @@ -122,6 +122,12 @@ impl HasSource for Trait { Some(self.id.lookup(db.upcast()).source(db.upcast())) } } +impl HasSource for TraitAlias { + type Ast = ast::TraitAlias; + fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> { + Some(self.id.lookup(db.upcast()).source(db.upcast())) + } +} impl HasSource for TypeAlias { type Ast = ast::TypeAlias; fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> { @@ -158,7 +164,7 @@ impl HasSource for Impl { } impl HasSource for TypeOrConstParam { - type Ast = Either<ast::TypeOrConstParam, ast::Trait>; + type Ast = Either<ast::TypeOrConstParam, ast::TraitOrAlias>; fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> { let child_source = self.id.parent.child_source(db.upcast()); Some(child_source.map(|it| it[self.id.local_id].clone())) |