Skip to content

Commit 2820fcc

Browse files
Revert "rustdoc: IndexItem::{stability -> is_unstable}"
This reverts commit 5e8ebd5.
1 parent 1975b06 commit 2820fcc

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/librustdoc/formats/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
602602
search_type,
603603
aliases,
604604
deprecation,
605-
is_unstable: item.stability(tcx).map(|x| x.is_unstable()).unwrap_or(false),
605+
stability: item.stability(tcx),
606606
};
607607
cache.search_index.push(index_item);
608608
}

src/librustdoc/html/render/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,12 @@ pub(crate) struct IndexItem {
139139
pub(crate) search_type: Option<IndexItemFunctionType>,
140140
pub(crate) aliases: Box<[Symbol]>,
141141
pub(crate) deprecation: Option<Deprecation>,
142-
pub(crate) is_unstable: bool,
142+
pub(crate) stability: Option<Stability>,
143+
}
144+
impl IndexItem {
145+
fn is_unstable(&self) -> bool {
146+
matches!(&self.stability, Some(Stability { level: StabilityLevel::Unstable { .. }, .. }))
147+
}
143148
}
144149

145150
/// A type used for the search index.

src/librustdoc/html/render/search_index.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub(crate) fn build_index(
9393
),
9494
aliases: item.attrs.get_doc_aliases(),
9595
deprecation: item.deprecation(tcx),
96-
is_unstable: item.stability(tcx).is_some_and(|x| x.is_unstable()),
96+
stability: item.stability(tcx),
9797
});
9898
}
9999
}
@@ -713,7 +713,7 @@ pub(crate) fn build_index(
713713
// bitmasks always use 1-indexing for items, with 0 as the crate itself
714714
deprecated.push(u32::try_from(index + 1).unwrap());
715715
}
716-
if item.is_unstable {
716+
if item.is_unstable() {
717717
unstable.push(u32::try_from(index + 1).unwrap());
718718
}
719719
}

0 commit comments

Comments
 (0)