diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-06 15:27:34 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-06 15:27:34 +0100 |
commit | ef782adc293deb287128f005dbab2038ba3ccdc1 (patch) | |
tree | 6e451b71b482e75a5a30548ab8f769c5ec17864c /crates/ra_hir/src/code_model_api.rs | |
parent | 32db5884ada59c72aa7ab9f88910ef7c8f882e7d (diff) | |
parent | 12f8472d2800b2d7c05cb1fc466c80072ed8e283 (diff) |
Merge #1163
1163: fill struct fields diagnostic r=matklad a=pasa
implementation of #1095
Co-authored-by: Sergey Parilin <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/code_model_api.rs')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 9dcae50a5..55e1793c5 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -8,7 +8,7 @@ use crate::{ | |||
8 | HirDatabase, DefDatabase, | 8 | HirDatabase, DefDatabase, |
9 | type_ref::TypeRef, | 9 | type_ref::TypeRef, |
10 | nameres::{ModuleScope, Namespace, ImportId, CrateModuleId}, | 10 | nameres::{ModuleScope, Namespace, ImportId, CrateModuleId}, |
11 | expr::{Body, BodySourceMap}, | 11 | expr::{Body, BodySourceMap, validation::ExprValidator}, |
12 | ty::{ TraitRef, InferenceResult}, | 12 | ty::{ TraitRef, InferenceResult}, |
13 | adt::{EnumVariantId, StructFieldId, VariantDef}, | 13 | adt::{EnumVariantId, StructFieldId, VariantDef}, |
14 | generics::HasGenericParams, | 14 | generics::HasGenericParams, |
@@ -16,7 +16,7 @@ use crate::{ | |||
16 | ids::{FunctionId, StructId, EnumId, AstItemDef, ConstId, StaticId, TraitId, TypeAliasId}, | 16 | ids::{FunctionId, StructId, EnumId, AstItemDef, ConstId, StaticId, TraitId, TypeAliasId}, |
17 | impl_block::ImplBlock, | 17 | impl_block::ImplBlock, |
18 | resolve::Resolver, | 18 | resolve::Resolver, |
19 | diagnostics::DiagnosticSink, | 19 | diagnostics::{DiagnosticSink}, |
20 | traits::{TraitItem, TraitData}, | 20 | traits::{TraitItem, TraitData}, |
21 | }; | 21 | }; |
22 | 22 | ||
@@ -431,8 +431,8 @@ impl Docs for EnumVariant { | |||
431 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 431 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
432 | pub enum DefWithBody { | 432 | pub enum DefWithBody { |
433 | Function(Function), | 433 | Function(Function), |
434 | Const(Const), | ||
435 | Static(Static), | 434 | Static(Static), |
435 | Const(Const), | ||
436 | } | 436 | } |
437 | 437 | ||
438 | impl_froms!(DefWithBody: Function, Const, Static); | 438 | impl_froms!(DefWithBody: Function, Const, Static); |
@@ -562,7 +562,10 @@ impl Function { | |||
562 | } | 562 | } |
563 | 563 | ||
564 | pub fn diagnostics(&self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { | 564 | pub fn diagnostics(&self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { |
565 | self.infer(db).add_diagnostics(db, *self, sink); | 565 | let infer = self.infer(db); |
566 | infer.add_diagnostics(db, *self, sink); | ||
567 | let mut validator = ExprValidator::new(*self, infer, sink); | ||
568 | validator.validate_body(db); | ||
566 | } | 569 | } |
567 | } | 570 | } |
568 | 571 | ||