diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-08-14 13:04:08 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-08-14 13:04:08 +0200 |
| commit | 2820fcc8302d25acdefbcfd4351831441dc177c6 (patch) | |
| tree | ce525c48f93a30477e7611406f000c2ade903a45 | |
| parent | 1975b06583cb558f82d8cc92ab5b672d9290acf3 (diff) | |
| download | rust-2820fcc8302d25acdefbcfd4351831441dc177c6.tar.gz rust-2820fcc8302d25acdefbcfd4351831441dc177c6.zip | |
Revert "rustdoc: IndexItem::{stability -> is_unstable}"
This reverts commit 5e8ebd5ecd8546591a6707ac9e1a3b8a64c72f76.
| -rw-r--r-- | src/librustdoc/formats/cache.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 7 | ||||
| -rw-r--r-- | src/librustdoc/html/render/search_index.rs | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index 918b292466d..1e674cc5e89 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -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); } diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 95259847075..41ebaeade1d 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -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. diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index 93c9df8c049..8d510a393df 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -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()); } } |
