Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c4a7cb7

Browse files
committedMay 20, 2024
Always emit native-static-libs note, even if it is empty
1 parent d84b903 commit c4a7cb7

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed
 

‎compiler/rustc_codegen_ssa/src/back/link.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -1536,17 +1536,13 @@ fn print_native_static_libs(
15361536
match out {
15371537
OutFileName::Real(path) => {
15381538
out.overwrite(&lib_args.join(" "), sess);
1539-
if !lib_args.is_empty() {
1540-
sess.dcx().emit_note(errors::StaticLibraryNativeArtifactsToFile { path });
1541-
}
1539+
sess.dcx().emit_note(errors::StaticLibraryNativeArtifactsToFile { path });
15421540
}
15431541
OutFileName::Stdout => {
1544-
if !lib_args.is_empty() {
1545-
sess.dcx().emit_note(errors::StaticLibraryNativeArtifacts);
1546-
// Prefix for greppability
1547-
// Note: This must not be translated as tools are allowed to depend on this exact string.
1548-
sess.dcx().note(format!("native-static-libs: {}", &lib_args.join(" ")));
1549-
}
1542+
sess.dcx().emit_note(errors::StaticLibraryNativeArtifacts);
1543+
// Prefix for greppability
1544+
// Note: This must not be translated as tools are allowed to depend on this exact string.
1545+
sess.dcx().note(format!("native-static-libs: {}", &lib_args.join(" ")));
15501546
}
15511547
}
15521548
}

‎tests/ui/codegen/issue-108825.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
#![crate_type = "staticlib"]
6+
#![no_std]
7+
8+
#[panic_handler]
9+
fn panic(_info: &core::panic::PanicInfo) -> ! {
10+
loop {}
11+
}

‎tests/ui/codegen/issue-108825.stderr

+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)
Failed to load comments.