@@ -593,11 +593,17 @@ else if (window.initSearch) window.initSearch(searchIndex);
593593 ret
594594 } )
595595 . collect :: < Vec < _ > > ( ) ;
596- let impls = format ! (
597- r#""{}":{}"# ,
598- krate. name( cx. tcx( ) ) ,
599- serde_json:: to_string( & impls) . expect( "failed serde conversion" ) ,
600- ) ;
596+
597+ // FIXME: this fixes only rustdoc part of instability of trait impls
598+ // for js files, see #120371
599+ // Manually collect to string and sort to make list not depend on order
600+ let mut impls = impls
601+ . iter ( )
602+ . map ( |i| serde_json:: to_string ( i) . expect ( "failed serde conversion" ) )
603+ . collect :: < Vec < _ > > ( ) ;
604+ impls. sort ( ) ;
605+
606+ let impls = format ! ( r#""{}":[{}]"# , krate. name( cx. tcx( ) ) , impls. join( "," ) ) ;
601607
602608 let mut mydst = dst. clone ( ) ;
603609 for part in & aliased_type. target_fqp [ ..aliased_type. target_fqp . len ( ) - 1 ] {
@@ -702,11 +708,16 @@ else if (window.initSearch) window.initSearch(searchIndex);
702708 continue ;
703709 }
704710
705- let implementors = format ! (
706- r#""{}":{}"# ,
707- krate. name( cx. tcx( ) ) ,
708- serde_json:: to_string( & implementors) . expect( "failed serde conversion" ) ,
709- ) ;
711+ // FIXME: this fixes only rustdoc part of instability of trait impls
712+ // for js files, see #120371
713+ // Manually collect to string and sort to make list not depend on order
714+ let mut implementors = implementors
715+ . iter ( )
716+ . map ( |i| serde_json:: to_string ( i) . expect ( "failed serde conversion" ) )
717+ . collect :: < Vec < _ > > ( ) ;
718+ implementors. sort ( ) ;
719+
720+ let implementors = format ! ( r#""{}":[{}]"# , krate. name( cx. tcx( ) ) , implementors. join( "," ) ) ;
710721
711722 let mut mydst = dst. clone ( ) ;
712723 for part in & remote_path[ ..remote_path. len ( ) - 1 ] {
0 commit comments