diff options
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/code_model.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 650b4fa40..19ea26e36 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs | |||
@@ -255,6 +255,37 @@ impl ModuleDef { | |||
255 | ModuleDef::BuiltinType(it) => Some(it.as_name()), | 255 | ModuleDef::BuiltinType(it) => Some(it.as_name()), |
256 | } | 256 | } |
257 | } | 257 | } |
258 | |||
259 | pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { | ||
260 | match self { | ||
261 | ModuleDef::Adt(it) => match it { | ||
262 | Adt::Struct(it) => { | ||
263 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
264 | } | ||
265 | Adt::Enum(it) => hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink), | ||
266 | Adt::Union(it) => hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink), | ||
267 | }, | ||
268 | ModuleDef::Trait(it) => { | ||
269 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
270 | } | ||
271 | ModuleDef::Function(it) => { | ||
272 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
273 | } | ||
274 | ModuleDef::TypeAlias(it) => { | ||
275 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
276 | } | ||
277 | ModuleDef::Module(it) => { | ||
278 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
279 | } | ||
280 | ModuleDef::Const(it) => { | ||
281 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
282 | } | ||
283 | ModuleDef::Static(it) => { | ||
284 | hir_ty::diagnostics::validate_module_item(db, it.id.into(), sink) | ||
285 | } | ||
286 | _ => return, | ||
287 | } | ||
288 | } | ||
258 | } | 289 | } |
259 | 290 | ||
260 | pub use hir_def::{ | 291 | pub use hir_def::{ |