mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 10:58:02 +00:00
Remove AttrOwner
This commit is contained in:
parent
f27268f319
commit
83a7ecdead
6 changed files with 60 additions and 69 deletions
|
|
@ -26,7 +26,6 @@ use crate::{
|
||||||
AdtId, AstIdLoc, AttrDefId, GenericParamId, HasModule, LocalFieldId, Lookup, MacroId,
|
AdtId, AstIdLoc, AttrDefId, GenericParamId, HasModule, LocalFieldId, Lookup, MacroId,
|
||||||
VariantId,
|
VariantId,
|
||||||
db::DefDatabase,
|
db::DefDatabase,
|
||||||
item_tree::AttrOwner,
|
|
||||||
lang_item::LangItem,
|
lang_item::LangItem,
|
||||||
nameres::{ModuleOrigin, ModuleSource},
|
nameres::{ModuleOrigin, ModuleSource},
|
||||||
src::{HasChildSource, HasSource},
|
src::{HasChildSource, HasSource},
|
||||||
|
|
@ -526,23 +525,22 @@ impl AttrsWithOwner {
|
||||||
ModuleOrigin::File { definition, declaration_tree_id, declaration, .. } => {
|
ModuleOrigin::File { definition, declaration_tree_id, declaration, .. } => {
|
||||||
let decl_attrs = declaration_tree_id
|
let decl_attrs = declaration_tree_id
|
||||||
.item_tree(db)
|
.item_tree(db)
|
||||||
.raw_attrs(AttrOwner::Item(declaration.erase()))
|
.raw_attrs(declaration.upcast())
|
||||||
.clone();
|
.clone();
|
||||||
let tree = db.file_item_tree(definition.into());
|
let tree = db.file_item_tree(definition.into());
|
||||||
let def_attrs = tree.raw_attrs(AttrOwner::TopLevel).clone();
|
let def_attrs = tree.top_level_raw_attrs().clone();
|
||||||
decl_attrs.merge(def_attrs)
|
decl_attrs.merge(def_attrs)
|
||||||
}
|
}
|
||||||
ModuleOrigin::CrateRoot { definition } => {
|
ModuleOrigin::CrateRoot { definition } => {
|
||||||
let tree = db.file_item_tree(definition.into());
|
let tree = db.file_item_tree(definition.into());
|
||||||
tree.raw_attrs(AttrOwner::TopLevel).clone()
|
tree.top_level_raw_attrs().clone()
|
||||||
|
}
|
||||||
|
ModuleOrigin::Inline { definition_tree_id, definition } => {
|
||||||
|
definition_tree_id.item_tree(db).raw_attrs(definition.upcast()).clone()
|
||||||
}
|
}
|
||||||
ModuleOrigin::Inline { definition_tree_id, definition } => definition_tree_id
|
|
||||||
.item_tree(db)
|
|
||||||
.raw_attrs(AttrOwner::Item(definition.erase()))
|
|
||||||
.clone(),
|
|
||||||
ModuleOrigin::BlockExpr { id, .. } => {
|
ModuleOrigin::BlockExpr { id, .. } => {
|
||||||
let tree = db.block_item_tree(id);
|
let tree = db.block_item_tree(id);
|
||||||
tree.raw_attrs(AttrOwner::TopLevel).clone()
|
tree.top_level_raw_attrs().clone()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Attrs::expand_cfg_attr(db, module.krate, raw_attrs)
|
Attrs::expand_cfg_attr(db, module.krate, raw_attrs)
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,7 @@ fn include_macro_invoc(
|
||||||
fn crate_supports_no_std(db: &dyn DefDatabase, crate_id: Crate) -> bool {
|
fn crate_supports_no_std(db: &dyn DefDatabase, crate_id: Crate) -> bool {
|
||||||
let file = crate_id.data(db).root_file_id(db);
|
let file = crate_id.data(db).root_file_id(db);
|
||||||
let item_tree = db.file_item_tree(file.into());
|
let item_tree = db.file_item_tree(file.into());
|
||||||
let attrs = item_tree.raw_attrs(crate::item_tree::AttrOwner::TopLevel);
|
let attrs = item_tree.top_level_raw_attrs();
|
||||||
for attr in &**attrs {
|
for attr in &**attrs {
|
||||||
match attr.path().as_ident() {
|
match attr.path().as_ident() {
|
||||||
Some(ident) if *ident == sym::no_std => return true,
|
Some(ident) if *ident == sym::no_std => return true,
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ use hir_expand::{
|
||||||
use intern::Interned;
|
use intern::Interned;
|
||||||
use la_arena::Idx;
|
use la_arena::Idx;
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
use span::{AstIdNode, Edition, ErasedFileAstId, FileAstId, SyntaxContext};
|
use span::{AstIdNode, Edition, FileAstId, SyntaxContext};
|
||||||
use stdx::never;
|
use stdx::never;
|
||||||
use syntax::{SyntaxKind, ast, match_ast};
|
use syntax::{SyntaxKind, ast, match_ast};
|
||||||
use triomphe::Arc;
|
use triomphe::Arc;
|
||||||
|
|
@ -89,9 +89,8 @@ impl fmt::Debug for RawVisibilityId {
|
||||||
#[derive(Debug, Default, Eq, PartialEq)]
|
#[derive(Debug, Default, Eq, PartialEq)]
|
||||||
pub struct ItemTree {
|
pub struct ItemTree {
|
||||||
top_level: Box<[ModItemId]>,
|
top_level: Box<[ModItemId]>,
|
||||||
// Consider splitting this into top level RawAttrs and the map?
|
top_attrs: RawAttrs,
|
||||||
attrs: FxHashMap<AttrOwner, RawAttrs>,
|
attrs: FxHashMap<FileAstId<ast::Item>, RawAttrs>,
|
||||||
|
|
||||||
vis: ItemVisibilities,
|
vis: ItemVisibilities,
|
||||||
// FIXME: They values store the key, turn this into a FxHashSet<ModItem> instead?
|
// FIXME: They values store the key, turn this into a FxHashSet<ModItem> instead?
|
||||||
data: FxHashMap<FileAstId<ast::Item>, ModItem>,
|
data: FxHashMap<FileAstId<ast::Item>, ModItem>,
|
||||||
|
|
@ -104,12 +103,13 @@ impl ItemTree {
|
||||||
|
|
||||||
let ctx = lower::Ctx::new(db, file_id);
|
let ctx = lower::Ctx::new(db, file_id);
|
||||||
let syntax = db.parse_or_expand(file_id);
|
let syntax = db.parse_or_expand(file_id);
|
||||||
let mut top_attrs = None;
|
|
||||||
let mut item_tree = match_ast! {
|
let mut item_tree = match_ast! {
|
||||||
match syntax {
|
match syntax {
|
||||||
ast::SourceFile(file) => {
|
ast::SourceFile(file) => {
|
||||||
top_attrs = Some(RawAttrs::new(db, &file, ctx.span_map()));
|
let top_attrs = RawAttrs::new(db, &file, ctx.span_map());
|
||||||
ctx.lower_module_items(&file)
|
let mut item_tree = ctx.lower_module_items(&file);
|
||||||
|
item_tree.top_attrs = top_attrs;
|
||||||
|
item_tree
|
||||||
},
|
},
|
||||||
ast::MacroItems(items) => {
|
ast::MacroItems(items) => {
|
||||||
ctx.lower_module_items(&items)
|
ctx.lower_module_items(&items)
|
||||||
|
|
@ -128,10 +128,10 @@ impl ItemTree {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(attrs) = top_attrs {
|
if item_tree.data.is_empty()
|
||||||
item_tree.attrs.insert(AttrOwner::TopLevel, attrs);
|
&& item_tree.top_level.is_empty()
|
||||||
}
|
&& item_tree.attrs.is_empty()
|
||||||
if item_tree.data.is_empty() && item_tree.top_level.is_empty() && item_tree.attrs.is_empty()
|
&& item_tree.top_attrs.is_empty()
|
||||||
{
|
{
|
||||||
EMPTY
|
EMPTY
|
||||||
.get_or_init(|| {
|
.get_or_init(|| {
|
||||||
|
|
@ -139,6 +139,7 @@ impl ItemTree {
|
||||||
top_level: Box::new([]),
|
top_level: Box::new([]),
|
||||||
attrs: FxHashMap::default(),
|
attrs: FxHashMap::default(),
|
||||||
data: FxHashMap::default(),
|
data: FxHashMap::default(),
|
||||||
|
top_attrs: RawAttrs::EMPTY,
|
||||||
vis: ItemVisibilities { arena: Box::new([]) },
|
vis: ItemVisibilities { arena: Box::new([]) },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -158,7 +159,10 @@ impl ItemTree {
|
||||||
|
|
||||||
let ctx = lower::Ctx::new(db, loc.ast_id.file_id);
|
let ctx = lower::Ctx::new(db, loc.ast_id.file_id);
|
||||||
let mut item_tree = ctx.lower_block(&block);
|
let mut item_tree = ctx.lower_block(&block);
|
||||||
if item_tree.data.is_empty() && item_tree.top_level.is_empty() && item_tree.attrs.is_empty()
|
if item_tree.data.is_empty()
|
||||||
|
&& item_tree.top_level.is_empty()
|
||||||
|
&& item_tree.attrs.is_empty()
|
||||||
|
&& item_tree.top_attrs.is_empty()
|
||||||
{
|
{
|
||||||
EMPTY
|
EMPTY
|
||||||
.get_or_init(|| {
|
.get_or_init(|| {
|
||||||
|
|
@ -166,6 +170,7 @@ impl ItemTree {
|
||||||
top_level: Box::new([]),
|
top_level: Box::new([]),
|
||||||
attrs: FxHashMap::default(),
|
attrs: FxHashMap::default(),
|
||||||
data: FxHashMap::default(),
|
data: FxHashMap::default(),
|
||||||
|
top_attrs: RawAttrs::EMPTY,
|
||||||
vis: ItemVisibilities { arena: Box::new([]) },
|
vis: ItemVisibilities { arena: Box::new([]) },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -183,19 +188,25 @@ impl ItemTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the inner attributes of the source file.
|
/// Returns the inner attributes of the source file.
|
||||||
pub fn top_level_attrs(&self, db: &dyn DefDatabase, krate: Crate) -> Attrs {
|
pub fn top_level_raw_attrs(&self) -> &RawAttrs {
|
||||||
Attrs::expand_cfg_attr(
|
&self.top_attrs
|
||||||
db,
|
|
||||||
krate,
|
|
||||||
self.attrs.get(&AttrOwner::TopLevel).unwrap_or(&RawAttrs::EMPTY).clone(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn raw_attrs(&self, of: AttrOwner) -> &RawAttrs {
|
/// Returns the inner attributes of the source file.
|
||||||
|
pub fn top_level_attrs(&self, db: &dyn DefDatabase, krate: Crate) -> Attrs {
|
||||||
|
Attrs::expand_cfg_attr(db, krate, self.top_attrs.clone())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn raw_attrs(&self, of: FileAstId<ast::Item>) -> &RawAttrs {
|
||||||
self.attrs.get(&of).unwrap_or(&RawAttrs::EMPTY)
|
self.attrs.get(&of).unwrap_or(&RawAttrs::EMPTY)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn attrs(&self, db: &dyn DefDatabase, krate: Crate, of: AttrOwner) -> Attrs {
|
pub(crate) fn attrs(
|
||||||
|
&self,
|
||||||
|
db: &dyn DefDatabase,
|
||||||
|
krate: Crate,
|
||||||
|
of: FileAstId<ast::Item>,
|
||||||
|
) -> Attrs {
|
||||||
Attrs::expand_cfg_attr(db, krate, self.raw_attrs(of).clone())
|
Attrs::expand_cfg_attr(db, krate, self.raw_attrs(of).clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,7 +237,7 @@ impl ItemTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn shrink_to_fit(&mut self) {
|
fn shrink_to_fit(&mut self) {
|
||||||
let ItemTree { top_level: _, attrs, data, vis: _ } = self;
|
let ItemTree { top_level: _, attrs, data, vis: _, top_attrs: _ } = self;
|
||||||
attrs.shrink_to_fit();
|
attrs.shrink_to_fit();
|
||||||
data.shrink_to_fit();
|
data.shrink_to_fit();
|
||||||
}
|
}
|
||||||
|
|
@ -266,21 +277,6 @@ pub struct ItemTreeDataStats {
|
||||||
pub macro_rules: usize,
|
pub macro_rules: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
|
||||||
pub enum AttrOwner {
|
|
||||||
/// Attributes on an item.
|
|
||||||
Item(ErasedFileAstId),
|
|
||||||
/// Inner attributes of the source file.
|
|
||||||
TopLevel,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<ModItemId> for AttrOwner {
|
|
||||||
#[inline]
|
|
||||||
fn from(value: ModItemId) -> Self {
|
|
||||||
AttrOwner::Item(value.ast_id().erase())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Trait implemented by all nodes in the item tree.
|
/// Trait implemented by all nodes in the item tree.
|
||||||
pub trait ItemTreeNode: Clone {
|
pub trait ItemTreeNode: Clone {
|
||||||
type Source: AstIdNode;
|
type Source: AstIdNode;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use hir_expand::{
|
||||||
span_map::{SpanMap, SpanMapRef},
|
span_map::{SpanMap, SpanMapRef},
|
||||||
};
|
};
|
||||||
use la_arena::Arena;
|
use la_arena::Arena;
|
||||||
use span::{AstIdMap, SyntaxContext};
|
use span::{AstIdMap, FileAstId, SyntaxContext};
|
||||||
use syntax::{
|
use syntax::{
|
||||||
AstNode,
|
AstNode,
|
||||||
ast::{self, HasModuleItem, HasName},
|
ast::{self, HasModuleItem, HasName},
|
||||||
|
|
@ -20,10 +20,10 @@ use triomphe::Arc;
|
||||||
use crate::{
|
use crate::{
|
||||||
db::DefDatabase,
|
db::DefDatabase,
|
||||||
item_tree::{
|
item_tree::{
|
||||||
AttrOwner, Const, Enum, ExternBlock, ExternCrate, FieldsShape, Function, Impl, ImportAlias,
|
Const, Enum, ExternBlock, ExternCrate, FieldsShape, Function, Impl, ImportAlias, Interned,
|
||||||
Interned, ItemTree, ItemTreeAstId, Macro2, MacroCall, MacroRules, Mod, ModItem, ModItemId,
|
ItemTree, ItemTreeAstId, Macro2, MacroCall, MacroRules, Mod, ModItem, ModItemId, ModKind,
|
||||||
ModKind, ModPath, RawAttrs, RawVisibility, RawVisibilityId, Static, Struct, StructKind,
|
ModPath, RawAttrs, RawVisibility, RawVisibilityId, Static, Struct, StructKind, Trait,
|
||||||
Trait, TraitAlias, TypeAlias, Union, Use, UseTree, UseTreeKind, VisibilityExplicitness,
|
TraitAlias, TypeAlias, Union, Use, UseTree, UseTreeKind, VisibilityExplicitness,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ impl<'a> Ctx<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn lower_block(mut self, block: &ast::BlockExpr) -> ItemTree {
|
pub(super) fn lower_block(mut self, block: &ast::BlockExpr) -> ItemTree {
|
||||||
self.tree.attrs.insert(AttrOwner::TopLevel, RawAttrs::new(self.db, block, self.span_map()));
|
self.tree.top_attrs = RawAttrs::new(self.db, block, self.span_map());
|
||||||
self.top_level = block
|
self.top_level = block
|
||||||
.statements()
|
.statements()
|
||||||
.filter_map(|stmt| match stmt {
|
.filter_map(|stmt| match stmt {
|
||||||
|
|
@ -144,12 +144,12 @@ impl<'a> Ctx<'a> {
|
||||||
ast::Item::ExternBlock(ast) => self.lower_extern_block(ast).into(),
|
ast::Item::ExternBlock(ast) => self.lower_extern_block(ast).into(),
|
||||||
};
|
};
|
||||||
let attrs = RawAttrs::new(self.db, item, self.span_map());
|
let attrs = RawAttrs::new(self.db, item, self.span_map());
|
||||||
self.add_attrs(mod_item.into(), attrs);
|
self.add_attrs(mod_item.ast_id(), attrs);
|
||||||
|
|
||||||
Some(mod_item)
|
Some(mod_item)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_attrs(&mut self, item: AttrOwner, attrs: RawAttrs) {
|
fn add_attrs(&mut self, item: FileAstId<ast::Item>, attrs: RawAttrs) {
|
||||||
if !attrs.is_empty() {
|
if !attrs.is_empty() {
|
||||||
match self.tree.attrs.entry(item) {
|
match self.tree.attrs.entry(item) {
|
||||||
Entry::Occupied(mut entry) => {
|
Entry::Occupied(mut entry) => {
|
||||||
|
|
@ -365,7 +365,7 @@ impl<'a> Ctx<'a> {
|
||||||
ast::ExternItem::MacroCall(call) => self.lower_macro_call(call)?.into(),
|
ast::ExternItem::MacroCall(call) => self.lower_macro_call(call)?.into(),
|
||||||
};
|
};
|
||||||
let attrs = RawAttrs::new(self.db, &item, self.span_map());
|
let attrs = RawAttrs::new(self.db, &item, self.span_map());
|
||||||
self.add_attrs(mod_item.into(), attrs);
|
self.add_attrs(mod_item.ast_id(), attrs);
|
||||||
Some(mod_item)
|
Some(mod_item)
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,9 @@ use span::{Edition, ErasedFileAstId};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
item_tree::{
|
item_tree::{
|
||||||
AttrOwner, Const, DefDatabase, Enum, ExternBlock, ExternCrate, FieldsShape, Function, Impl,
|
Const, DefDatabase, Enum, ExternBlock, ExternCrate, FieldsShape, Function, Impl, ItemTree,
|
||||||
ItemTree, Macro2, MacroCall, MacroRules, Mod, ModItemId, ModKind, RawAttrs,
|
Macro2, MacroCall, MacroRules, Mod, ModItemId, ModKind, RawAttrs, RawVisibilityId, Static,
|
||||||
RawVisibilityId, Static, Struct, Trait, TraitAlias, TypeAlias, Union, Use, UseTree,
|
Struct, Trait, TraitAlias, TypeAlias, Union, Use, UseTree, UseTreeKind,
|
||||||
UseTreeKind,
|
|
||||||
},
|
},
|
||||||
visibility::RawVisibility,
|
visibility::RawVisibility,
|
||||||
};
|
};
|
||||||
|
|
@ -18,9 +17,7 @@ pub(super) fn print_item_tree(db: &dyn DefDatabase, tree: &ItemTree, edition: Ed
|
||||||
let mut p =
|
let mut p =
|
||||||
Printer { db, tree, buf: String::new(), indent_level: 0, needs_indent: true, edition };
|
Printer { db, tree, buf: String::new(), indent_level: 0, needs_indent: true, edition };
|
||||||
|
|
||||||
if let Some(attrs) = tree.attrs.get(&AttrOwner::TopLevel) {
|
p.print_attrs(&tree.top_attrs, true, "\n");
|
||||||
p.print_attrs(attrs, true, "\n");
|
|
||||||
}
|
|
||||||
p.blank();
|
p.blank();
|
||||||
|
|
||||||
for item in tree.top_level_items() {
|
for item in tree.top_level_items() {
|
||||||
|
|
@ -102,8 +99,8 @@ impl Printer<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_attrs_of(&mut self, of: impl Into<AttrOwner>, separated_by: &str) {
|
fn print_attrs_of(&mut self, of: ModItemId, separated_by: &str) {
|
||||||
if let Some(attrs) = self.tree.attrs.get(&of.into()) {
|
if let Some(attrs) = self.tree.attrs.get(&of.ast_id()) {
|
||||||
self.print_attrs(attrs, false, separated_by);
|
self.print_attrs(attrs, false, separated_by);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ use crate::{
|
||||||
db::DefDatabase,
|
db::DefDatabase,
|
||||||
item_scope::{GlobId, ImportId, ImportOrExternCrate, PerNsGlobImports},
|
item_scope::{GlobId, ImportId, ImportOrExternCrate, PerNsGlobImports},
|
||||||
item_tree::{
|
item_tree::{
|
||||||
self, AttrOwner, FieldsShape, ImportAlias, ImportKind, ItemTree, ItemTreeAstId,
|
self, FieldsShape, ImportAlias, ImportKind, ItemTree, ItemTreeAstId, ItemTreeNode, Macro2,
|
||||||
ItemTreeNode, Macro2, MacroCall, MacroRules, Mod, ModItemId, ModKind, TreeId, UseTreeKind,
|
MacroCall, MacroRules, Mod, ModItemId, ModKind, TreeId, UseTreeKind,
|
||||||
},
|
},
|
||||||
macro_call_as_call_id,
|
macro_call_as_call_id,
|
||||||
nameres::{
|
nameres::{
|
||||||
|
|
@ -1727,7 +1727,7 @@ impl ModCollector<'_, '_> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut process_mod_item = |item: ModItemId| {
|
let mut process_mod_item = |item: ModItemId| {
|
||||||
let attrs = self.item_tree.attrs(db, krate, item.into());
|
let attrs = self.item_tree.attrs(db, krate, item.ast_id());
|
||||||
if let Some(cfg) = attrs.cfg() {
|
if let Some(cfg) = attrs.cfg() {
|
||||||
if !self.is_cfg_enabled(&cfg) {
|
if !self.is_cfg_enabled(&cfg) {
|
||||||
let ast_id = item.ast_id().erase();
|
let ast_id = item.ast_id().erase();
|
||||||
|
|
@ -2298,7 +2298,7 @@ impl ModCollector<'_, '_> {
|
||||||
fn collect_macro_rules(&mut self, id: ItemTreeAstId<MacroRules>, module: ModuleId) {
|
fn collect_macro_rules(&mut self, id: ItemTreeAstId<MacroRules>, module: ModuleId) {
|
||||||
let krate = self.def_collector.def_map.krate;
|
let krate = self.def_collector.def_map.krate;
|
||||||
let mac = &self.item_tree[id];
|
let mac = &self.item_tree[id];
|
||||||
let attrs = self.item_tree.attrs(self.def_collector.db, krate, AttrOwner::Item(id.erase()));
|
let attrs = self.item_tree.attrs(self.def_collector.db, krate, id.upcast());
|
||||||
let ast_id = InFile::new(self.file_id(), mac.ast_id.upcast());
|
let ast_id = InFile::new(self.file_id(), mac.ast_id.upcast());
|
||||||
|
|
||||||
let export_attr = || attrs.by_key(sym::macro_export);
|
let export_attr = || attrs.by_key(sym::macro_export);
|
||||||
|
|
@ -2387,7 +2387,7 @@ impl ModCollector<'_, '_> {
|
||||||
|
|
||||||
// Case 1: builtin macros
|
// Case 1: builtin macros
|
||||||
let mut helpers_opt = None;
|
let mut helpers_opt = None;
|
||||||
let attrs = self.item_tree.attrs(self.def_collector.db, krate, AttrOwner::Item(id.erase()));
|
let attrs = self.item_tree.attrs(self.def_collector.db, krate, id.upcast());
|
||||||
let expander = if attrs.by_key(sym::rustc_builtin_macro).exists() {
|
let expander = if attrs.by_key(sym::rustc_builtin_macro).exists() {
|
||||||
if let Some(expander) = find_builtin_macro(&mac.name) {
|
if let Some(expander) = find_builtin_macro(&mac.name) {
|
||||||
match expander {
|
match expander {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue