don't encode only locally used attrs
This commit is contained in:
@@ -1072,6 +1072,9 @@ rustc_queries! {
|
||||
desc { |tcx| "checking whether `{}` is `doc(hidden)`", tcx.def_path_str(def_id) }
|
||||
}
|
||||
|
||||
/// Returns the attributes on the item at `def_id`.
|
||||
///
|
||||
/// Do not use this directly, use `tcx.get_attrs` instead.
|
||||
query item_attrs(def_id: DefId) -> &'tcx [ast::Attribute] {
|
||||
desc { |tcx| "collecting attributes of `{}`", tcx.def_path_str(def_id) }
|
||||
separate_provide_extern
|
||||
|
||||
@@ -2187,6 +2187,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
|
||||
/// Gets the attributes of a definition.
|
||||
///
|
||||
/// Note that attributes which are be relevant while
|
||||
/// the current local crate are not stored in the crate metadata
|
||||
/// and therefore cannot be accessed outside of that crate.
|
||||
pub fn get_attrs(self, did: DefId) -> Attributes<'tcx> {
|
||||
if let Some(did) = did.as_local() {
|
||||
self.hir().attrs(self.hir().local_def_id_to_hir_id(did))
|
||||
|
||||
Reference in New Issue
Block a user