rustc_codegen_ssa: Enforce rustc::potential_query_instability lint

This commit is contained in:
Jakub Beránek 2023-12-29 13:41:35 +01:00
parent 95613d1b23
commit 4612edc53f
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
5 changed files with 30 additions and 11 deletions

View file

@ -906,17 +906,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