about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAugie Fackler <augie@google.com>2025-03-27 11:59:04 -0400
committerAugie Fackler <augie@google.com>2025-03-27 11:59:04 -0400
commit77eb97d9a983f213cff1df7e02a4a96273653482 (patch)
tree785739ceeb1075ecfc3a3d27fc05170614fa06c4
parent795a6669f83274ce3ada1046e6c9284b8e900a98 (diff)
downloadrust-77eb97d9a983f213cff1df7e02a4a96273653482.tar.gz
rust-77eb97d9a983f213cff1df7e02a4a96273653482.zip
librustdoc: also stabilize iteration order here
-rw-r--r--src/librustdoc/html/markdown.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index b067dbf750e..7606128e9e8 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -1726,6 +1726,7 @@ pub(crate) fn markdown_links<'md, R>(
     md: &'md str,
     preprocess_link: impl Fn(MarkdownLink) -> Option<R>,
 ) -> Vec<R> {
+    use itertools::Itertools;
     if md.is_empty() {
         return vec![];
     }
@@ -1884,7 +1885,7 @@ pub(crate) fn markdown_links<'md, R>(
     let mut links = Vec::new();
 
     let mut refdefs = FxIndexMap::default();
-    for (label, refdef) in event_iter.reference_definitions().iter() {
+    for (label, refdef) in event_iter.reference_definitions().iter().sorted_by_key(|x| x.0) {
         refdefs.insert(label.to_string(), (false, refdef.dest.to_string(), refdef.span.clone()));
     }