Skip to content

Commit d1cd621

Browse files
committed
Always emit native-static-libs note, even if it is empty
1 parent 65899c0 commit d1cd621

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

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

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

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

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//! Test that linking a no_std application still outputs the
2+
//! `native-static-libs: ` note, even though it is empty.
3+
4+
//@ compile-flags: -Cpanic=abort --print=native-static-libs
5+
//@ build-pass
6+
//@ error-pattern: note: native-static-libs:
7+
//@ dont-check-compiler-stderr (libcore links `/defaultlib:msvcrt` or `/defaultlib:libcmt` on MSVC)
8+
//@ ignore-pass (the note is emitted later in the compilation pipeline, needs build)
9+
10+
#![crate_type = "staticlib"]
11+
#![no_std]
12+
13+
#[panic_handler]
14+
fn panic(_info: &core::panic::PanicInfo) -> ! {
15+
loop {}
16+
}

0 commit comments

Comments
 (0)