1
Fork 0

Auto merge of #102384 - camelid:extrainfo, r=GuillaumeGomez

rustdoc: Remove `clean::TraitWithExtraInfo` and queryify `is_notable_trait`

cc `@notriddle` `@GuillaumeGomez`
This commit is contained in:
bors 2022-09-28 22:15:28 +00:00
commit b30c88623c
10 changed files with 39 additions and 33 deletions

View file

@ -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.

View file

@ -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
}
}