Revert "rustdoc: IndexItem::{stability -> is_unstable}"

This reverts commit 5e8ebd5ecd.
This commit is contained in:
Guillaume Gomez 2025-08-14 13:04:08 +02:00
parent 1975b06583
commit 2820fcc830
3 changed files with 9 additions and 4 deletions

View file

@ -602,7 +602,7 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
search_type,
aliases,
deprecation,
is_unstable: item.stability(tcx).map(|x| x.is_unstable()).unwrap_or(false),
stability: item.stability(tcx),
};
cache.search_index.push(index_item);
}

View file

@ -139,7 +139,12 @@ pub(crate) struct IndexItem {
pub(crate) search_type: Option<IndexItemFunctionType>,
pub(crate) aliases: Box<[Symbol]>,
pub(crate) deprecation: Option<Deprecation>,
pub(crate) is_unstable: bool,
pub(crate) stability: Option<Stability>,
}
impl IndexItem {
fn is_unstable(&self) -> bool {
matches!(&self.stability, Some(Stability { level: StabilityLevel::Unstable { .. }, .. }))
}
}
/// A type used for the search index.

View file

@ -93,7 +93,7 @@ pub(crate) fn build_index(
),
aliases: item.attrs.get_doc_aliases(),
deprecation: item.deprecation(tcx),
is_unstable: item.stability(tcx).is_some_and(|x| x.is_unstable()),
stability: item.stability(tcx),
});
}
}
@ -713,7 +713,7 @@ pub(crate) fn build_index(
// bitmasks always use 1-indexing for items, with 0 as the crate itself
deprecated.push(u32::try_from(index + 1).unwrap());
}
if item.is_unstable {
if item.is_unstable() {
unstable.push(u32::try_from(index + 1).unwrap());
}
}