1
Fork 0

Rollup merge of #138678 - durin42:rmeta-stability, r=fmease

rustc_resolve: fix instability in lib.rmeta contents

rust-lang/rust@23032f31c9 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.
This commit is contained in:
Matthias Krüger 2025-03-28 12:59:55 +01:00 committed by GitHub
commit bdc5adfe78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

View file

@ -1,13 +1,15 @@
use std::mem;
use std::ops::Range;
use itertools::Itertools;
use pulldown_cmark::{
BrokenLink, BrokenLinkCallback, CowStr, Event, LinkType, Options, Parser, Tag,
};
use rustc_ast as ast;
use rustc_ast::attr::AttributeExt;
use rustc_ast::util::comments::beautify_doc_string;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::unord::UnordSet;
use rustc_middle::ty::TyCtxt;
use rustc_span::def_id::DefId;
use rustc_span::{DUMMY_SP, InnerSpan, Span, Symbol, kw, sym};
@ -422,7 +424,7 @@ fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> {
);
let mut links = Vec::new();
let mut refids = FxHashSet::default();
let mut refids = UnordSet::default();
while let Some(event) = event_iter.next() {
match event {
@ -454,7 +456,7 @@ fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> {
}
}
for (label, refdef) in event_iter.reference_definitions().iter() {
for (label, refdef) in event_iter.reference_definitions().iter().sorted_by_key(|x| x.0) {
if !refids.contains(label) {
links.push(preprocess_link(&refdef.dest));
}