@@ -19,7 +19,7 @@ use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
1919use rustc_index:: bit_set:: GrowableBitSet ;
2020use rustc_macros:: { extension, HashStable , TyDecodable , TyEncodable } ;
2121use rustc_session:: Limit ;
22- use rustc_span:: sym;
22+ use rustc_span:: { sym, Symbol } ;
2323use rustc_target:: abi:: { Float , Integer , IntegerType , Size } ;
2424use rustc_target:: spec:: abi:: Abi ;
2525use smallvec:: { smallvec, SmallVec } ;
@@ -1829,6 +1829,12 @@ pub fn reveal_opaque_types_in_bounds<'tcx>(
18291829 val. fold_with ( & mut visitor)
18301830}
18311831
1832+ /// Determines whether an item is annotated with an attribute.
1833+ pub fn has_attr_query ( tcx : TyCtxt < ' _ > , key : ( DefId , Symbol ) ) -> bool {
1834+ let ( did, attr) = key;
1835+ tcx. get_attrs ( did, attr) . next ( ) . is_some ( )
1836+ }
1837+
18321838/// Determines whether an item is directly annotated with `doc(hidden)`.
18331839fn is_doc_hidden ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> bool {
18341840 tcx. get_attrs ( def_id, sym:: doc)
@@ -1865,6 +1871,7 @@ pub fn intrinsic_raw(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::Intrinsi
18651871pub fn provide ( providers : & mut Providers ) {
18661872 * providers = Providers {
18671873 reveal_opaque_types_in_bounds,
1874+ has_attr_query,
18681875 is_doc_hidden,
18691876 is_doc_notable_trait,
18701877 intrinsic_raw,
0 commit comments