1
Fork 0

Always emit native-static-libs note, even if it is empty

This commit is contained in:
Mads Marquart 2024-02-17 04:31:46 +01:00
parent 65899c06f1
commit d1cd621b55
2 changed files with 21 additions and 9 deletions

View file

@ -1560,17 +1560,13 @@ fn print_native_static_libs(
match out {
OutFileName::Real(path) => {
out.overwrite(&lib_args.join(" "), sess);
if !lib_args.is_empty() {
sess.dcx().emit_note(errors::StaticLibraryNativeArtifactsToFile { path });
}
sess.dcx().emit_note(errors::StaticLibraryNativeArtifactsToFile { path });
}
OutFileName::Stdout => {
if !lib_args.is_empty() {
sess.dcx().emit_note(errors::StaticLibraryNativeArtifacts);
// Prefix for greppability
// Note: This must not be translated as tools are allowed to depend on this exact string.
sess.dcx().note(format!("native-static-libs: {}", lib_args.join(" ")));
}
sess.dcx().emit_note(errors::StaticLibraryNativeArtifacts);
// Prefix for greppability
// Note: This must not be translated as tools are allowed to depend on this exact string.
sess.dcx().note(format!("native-static-libs: {}", lib_args.join(" ")));
}
}
}

View file

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