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:
commit
bdc5adfe78
4 changed files with 9 additions and 4 deletions
|
@ -4300,6 +4300,7 @@ name = "rustc_resolve"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
"itertools",
|
||||||
"pulldown-cmark 0.11.3",
|
"pulldown-cmark 0.11.3",
|
||||||
"rustc_arena",
|
"rustc_arena",
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
|
|
|
@ -6,6 +6,7 @@ edition = "2024"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
bitflags = "2.4.1"
|
bitflags = "2.4.1"
|
||||||
|
itertools = "0.12"
|
||||||
pulldown-cmark = { version = "0.11", features = ["html"], default-features = false }
|
pulldown-cmark = { version = "0.11", features = ["html"], default-features = false }
|
||||||
rustc_arena = { path = "../rustc_arena" }
|
rustc_arena = { path = "../rustc_arena" }
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
||||||
|
use itertools::Itertools;
|
||||||
use pulldown_cmark::{
|
use pulldown_cmark::{
|
||||||
BrokenLink, BrokenLinkCallback, CowStr, Event, LinkType, Options, Parser, Tag,
|
BrokenLink, BrokenLinkCallback, CowStr, Event, LinkType, Options, Parser, Tag,
|
||||||
};
|
};
|
||||||
use rustc_ast as ast;
|
use rustc_ast as ast;
|
||||||
use rustc_ast::attr::AttributeExt;
|
use rustc_ast::attr::AttributeExt;
|
||||||
use rustc_ast::util::comments::beautify_doc_string;
|
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_middle::ty::TyCtxt;
|
||||||
use rustc_span::def_id::DefId;
|
use rustc_span::def_id::DefId;
|
||||||
use rustc_span::{DUMMY_SP, InnerSpan, Span, Symbol, kw, sym};
|
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 links = Vec::new();
|
||||||
|
|
||||||
let mut refids = FxHashSet::default();
|
let mut refids = UnordSet::default();
|
||||||
|
|
||||||
while let Some(event) = event_iter.next() {
|
while let Some(event) = event_iter.next() {
|
||||||
match event {
|
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) {
|
if !refids.contains(label) {
|
||||||
links.push(preprocess_link(&refdef.dest));
|
links.push(preprocess_link(&refdef.dest));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1724,6 +1724,7 @@ pub(crate) fn markdown_links<'md, R>(
|
||||||
md: &'md str,
|
md: &'md str,
|
||||||
preprocess_link: impl Fn(MarkdownLink) -> Option<R>,
|
preprocess_link: impl Fn(MarkdownLink) -> Option<R>,
|
||||||
) -> Vec<R> {
|
) -> Vec<R> {
|
||||||
|
use itertools::Itertools;
|
||||||
if md.is_empty() {
|
if md.is_empty() {
|
||||||
return vec![];
|
return vec![];
|
||||||
}
|
}
|
||||||
|
@ -1882,7 +1883,7 @@ pub(crate) fn markdown_links<'md, R>(
|
||||||
let mut links = Vec::new();
|
let mut links = Vec::new();
|
||||||
|
|
||||||
let mut refdefs = FxIndexMap::default();
|
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()));
|
refdefs.insert(label.to_string(), (false, refdef.dest.to_string(), refdef.span.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue