about summary refs log tree commit diff
path: root/tests/rustdoc-js
diff options
context:
space:
mode:
authorbinarycat <binarycat@envs.net>2025-05-27 12:42:25 -0500
committerbinarycat <binarycat@envs.net>2025-06-10 12:56:58 -0500
commit1140e90074b0cbcfdea8535e4b51877e2838227e (patch)
treef3f3b850ab68799f03620f47e021b9e4163bb398 /tests/rustdoc-js
parentccf3198de316b488ee17441935182e9d5292b4d3 (diff)
downloadrust-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 'tests/rustdoc-js')
-rw-r--r--tests/rustdoc-js/sort-stability.js9
-rw-r--r--tests/rustdoc-js/sort-stability.rs16
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/rustdoc-js/sort-stability.js b/tests/rustdoc-js/sort-stability.js
new file mode 100644
index 00000000000..8c095619a08
--- /dev/null
+++ b/tests/rustdoc-js/sort-stability.js
@@ -0,0 +1,9 @@
+const EXPECTED = [
+    {
+        'query': 'foo',
+        'others': [
+            {"path": "sort_stability::old", "name": "foo"},
+            {"path": "sort_stability::new", "name": "foo"},
+        ],
+    },
+];
diff --git a/tests/rustdoc-js/sort-stability.rs b/tests/rustdoc-js/sort-stability.rs
new file mode 100644
index 00000000000..68662bb3aab
--- /dev/null
+++ b/tests/rustdoc-js/sort-stability.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+#![stable(feature = "foo_lib", since = "1.0.0")]
+
+#[stable(feature = "old_foo", since = "1.0.1")]
+pub mod old {
+    /// Old, stable foo
+    #[stable(feature = "old_foo", since = "1.0.1")]
+    pub fn foo() {}
+}
+
+#[unstable(feature = "new_foo", issue = "none")]
+pub mod new {
+    /// New, unstable foo
+    #[unstable(feature = "new_foo", issue = "none")]
+    pub fn foo() {}
+}