Skip to content

Commit a5709f3

Browse files
authored
Rollup merge of rust-lang#121216 - madsmtm:fix-108825, r=wesleywiser
Always emit `native-static-libs` note, even if it is empty Fixes rust-lang#108825.
2 parents f158600 + 5cfe020 commit a5709f3

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

Diff for: compiler/rustc_codegen_ssa/src/back/link.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -1561,17 +1561,13 @@ fn print_native_static_libs(
15611561
match out {
15621562
OutFileName::Real(path) => {
15631563
out.overwrite(&lib_args.join(" "), sess);
1564-
if !lib_args.is_empty() {
1565-
sess.dcx().emit_note(errors::StaticLibraryNativeArtifactsToFile { path });
1566-
}
1564+
sess.dcx().emit_note(errors::StaticLibraryNativeArtifactsToFile { path });
15671565
}
15681566
OutFileName::Stdout => {
1569-
if !lib_args.is_empty() {
1570-
sess.dcx().emit_note(errors::StaticLibraryNativeArtifacts);
1571-
// Prefix for greppability
1572-
// Note: This must not be translated as tools are allowed to depend on this exact string.
1573-
sess.dcx().note(format!("native-static-libs: {}", &lib_args.join(" ")));
1574-
}
1567+
sess.dcx().emit_note(errors::StaticLibraryNativeArtifacts);
1568+
// Prefix for greppability
1569+
// Note: This must not be translated as tools are allowed to depend on this exact string.
1570+
sess.dcx().note(format!("native-static-libs: {}", &lib_args.join(" ")));
15751571
}
15761572
}
15771573
}

Diff for: tests/ui/codegen/empty-static-libs-issue-108825.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Test that linking a no_std application still outputs the
2+
// `native-static-libs: ` note, even though it's empty.
3+
//@ compile-flags: -Cpanic=abort --print=native-static-libs
4+
//@ build-pass
5+
//@ ignore-wasm
6+
//@ ignore-cross-compile This doesn't produce any output on i686-unknown-linux-gnu for some reason?
7+
8+
#![crate_type = "staticlib"]
9+
#![no_std]
10+
11+
#[panic_handler]
12+
fn panic(_info: &core::panic::PanicInfo) -> ! {
13+
loop {}
14+
}
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
note: Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.
2+
3+
note: native-static-libs:
4+

0 commit comments

Comments
 (0)