about summary refs log tree commit diff
path: root/src/librustdoc/html/render/write_shared.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-06 05:27:55 +0000
committerbors <bors@rust-lang.org>2024-02-06 05:27:55 +0000
commit35551d059c17ed89aefdd0d3b4194f61fa5e312f (patch)
tree78f8824f1d20458c113d6148421ee9b9e8482910 /src/librustdoc/html/render/write_shared.rs
parentf45a5b10a071f9f5b259a6502ed9b39243d1d7b5 (diff)
parent08e774179e237ec9235760104eb01c3fa481b3fe (diff)
downloadrust-35551d059c17ed89aefdd0d3b4194f61fa5e312f.tar.gz
rust-35551d059c17ed89aefdd0d3b4194f61fa5e312f.zip
Auto merge of #3291 - rust-lang:rustup-2024-02-06, r=saethlin
Automatic Rustup
Diffstat (limited to 'src/librustdoc/html/render/write_shared.rs')
-rw-r--r--src/librustdoc/html/render/write_shared.rs31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
index 6408e97df50..fbd45b2b48e 100644
--- a/src/librustdoc/html/render/write_shared.rs
+++ b/src/librustdoc/html/render/write_shared.rs
@@ -593,11 +593,17 @@ else if (window.initSearch) window.initSearch(searchIndex);
                 ret
             })
             .collect::<Vec<_>>();
-        let impls = format!(
-            r#""{}":{}"#,
-            krate.name(cx.tcx()),
-            serde_json::to_string(&impls).expect("failed serde conversion"),
-        );
+
+        // FIXME: this fixes only rustdoc part of instability of trait impls
+        // for js files, see #120371
+        // Manually collect to string and sort to make list not depend on order
+        let mut impls = impls
+            .iter()
+            .map(|i| serde_json::to_string(i).expect("failed serde conversion"))
+            .collect::<Vec<_>>();
+        impls.sort();
+
+        let impls = format!(r#""{}":[{}]"#, krate.name(cx.tcx()), impls.join(","));
 
         let mut mydst = dst.clone();
         for part in &aliased_type.target_fqp[..aliased_type.target_fqp.len() - 1] {
@@ -702,11 +708,16 @@ else if (window.initSearch) window.initSearch(searchIndex);
             continue;
         }
 
-        let implementors = format!(
-            r#""{}":{}"#,
-            krate.name(cx.tcx()),
-            serde_json::to_string(&implementors).expect("failed serde conversion"),
-        );
+        // FIXME: this fixes only rustdoc part of instability of trait impls
+        // for js files, see #120371
+        // Manually collect to string and sort to make list not depend on order
+        let mut implementors = implementors
+            .iter()
+            .map(|i| serde_json::to_string(i).expect("failed serde conversion"))
+            .collect::<Vec<_>>();
+        implementors.sort();
+
+        let implementors = format!(r#""{}":[{}]"#, krate.name(cx.tcx()), implementors.join(","));
 
         let mut mydst = dst.clone();
         for part in &remote_path[..remote_path.len() - 1] {