diff options
| author | binarycat <binarycat@envs.net> | 2025-05-27 12:42:25 -0500 |
|---|---|---|
| committer | binarycat <binarycat@envs.net> | 2025-06-10 12:56:58 -0500 |
| commit | 1140e90074b0cbcfdea8535e4b51877e2838227e (patch) | |
| tree | f3f3b850ab68799f03620f47e021b9e4163bb398 /src/librustdoc/html/render/mod.rs | |
| parent | ccf3198de316b488ee17441935182e9d5292b4d3 (diff) | |
| download | rust-1140e90074b0cbcfdea8535e4b51877e2838227e.tar.gz rust-1140e90074b0cbcfdea8535e4b51877e2838227e.zip | |
rustdoc search: prefer stable items in search results
fixes https://github.com/rust-lang/rust/issues/138067
Diffstat (limited to 'src/librustdoc/html/render/mod.rs')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 66d5aafa3c1..29917bb0fca 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -50,7 +50,8 @@ use std::{fs, str}; use askama::Template; use itertools::Either; use rustc_attr_data_structures::{ - ConstStability, DeprecatedSince, Deprecation, RustcVersion, StabilityLevel, StableSince, + ConstStability, DeprecatedSince, Deprecation, RustcVersion, Stability, StabilityLevel, + StableSince, }; use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_hir::Mutability; @@ -140,6 +141,12 @@ pub(crate) struct IndexItem { pub(crate) search_type: Option<IndexItemFunctionType>, pub(crate) aliases: Box<[Symbol]>, pub(crate) deprecation: Option<Deprecation>, + 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. |
