rustdoc: trait.impl, type.impl: sort impls to make it not depend on serialization order
This commit is contained in:
parent
c401f09979
commit
cb4e69ad67
@ -593,11 +593,17 @@ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
|||||||
ret
|
ret
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let impls = format!(
|
|
||||||
r#""{}":{}"#,
|
// FIXME: this fixes only rustdoc part of instability of trait impls
|
||||||
krate.name(cx.tcx()),
|
// for js files, see #120371
|
||||||
serde_json::to_string(&impls).expect("failed serde conversion"),
|
// 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();
|
let mut mydst = dst.clone();
|
||||||
for part in &aliased_type.target_fqp[..aliased_type.target_fqp.len() - 1] {
|
for part in &aliased_type.target_fqp[..aliased_type.target_fqp.len() - 1] {
|
||||||
@ -702,11 +708,16 @@ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let implementors = format!(
|
// FIXME: this fixes only rustdoc part of instability of trait impls
|
||||||
r#""{}":{}"#,
|
// for js files, see #120371
|
||||||
krate.name(cx.tcx()),
|
// Manually collect to string and sort to make list not depend on order
|
||||||
serde_json::to_string(&implementors).expect("failed serde conversion"),
|
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();
|
let mut mydst = dst.clone();
|
||||||
for part in &remote_path[..remote_path.len() - 1] {
|
for part in &remote_path[..remote_path.len() - 1] {
|
||||||
|
Loading…
Reference in New Issue
Block a user