From d4a22fc801f4768990c7e62241bea5fe4ff92ead Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 3 Feb 2021 17:48:41 +0100 Subject: Update `DefMap` and `block_def_map` docs --- crates/hir_def/src/db.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crates/hir_def/src/db.rs') diff --git a/crates/hir_def/src/db.rs b/crates/hir_def/src/db.rs index 7fe6f6346..6c01f1ed0 100644 --- a/crates/hir_def/src/db.rs +++ b/crates/hir_def/src/db.rs @@ -58,6 +58,21 @@ pub trait DefDatabase: InternDatabase + AstDatabase + Upcast { #[salsa::invoke(DefMap::crate_def_map_query)] fn crate_def_map_query(&self, krate: CrateId) -> Arc; + /// Computes the block-level `DefMap`, returning `None` when `block` doesn't contain any inner + /// items directly. + /// + /// For example: + /// + /// ``` + /// fn f() { // (0) + /// { // (1) + /// fn inner() {} + /// } + /// } + /// ``` + /// + /// The `block_def_map` for block 0 would return `None`, while `block_def_map` of block 1 would + /// return a `DefMap` containing `inner`. #[salsa::invoke(DefMap::block_def_map_query)] fn block_def_map(&self, block: BlockId) -> Option>; -- cgit v1.2.3