This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree 3 files changed +21
-4
lines changed
compiler/rustc_middle/src 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -1126,6 +1126,11 @@ rustc_queries! {
1126
1126
desc { |tcx| "checking whether `{}` is `doc(hidden)`" , tcx. def_path_str( def_id) }
1127
1127
}
1128
1128
1129
+ /// Determines whether an item is annotated with `doc(notable_trait)`.
1130
+ query is_doc_notable_trait( def_id: DefId ) -> bool {
1131
+ desc { |tcx| "checking whether `{}` is `doc(notable_trait)`" , tcx. def_path_str( def_id) }
1132
+ }
1133
+
1129
1134
/// Returns the attributes on the item at `def_id`.
1130
1135
///
1131
1136
/// Do not use this directly, use `tcx.get_attrs` instead.
Original file line number Diff line number Diff line change @@ -1289,12 +1289,24 @@ pub fn is_doc_hidden(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
1289
1289
. any ( |items| items. iter ( ) . any ( |item| item. has_name ( sym:: hidden) ) )
1290
1290
}
1291
1291
1292
+ /// Determines whether an item is annotated with `doc(notable_trait)`.
1293
+ pub fn is_doc_notable_trait ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> bool {
1294
+ tcx. get_attrs ( def_id, sym:: doc)
1295
+ . filter_map ( |attr| attr. meta_item_list ( ) )
1296
+ . any ( |items| items. iter ( ) . any ( |item| item. has_name ( sym:: notable_trait) ) )
1297
+ }
1298
+
1292
1299
/// Determines whether an item is an intrinsic by Abi.
1293
1300
pub fn is_intrinsic ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> bool {
1294
1301
matches ! ( tcx. fn_sig( def_id) . abi( ) , Abi :: RustIntrinsic | Abi :: PlatformIntrinsic )
1295
1302
}
1296
1303
1297
1304
pub fn provide ( providers : & mut ty:: query:: Providers ) {
1298
- * providers =
1299
- ty:: query:: Providers { normalize_opaque_types, is_doc_hidden, is_intrinsic, ..* providers }
1305
+ * providers = ty:: query:: Providers {
1306
+ normalize_opaque_types,
1307
+ is_doc_hidden,
1308
+ is_doc_notable_trait,
1309
+ is_intrinsic,
1310
+ ..* providers
1311
+ }
1300
1312
}
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ use crate::clean::cfg::Cfg;
37
37
use crate :: clean:: clean_visibility;
38
38
use crate :: clean:: external_path;
39
39
use crate :: clean:: inline:: { self , print_inlined_const} ;
40
- use crate :: clean:: utils:: { has_doc_flag , is_literal_expr, print_const_expr, print_evaluated_const} ;
40
+ use crate :: clean:: utils:: { is_literal_expr, print_const_expr, print_evaluated_const} ;
41
41
use crate :: core:: DocContext ;
42
42
use crate :: formats:: cache:: Cache ;
43
43
use crate :: formats:: item_type:: ItemType ;
@@ -1524,7 +1524,7 @@ impl Trait {
1524
1524
tcx. trait_is_auto ( self . def_id )
1525
1525
}
1526
1526
pub ( crate ) fn is_notable_trait ( & self , tcx : TyCtxt < ' _ > ) -> bool {
1527
- has_doc_flag ( tcx, self . def_id , sym :: notable_trait )
1527
+ tcx. is_doc_notable_trait ( self . def_id )
1528
1528
}
1529
1529
pub ( crate ) fn unsafety ( & self , tcx : TyCtxt < ' _ > ) -> hir:: Unsafety {
1530
1530
tcx. trait_def ( self . def_id ) . unsafety
You can’t perform that action at this time.
0 commit comments