Skip to content

Commit 8b6d60d

Browse files
committed
rustc_resolve: fix instability in lib.rmeta contents
23032f31c91f2 accidentally introduced some nondeterminism in the ordering of lib.rmeta files, which we caught in our bazel-based builds only recently due to being further behind than normal. In my testing, this fixes the issue.
1 parent 75530e9 commit 8b6d60d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

compiler/rustc_resolve/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2024"
66
[dependencies]
77
# tidy-alphabetical-start
88
bitflags = "2.4.1"
9+
itertools = "0.12"
910
pulldown-cmark = { version = "0.11", features = ["html"], default-features = false }
1011
rustc_arena = { path = "../rustc_arena" }
1112
rustc_ast = { path = "../rustc_ast" }

compiler/rustc_resolve/src/rustdoc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::mem;
22
use std::ops::Range;
33

4+
use itertools::Itertools;
45
use pulldown_cmark::{
56
BrokenLink, BrokenLinkCallback, CowStr, Event, LinkType, Options, Parser, Tag,
67
};
@@ -454,7 +455,7 @@ fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> {
454455
}
455456
}
456457

457-
for (label, refdef) in event_iter.reference_definitions().iter() {
458+
for (label, refdef) in event_iter.reference_definitions().iter().sorted_by_key(|x| x.0) {
458459
if !refids.contains(label) {
459460
links.push(preprocess_link(&refdef.dest));
460461
}

0 commit comments

Comments
 (0)