mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 08:36:03 +00:00
Merge #9421
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:
commit
fa7bb38450
@ -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) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user