@@ -19,7 +19,7 @@ use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
19
19
use rustc_index:: bit_set:: GrowableBitSet ;
20
20
use rustc_macros:: { extension, HashStable , TyDecodable , TyEncodable } ;
21
21
use rustc_session:: Limit ;
22
- use rustc_span:: sym;
22
+ use rustc_span:: { sym, Symbol } ;
23
23
use rustc_target:: abi:: { Float , Integer , IntegerType , Size } ;
24
24
use rustc_target:: spec:: abi:: Abi ;
25
25
use smallvec:: { smallvec, SmallVec } ;
@@ -1829,6 +1829,12 @@ pub fn reveal_opaque_types_in_bounds<'tcx>(
1829
1829
val. fold_with ( & mut visitor)
1830
1830
}
1831
1831
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
+
1832
1838
/// Determines whether an item is directly annotated with `doc(hidden)`.
1833
1839
fn is_doc_hidden ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> bool {
1834
1840
tcx. get_attrs ( def_id, sym:: doc)
@@ -1865,6 +1871,7 @@ pub fn intrinsic_raw(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::Intrinsi
1865
1871
pub fn provide ( providers : & mut Providers ) {
1866
1872
* providers = Providers {
1867
1873
reveal_opaque_types_in_bounds,
1874
+ has_attr_query,
1868
1875
is_doc_hidden,
1869
1876
is_doc_notable_trait,
1870
1877
intrinsic_raw,
0 commit comments