mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
parent
a63a03dc54
commit
4bf789fba7
@ -1126,6 +1126,11 @@ rustc_queries! {
|
||||
desc { |tcx| "checking whether `{}` is `doc(hidden)`", tcx.def_path_str(def_id) }
|
||||
}
|
||||
|
||||
/// Determines whether an item is annotated with `doc(notable_trait)`.
|
||||
query is_doc_notable_trait(def_id: DefId) -> bool {
|
||||
desc { |tcx| "checking whether `{}` is `doc(notable_trait)`", 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.
|
||||
|
@ -1289,12 +1289,24 @@ pub fn is_doc_hidden(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||
.any(|items| items.iter().any(|item| item.has_name(sym::hidden)))
|
||||
}
|
||||
|
||||
/// Determines whether an item is annotated with `doc(notable_trait)`.
|
||||
pub fn is_doc_notable_trait(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||
tcx.get_attrs(def_id, sym::doc)
|
||||
.filter_map(|attr| attr.meta_item_list())
|
||||
.any(|items| items.iter().any(|item| item.has_name(sym::notable_trait)))
|
||||
}
|
||||
|
||||
/// Determines whether an item is an intrinsic by Abi.
|
||||
pub fn is_intrinsic(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||
matches!(tcx.fn_sig(def_id).abi(), Abi::RustIntrinsic | Abi::PlatformIntrinsic)
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut ty::query::Providers) {
|
||||
*providers =
|
||||
ty::query::Providers { normalize_opaque_types, is_doc_hidden, is_intrinsic, ..*providers }
|
||||
*providers = ty::query::Providers {
|
||||
normalize_opaque_types,
|
||||
is_doc_hidden,
|
||||
is_doc_notable_trait,
|
||||
is_intrinsic,
|
||||
..*providers
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ use crate::clean::cfg::Cfg;
|
||||
use crate::clean::clean_visibility;
|
||||
use crate::clean::external_path;
|
||||
use crate::clean::inline::{self, print_inlined_const};
|
||||
use crate::clean::utils::{has_doc_flag, is_literal_expr, print_const_expr, print_evaluated_const};
|
||||
use crate::clean::utils::{is_literal_expr, print_const_expr, print_evaluated_const};
|
||||
use crate::core::DocContext;
|
||||
use crate::formats::cache::Cache;
|
||||
use crate::formats::item_type::ItemType;
|
||||
@ -1524,7 +1524,7 @@ impl Trait {
|
||||
tcx.trait_is_auto(self.def_id)
|
||||
}
|
||||
pub(crate) fn is_notable_trait(&self, tcx: TyCtxt<'_>) -> bool {
|
||||
has_doc_flag(tcx, self.def_id, sym::notable_trait)
|
||||
tcx.is_doc_notable_trait(self.def_id)
|
||||
}
|
||||
pub(crate) fn unsafety(&self, tcx: TyCtxt<'_>) -> hir::Unsafety {
|
||||
tcx.trait_def(self.def_id).unsafety
|
||||
|
Loading…
Reference in New Issue
Block a user