diff options
Diffstat (limited to 'compiler/rustc_ast_lowering/src/lib.rs')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 05b417effd4..4a438541211 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -175,6 +175,8 @@ pub trait ResolverAstLowering { fn item_generics_num_lifetimes(&self, def: DefId, sess: &Session) -> usize; + fn item_attrs(&self, def_id: DefId, sess: &Session) -> Vec<ast::Attribute>; + /// Obtains resolution for a `NodeId` with a single resolution. fn get_partial_res(&mut self, id: NodeId) -> Option<PartialRes>; @@ -2826,6 +2828,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { ) } } + + fn item_attrs(&self, def_id: DefId) -> Vec<ast::Attribute> { + if let Some(_local_def_id) = def_id.as_local() { + // TODO: This doesn't actually work, items doesn't include everything? + //self.items[&hir::ItemId { def_id: local_def_id }].attrs.into() + Vec::new() + } else { + self.resolver.item_attrs(def_id, self.sess) + } + } } fn body_ids(bodies: &BTreeMap<hir::BodyId, hir::Body<'_>>) -> Vec<hir::BodyId> { |
