Skip to content

Commit a9e5982

Browse files
committed
Always emit native-static-libs note, even if it is empty
1 parent 7d49ae9 commit a9e5982

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,17 +1559,13 @@ fn print_native_static_libs(
15591559
match out {
15601560
OutFileName::Real(path) => {
15611561
out.overwrite(&lib_args.join(" "), sess);
1562-
if !lib_args.is_empty() {
1563-
sess.dcx().emit_note(errors::StaticLibraryNativeArtifactsToFile { path });
1564-
}
1562+
sess.dcx().emit_note(errors::StaticLibraryNativeArtifactsToFile { path });
15651563
}
15661564
OutFileName::Stdout => {
1567-
if !lib_args.is_empty() {
1568-
sess.dcx().emit_note(errors::StaticLibraryNativeArtifacts);
1569-
// Prefix for greppability
1570-
// Note: This must not be translated as tools are allowed to depend on this exact string.
1571-
sess.dcx().note(format!("native-static-libs: {}", lib_args.join(" ")));
1572-
}
1565+
sess.dcx().emit_note(errors::StaticLibraryNativeArtifacts);
1566+
// Prefix for greppability
1567+
// Note: This must not be translated as tools are allowed to depend on this exact string.
1568+
sess.dcx().note(format!("native-static-libs: {}", lib_args.join(" ")));
15731569
}
15741570
}
15751571
}
Lines changed: 14 additions & 0 deletions
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+
4+
//@ compile-flags: -Cpanic=abort --print=native-static-libs
5+
//@ build-pass
6+
//@ ignore-windows-msvc libcore links `/defaultlib:msvcrt` or `/defaultlib:libcmt`
7+
8+
#![crate_type = "staticlib"]
9+
#![no_std]
10+
11+
#[panic_handler]
12+
fn panic(_info: &core::panic::PanicInfo) -> ! {
13+
loop {}
14+
}
Lines changed: 4 additions & 0 deletions
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)