diff options
author | Jonas Schievink <[email protected]> | 2020-10-20 16:49:21 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-10-20 16:53:04 +0100 |
commit | 80d27414016903fa591548cff22939d3c43cdd8d (patch) | |
tree | 7e1af2330d87fcefcfcea4e8babfe4130c1e3786 /crates/hir_def/src/item_tree.rs | |
parent | a54e481646edb151075d12ca6903091abe7cfc4e (diff) |
Add a (hint) diagnostic for unconfigured items
Diffstat (limited to 'crates/hir_def/src/item_tree.rs')
-rw-r--r-- | crates/hir_def/src/item_tree.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index 8a1121bbd..7eb388bae 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs | |||
@@ -672,6 +672,24 @@ impl ModItem { | |||
672 | pub fn downcast<N: ItemTreeNode>(self) -> Option<FileItemTreeId<N>> { | 672 | pub fn downcast<N: ItemTreeNode>(self) -> Option<FileItemTreeId<N>> { |
673 | N::id_from_mod_item(self) | 673 | N::id_from_mod_item(self) |
674 | } | 674 | } |
675 | |||
676 | pub fn ast_id(&self, tree: &ItemTree) -> FileAstId<ast::Item> { | ||
677 | match self { | ||
678 | ModItem::Import(it) => tree[it.index].ast_id().upcast(), | ||
679 | ModItem::ExternCrate(it) => tree[it.index].ast_id().upcast(), | ||
680 | ModItem::Function(it) => tree[it.index].ast_id().upcast(), | ||
681 | ModItem::Struct(it) => tree[it.index].ast_id().upcast(), | ||
682 | ModItem::Union(it) => tree[it.index].ast_id().upcast(), | ||
683 | ModItem::Enum(it) => tree[it.index].ast_id().upcast(), | ||
684 | ModItem::Const(it) => tree[it.index].ast_id().upcast(), | ||
685 | ModItem::Static(it) => tree[it.index].ast_id().upcast(), | ||
686 | ModItem::Trait(it) => tree[it.index].ast_id().upcast(), | ||
687 | ModItem::Impl(it) => tree[it.index].ast_id().upcast(), | ||
688 | ModItem::TypeAlias(it) => tree[it.index].ast_id().upcast(), | ||
689 | ModItem::Mod(it) => tree[it.index].ast_id().upcast(), | ||
690 | ModItem::MacroCall(it) => tree[it.index].ast_id().upcast(), | ||
691 | } | ||
692 | } | ||
675 | } | 693 | } |
676 | 694 | ||
677 | #[derive(Debug, Copy, Clone, Eq, PartialEq)] | 695 | #[derive(Debug, Copy, Clone, Eq, PartialEq)] |