Skip to content

Commit caf6f17

Browse files
committed
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.
1 parent 298d157 commit caf6f17

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/librustc/middle/ty.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5592,8 +5592,7 @@ pub fn predicates<'tcx>(
55925592
pub fn get_attrs<'tcx>(tcx: &'tcx ctxt, did: DefId)
55935593
-> Cow<'tcx, [ast::Attribute]> {
55945594
if is_local(did) {
5595-
let item = tcx.map.expect_item(did.node);
5596-
Cow::Borrowed(&item.attrs)
5595+
Cow::Borrowed(tcx.map.attrs(did.node))
55975596
} else {
55985597
Cow::Owned(csearch::get_item_attrs(&tcx.sess.cstore, did))
55995598
}

0 commit comments

Comments
 (0)