Auto merge of #12689 - Veykril:macro-rec, r=Veykril

internal: Record all macro definitions in ItemScope

Fixes https://github.com/rust-lang/rust-analyzer/issues/12100

Doesn't resolve the shadowing issues though, fixing those is gonna be really tricky I believe unless we can come up with a nice scheme to "order" item tree items (using syntax ranges and file ids would be a pain and also a bad idea since that'll require us to potentially reparse files in collection).
This commit is contained in:
bors 2022-07-16 16:45:26 +00:00
commit 766c5f0861
9 changed files with 57 additions and 27 deletions

View file

@ -560,7 +560,7 @@ impl Module {
pub fn legacy_macros(self, db: &dyn HirDatabase) -> Vec<Macro> {
let def_map = self.id.def_map(db.upcast());
let scope = &def_map[self.id.local_id].scope;
scope.legacy_macros().map(|(_, it)| MacroId::from(it).into()).collect()
scope.legacy_macros().flat_map(|(_, it)| it).map(|&it| MacroId::from(it).into()).collect()
}
pub fn impl_defs(self, db: &dyn HirDatabase) -> Vec<Impl> {