Skip to content

Commit 004614c

Browse files
committed
native lib: defer the duplicate check after relevant_lib check.
1 parent fc81ad2 commit 004614c

File tree

1 file changed

+8
-6
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+8
-6
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -1805,13 +1805,14 @@ fn add_local_native_libraries(
18051805
let search_path = archive_search_paths(sess);
18061806
let mut last = (NativeLibKind::Unspecified, None);
18071807
for lib in relevant_libs {
1808-
// Skip if this library is the same as the last.
1809-
last = if (lib.kind, lib.name) == last { continue } else { (lib.kind, lib.name) };
1810-
18111808
let name = match lib.name {
18121809
Some(l) => l,
18131810
None => continue,
18141811
};
1812+
1813+
// Skip if this library is the same as the last.
1814+
last = if (lib.kind, lib.name) == last { continue } else { (lib.kind, lib.name) };
1815+
18151816
let verbatim = lib.verbatim.unwrap_or(false);
18161817
match lib.kind {
18171818
NativeLibKind::Dylib { as_needed } => {
@@ -2144,16 +2145,17 @@ fn add_upstream_native_libraries(
21442145
let mut last = (NativeLibKind::Unspecified, None);
21452146
for &(cnum, _) in crates {
21462147
for lib in codegen_results.crate_info.native_libraries[&cnum].iter() {
2147-
// Skip if this library is the same as the last.
2148-
last = if (lib.kind, lib.name) == last { continue } else { (lib.kind, lib.name) };
2149-
21502148
let name = match lib.name {
21512149
Some(l) => l,
21522150
None => continue,
21532151
};
21542152
if !relevant_lib(sess, &lib) {
21552153
continue;
21562154
}
2155+
2156+
// Skip if this library is the same as the last.
2157+
last = if (lib.kind, lib.name) == last { continue } else { (lib.kind, lib.name) };
2158+
21572159
let verbatim = lib.verbatim.unwrap_or(false);
21582160
match lib.kind {
21592161
NativeLibKind::Dylib { as_needed } => {

0 commit comments

Comments
 (0)