mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Merge #11750
11750: fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros r=Veykril a=Veykril Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11746 bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
6ad8c022ed
6 changed files with 98 additions and 3 deletions
|
@ -570,6 +570,12 @@ impl Module {
|
|||
.collect()
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
pub fn impl_defs(self, db: &dyn HirDatabase) -> Vec<Impl> {
|
||||
let def_map = self.id.def_map(db.upcast());
|
||||
def_map[self.id.local_id].scope.impls().map(Impl::from).collect()
|
||||
|
@ -1785,6 +1791,10 @@ impl Macro {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_macro_export(self, db: &dyn HirDatabase) -> bool {
|
||||
matches!(self.id, MacroId::MacroRulesId(id) if db.macro_rules_data(id).macro_export)
|
||||
}
|
||||
|
||||
pub fn kind(&self, db: &dyn HirDatabase) -> MacroKind {
|
||||
match self.id {
|
||||
MacroId::Macro2Id(it) => match it.lookup(db.upcast()).expander {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue