Make macro def krate mandatory

Refactors builtin derive support to go through proper name resolution
This commit is contained in:
Jonas Schievink 2020-12-15 20:33:05 +01:00
parent c31c3246a8
commit b238ddd21a
14 changed files with 91 additions and 42 deletions

View file

@ -970,7 +970,7 @@ impl MacroDef {
/// defines this macro. The reasons for this is that macros are expanded
/// early, in `hir_expand`, where modules simply do not exist yet.
pub fn module(self, db: &dyn HirDatabase) -> Option<Module> {
let krate = self.id.krate?;
let krate = self.id.krate;
let module_id = db.crate_def_map(krate).root;
Some(Module::new(Crate { id: krate }, module_id))
}