1
Fork 0

Auto merge of #119409 - Kobzol:rustc-codegen-ssa-query-instability, r=Nilstrieb

rustc_codegen_ssa: Enforce `rustc::potential_query_instability` lint

Part of https://github.com/rust-lang/rust/issues/84447.
This commit is contained in:
bors 2024-01-13 18:07:59 +00:00
commit 23148b175b
5 changed files with 30 additions and 11 deletions

View file

@ -912,17 +912,22 @@ impl CrateInfo {
})
.collect();
let prefix = if target.is_like_windows && target.arch == "x86" { "_" } else { "" };
// This loop only adds new items to values of the hash map, so the order in which we
// iterate over the values is not important.
#[allow(rustc::potential_query_instability)]
info.linked_symbols
.iter_mut()
.filter(|(crate_type, _)| {
!matches!(crate_type, CrateType::Rlib | CrateType::Staticlib)
})
.for_each(|(_, linked_symbols)| {
linked_symbols.extend(
missing_weak_lang_items
.iter()
.map(|item| (format!("{prefix}{item}"), SymbolExportKind::Text)),
);
let mut symbols = missing_weak_lang_items
.iter()
.map(|item| (format!("{prefix}{item}"), SymbolExportKind::Text))
.collect::<Vec<_>>();
symbols.sort_unstable_by(|a, b| a.0.cmp(&b.0));
linked_symbols.extend(symbols);
if tcx.allocator_kind(()).is_some() {
// At least one crate needs a global allocator. This crate may be placed
// after the crate that defines it in the linker order, in which case some