De-duplicate all consecutive native libs regardless of their options

This commit is contained in:
Urgau 2024-06-25 13:18:19 +02:00
parent e23ae72ac7
commit 604caa09ed
2 changed files with 8 additions and 5 deletions

View File

@ -1490,11 +1490,6 @@ fn print_native_static_libs(
let mut lib_args: Vec<_> = all_native_libs let mut lib_args: Vec<_> = all_native_libs
.iter() .iter()
.filter(|l| relevant_lib(sess, l)) .filter(|l| relevant_lib(sess, l))
// Deduplication of successive repeated libraries, see rust-lang/rust#113209
//
// note: we don't use PartialEq/Eq because NativeLib transitively depends on local
// elements like spans, which we don't care about and would make the deduplication impossible
.dedup_by(|l1, l2| l1.name == l2.name && l1.kind == l2.kind && l1.verbatim == l2.verbatim)
.filter_map(|lib| { .filter_map(|lib| {
let name = lib.name; let name = lib.name;
match lib.kind { match lib.kind {
@ -1521,6 +1516,8 @@ fn print_native_static_libs(
| NativeLibKind::RawDylib => None, | NativeLibKind::RawDylib => None,
} }
}) })
// deduplication of consecutive repeated libraries, see rust-lang/rust#113209
.dedup()
.collect(); .collect();
for path in all_rust_dylibs { for path in all_rust_dylibs {
// FIXME deduplicate with add_dynamic_crate // FIXME deduplicate with add_dynamic_crate

View File

@ -17,3 +17,9 @@ pub extern "C" fn my_bar_add(left: i32, right: i32) -> i32 {
extern "C" { extern "C" {
fn g_free2(p: *mut ()); fn g_free2(p: *mut ());
} }
#[cfg(windows)]
#[link(name = "glib-2.0", kind = "raw-dylib")]
extern "C" {
fn g_free3(p: *mut ());
}