mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
get_attrs: use tcx.map.attrs
This is more flexible and less error-prone. `get_attrs` can now be used on many more types of items.
This commit is contained in:
parent
298d1578f0
commit
caf6f17c0f
@ -5592,8 +5592,7 @@ pub fn predicates<'tcx>(
|
||||
pub fn get_attrs<'tcx>(tcx: &'tcx ctxt, did: DefId)
|
||||
-> Cow<'tcx, [ast::Attribute]> {
|
||||
if is_local(did) {
|
||||
let item = tcx.map.expect_item(did.node);
|
||||
Cow::Borrowed(&item.attrs)
|
||||
Cow::Borrowed(tcx.map.attrs(did.node))
|
||||
} else {
|
||||
Cow::Owned(csearch::get_item_attrs(&tcx.sess.cstore, did))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user