about summary refs log tree commit diff
path: root/src/librustdoc/formats
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-09 13:58:42 +1000
committerGitHub <noreply@github.com>2025-08-09 13:58:42 +1000
commit48f5929604d04484f6e6d2f047e81ee5df127633 (patch)
tree78d4ca95da692c211090fc0621d11f9b283ae0db /src/librustdoc/formats
parent4c7749e8c8e50ad146da599eea3a250160c1bc2b (diff)
parentfdbc8d08a63a3d34b7aebabb2f18a768462a98c4 (diff)
downloadrust-48f5929604d04484f6e6d2f047e81ee5df127633.tar.gz
rust-48f5929604d04484f6e6d2f047e81ee5df127633.zip
Rollup merge of #141658 - lolbinarycat:rustdoc-search-stability-rank-138067, r=GuillaumeGomez
rustdoc search: prefer stable items in search results

fixes https://github.com/rust-lang/rust/issues/138067

this does add a new field to the search index, but since we're only listing unstable items instead of adding a boolean flag to every item, it should only increase the search index size of sysroot crates, since those are the only ones using the `staged_api` feature, at least as far as the rust project is concerned.
Diffstat (limited to 'src/librustdoc/formats')
-rw-r--r--src/librustdoc/formats/cache.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs
index 80399cf3842..918b292466d 100644
--- a/src/librustdoc/formats/cache.rs
+++ b/src/librustdoc/formats/cache.rs
@@ -602,6 +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),
     };
     cache.search_index.push(index_item);
 }