Collect field data for structs/enum variants

This commit is contained in:
Florian Diebold 2018-12-25 13:31:30 +01:00
parent 4cb7b0f2af
commit 07a7285965
5 changed files with 87 additions and 12 deletions

View file

@ -135,6 +135,12 @@ impl DefId {
};
Ok(res)
}
/// For a module, returns that module; for any other def, returns the containing module.
pub fn module(self, db: &impl HirDatabase) -> Cancelable<Module> {
let loc = self.loc(db);
Module::new(db, loc.source_root_id, loc.module_id)
}
}
/// Identifier of item within a specific file. This is stable over reparses, so