diff options
author | Florian Diebold <[email protected]> | 2018-12-25 12:31:30 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2018-12-25 14:16:42 +0000 |
commit | 07a72859650254d8ba326e2c9683ae52164cb3b5 (patch) | |
tree | bc652bf0deb9f0d12380081b04585a2beaa97fce /crates/ra_hir/src/lib.rs | |
parent | 4cb7b0f2af9787abe1c73fc3922e9b426a96e0ef (diff) |
Collect field data for structs/enum variants
Diffstat (limited to 'crates/ra_hir/src/lib.rs')
-rw-r--r-- | crates/ra_hir/src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 81526fe9c..796970d8a 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -135,6 +135,12 @@ impl DefId { | |||
135 | }; | 135 | }; |
136 | Ok(res) | 136 | Ok(res) |
137 | } | 137 | } |
138 | |||
139 | /// For a module, returns that module; for any other def, returns the containing module. | ||
140 | pub fn module(self, db: &impl HirDatabase) -> Cancelable<Module> { | ||
141 | let loc = self.loc(db); | ||
142 | Module::new(db, loc.source_root_id, loc.module_id) | ||
143 | } | ||
138 | } | 144 | } |
139 | 145 | ||
140 | /// Identifier of item within a specific file. This is stable over reparses, so | 146 | /// Identifier of item within a specific file. This is stable over reparses, so |