9421: minor: Record attributes in attr_query for proc-macros r=jonas-schievink a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2021-06-28 17:23:24 +00:00 committed by GitHub
commit fa7bb38450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -338,8 +338,7 @@ impl AttrsWithOwner {
AttrDefId::TraitId(it) => attrs_from_item_tree(it.lookup(db).id, db), AttrDefId::TraitId(it) => attrs_from_item_tree(it.lookup(db).id, db),
AttrDefId::MacroDefId(it) => it AttrDefId::MacroDefId(it) => it
.ast_id() .ast_id()
.left() .either(|ast_id| attrs_from_ast(ast_id, db), |ast_id| attrs_from_ast(ast_id, db)),
.map_or_else(Default::default, |ast_id| attrs_from_ast(ast_id, db)),
AttrDefId::ImplId(it) => attrs_from_item_tree(it.lookup(db).id, db), AttrDefId::ImplId(it) => attrs_from_item_tree(it.lookup(db).id, db),
AttrDefId::ConstId(it) => attrs_from_item_tree(it.lookup(db).id, db), AttrDefId::ConstId(it) => attrs_from_item_tree(it.lookup(db).id, db),
AttrDefId::StaticId(it) => attrs_from_item_tree(it.lookup(db).id, db), AttrDefId::StaticId(it) => attrs_from_item_tree(it.lookup(db).id, db),
@ -424,14 +423,10 @@ impl AttrsWithOwner {
AttrDefId::ConstId(id) => id.lookup(db).source(db).map(ast::AttrsOwnerNode::new), AttrDefId::ConstId(id) => id.lookup(db).source(db).map(ast::AttrsOwnerNode::new),
AttrDefId::TraitId(id) => id.lookup(db).source(db).map(ast::AttrsOwnerNode::new), AttrDefId::TraitId(id) => id.lookup(db).source(db).map(ast::AttrsOwnerNode::new),
AttrDefId::TypeAliasId(id) => id.lookup(db).source(db).map(ast::AttrsOwnerNode::new), AttrDefId::TypeAliasId(id) => id.lookup(db).source(db).map(ast::AttrsOwnerNode::new),
AttrDefId::MacroDefId(id) => match id.ast_id() { AttrDefId::MacroDefId(id) => id.ast_id().either(
Either::Left(it) => { |it| it.with_value(ast::AttrsOwnerNode::new(it.to_node(db.upcast()))),
it.with_value(ast::AttrsOwnerNode::new(it.to_node(db.upcast()))) |it| it.with_value(ast::AttrsOwnerNode::new(it.to_node(db.upcast()))),
} ),
Either::Right(it) => {
it.with_value(ast::AttrsOwnerNode::new(it.to_node(db.upcast())))
}
},
AttrDefId::ImplId(id) => id.lookup(db).source(db).map(ast::AttrsOwnerNode::new), AttrDefId::ImplId(id) => id.lookup(db).source(db).map(ast::AttrsOwnerNode::new),
AttrDefId::GenericParamId(id) => match id { AttrDefId::GenericParamId(id) => match id {
GenericParamId::TypeParamId(id) => { GenericParamId::TypeParamId(id) => {