diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-23 17:06:57 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-23 17:06:57 +0000 |
commit | 0d5a9e4104a88df341480aa05d1c8976996e6e13 (patch) | |
tree | 55290349625c8516fbb8fd24f7fa22582a57d35a /crates/hir_def/src/nameres.rs | |
parent | e837fb245aadf2dcfda51a17a6c19b5efd47dc42 (diff) | |
parent | 338823f73aefbf7957b928ad76fc5f55cc43df9c (diff) |
Merge #7768
7768: Fix visibility computation when inside a block expression r=jonas-schievink a=jonas-schievink
fixes https://github.com/rust-analyzer/rust-analyzer/issues/7728
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src/nameres.rs')
-rw-r--r-- | crates/hir_def/src/nameres.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs index 34ff07f3c..f92232eb3 100644 --- a/crates/hir_def/src/nameres.rs +++ b/crates/hir_def/src/nameres.rs | |||
@@ -337,6 +337,12 @@ impl DefMap { | |||
337 | None | 337 | None |
338 | } | 338 | } |
339 | 339 | ||
340 | /// If this `DefMap` is for a block expression, returns the module containing the block (which | ||
341 | /// might again be a block, or a module inside a block). | ||
342 | pub fn parent(&self) -> Option<ModuleId> { | ||
343 | Some(self.block?.parent) | ||
344 | } | ||
345 | |||
340 | // FIXME: this can use some more human-readable format (ideally, an IR | 346 | // FIXME: this can use some more human-readable format (ideally, an IR |
341 | // even), as this should be a great debugging aid. | 347 | // even), as this should be a great debugging aid. |
342 | pub fn dump(&self, db: &dyn DefDatabase) -> String { | 348 | pub fn dump(&self, db: &dyn DefDatabase) -> String { |