From caf6f17c0f89b3384a25b6d74bb2332c7ec2d2ac Mon Sep 17 00:00:00 2001 From: Philip Munksgaard Date: Wed, 4 Mar 2015 15:47:28 +0100 Subject: [PATCH] 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. --- src/librustc/middle/ty.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 36c42b70795..f522b4ea03c 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -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)) }