diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-30 17:29:24 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-30 17:29:24 +0100 |
commit | 0f5805541be90a2789b0bc34c5d829042ac3b0ad (patch) | |
tree | 27effc491f45f7bd907cb0b24a5b0d907298d169 /crates/ra_hir | |
parent | c8e2d67dd4462904f2803d64c651f4630ee595f4 (diff) | |
parent | c5798c4d75aa807aec47208a49101bdec3affcca (diff) |
Merge #5606
5606: Finalize impl Grammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/has_source.rs | 10 | ||||
-rw-r--r-- | crates/ra_hir/src/semantics.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/semantics/source_to_def.rs | 12 |
3 files changed, 13 insertions, 13 deletions
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs index 9581552e5..1c691d961 100644 --- a/crates/ra_hir/src/has_source.rs +++ b/crates/ra_hir/src/has_source.rs | |||
@@ -99,8 +99,8 @@ impl HasSource for Static { | |||
99 | } | 99 | } |
100 | } | 100 | } |
101 | impl HasSource for Trait { | 101 | impl HasSource for Trait { |
102 | type Ast = ast::TraitDef; | 102 | type Ast = ast::Trait; |
103 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::TraitDef> { | 103 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Trait> { |
104 | self.id.lookup(db.upcast()).source(db.upcast()) | 104 | self.id.lookup(db.upcast()).source(db.upcast()) |
105 | } | 105 | } |
106 | } | 106 | } |
@@ -120,14 +120,14 @@ impl HasSource for MacroDef { | |||
120 | } | 120 | } |
121 | } | 121 | } |
122 | impl HasSource for ImplDef { | 122 | impl HasSource for ImplDef { |
123 | type Ast = ast::ImplDef; | 123 | type Ast = ast::Impl; |
124 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::ImplDef> { | 124 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Impl> { |
125 | self.id.lookup(db.upcast()).source(db.upcast()) | 125 | self.id.lookup(db.upcast()).source(db.upcast()) |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | impl HasSource for TypeParam { | 129 | impl HasSource for TypeParam { |
130 | type Ast = Either<ast::TraitDef, ast::TypeParam>; | 130 | type Ast = Either<ast::Trait, ast::TypeParam>; |
131 | fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> { | 131 | fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> { |
132 | let child_source = self.id.parent.child_source(db.upcast()); | 132 | let child_source = self.id.parent.child_source(db.upcast()); |
133 | child_source.map(|it| it[self.id.local_id].clone()) | 133 | child_source.map(|it| it[self.id.local_id].clone()) |
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 32a60b789..6f3b3dc9a 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -583,8 +583,8 @@ to_def_impls![ | |||
583 | (crate::Struct, ast::Struct, struct_to_def), | 583 | (crate::Struct, ast::Struct, struct_to_def), |
584 | (crate::Enum, ast::Enum, enum_to_def), | 584 | (crate::Enum, ast::Enum, enum_to_def), |
585 | (crate::Union, ast::Union, union_to_def), | 585 | (crate::Union, ast::Union, union_to_def), |
586 | (crate::Trait, ast::TraitDef, trait_to_def), | 586 | (crate::Trait, ast::Trait, trait_to_def), |
587 | (crate::ImplDef, ast::ImplDef, impl_to_def), | 587 | (crate::ImplDef, ast::Impl, impl_to_def), |
588 | (crate::TypeAlias, ast::TypeAlias, type_alias_to_def), | 588 | (crate::TypeAlias, ast::TypeAlias, type_alias_to_def), |
589 | (crate::Const, ast::Const, const_to_def), | 589 | (crate::Const, ast::Const, const_to_def), |
590 | (crate::Static, ast::Static, static_to_def), | 590 | (crate::Static, ast::Static, static_to_def), |
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs index 782a03f9e..d1994e2e7 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs | |||
@@ -65,10 +65,10 @@ impl SourceToDefCtx<'_, '_> { | |||
65 | Some(ModuleId { krate: parent_module.krate, local_id: child_id }) | 65 | Some(ModuleId { krate: parent_module.krate, local_id: child_id }) |
66 | } | 66 | } |
67 | 67 | ||
68 | pub(super) fn trait_to_def(&mut self, src: InFile<ast::TraitDef>) -> Option<TraitId> { | 68 | pub(super) fn trait_to_def(&mut self, src: InFile<ast::Trait>) -> Option<TraitId> { |
69 | self.to_def(src, keys::TRAIT) | 69 | self.to_def(src, keys::TRAIT) |
70 | } | 70 | } |
71 | pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplDef>) -> Option<ImplId> { | 71 | pub(super) fn impl_to_def(&mut self, src: InFile<ast::Impl>) -> Option<ImplId> { |
72 | self.to_def(src, keys::IMPL) | 72 | self.to_def(src, keys::IMPL) |
73 | } | 73 | } |
74 | pub(super) fn fn_to_def(&mut self, src: InFile<ast::Fn>) -> Option<FunctionId> { | 74 | pub(super) fn fn_to_def(&mut self, src: InFile<ast::Fn>) -> Option<FunctionId> { |
@@ -154,11 +154,11 @@ impl SourceToDefCtx<'_, '_> { | |||
154 | let def = self.module_to_def(container.with_value(it))?; | 154 | let def = self.module_to_def(container.with_value(it))?; |
155 | def.into() | 155 | def.into() |
156 | }, | 156 | }, |
157 | ast::TraitDef(it) => { | 157 | ast::Trait(it) => { |
158 | let def = self.trait_to_def(container.with_value(it))?; | 158 | let def = self.trait_to_def(container.with_value(it))?; |
159 | def.into() | 159 | def.into() |
160 | }, | 160 | }, |
161 | ast::ImplDef(it) => { | 161 | ast::Impl(it) => { |
162 | let def = self.impl_to_def(container.with_value(it))?; | 162 | let def = self.impl_to_def(container.with_value(it))?; |
163 | def.into() | 163 | def.into() |
164 | }, | 164 | }, |
@@ -207,9 +207,9 @@ impl SourceToDefCtx<'_, '_> { | |||
207 | ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), | 207 | ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), |
208 | ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(), | 208 | ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(), |
209 | ast::Enum(it) => self.enum_to_def(container.with_value(it))?.into(), | 209 | ast::Enum(it) => self.enum_to_def(container.with_value(it))?.into(), |
210 | ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), | 210 | ast::Trait(it) => self.trait_to_def(container.with_value(it))?.into(), |
211 | ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), | 211 | ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), |
212 | ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), | 212 | ast::Impl(it) => self.impl_to_def(container.with_value(it))?.into(), |
213 | _ => continue, | 213 | _ => continue, |
214 | } | 214 | } |
215 | }; | 215 | }; |