Skip to content

Commit 7f09083

Browse files
committed
Handle tuple fields as well
1 parent 14ea216 commit 7f09083

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

crates/ra_hir/src/semantics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ to_def_impls![
268268
(crate::Static, ast::StaticDef, static_to_def),
269269
(crate::Function, ast::FnDef, fn_to_def),
270270
(crate::StructField, ast::RecordFieldDef, record_field_to_def),
271+
(crate::StructField, ast::TupleFieldDef, tuple_field_to_def),
271272
(crate::EnumVariant, ast::EnumVariant, enum_variant_to_def),
272273
(crate::TypeParam, ast::TypeParam, type_param_to_def),
273274
(crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros

crates/ra_hir/src/semantics/source_to_def.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,18 @@ impl<DB: HirDatabase> SourceToDefCtx<'_, &'_ DB> {
9494
) -> Option<TypeAliasId> {
9595
self.to_def(src, keys::TYPE_ALIAS)
9696
}
97-
//TODO: tuple field
9897
pub(super) fn record_field_to_def(
9998
&mut self,
10099
src: InFile<ast::RecordFieldDef>,
101100
) -> Option<StructFieldId> {
102101
self.to_def(src, keys::RECORD_FIELD)
103102
}
103+
pub(super) fn tuple_field_to_def(
104+
&mut self,
105+
src: InFile<ast::TupleFieldDef>,
106+
) -> Option<StructFieldId> {
107+
self.to_def(src, keys::TUPLE_FIELD)
108+
}
104109
pub(super) fn enum_variant_to_def(
105110
&mut self,
106111
src: InFile<ast::EnumVariant>,

0 commit comments

Comments
 (0)