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,12 +1560,9 @@ 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 });
}
}
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.
@ -1573,7 +1570,6 @@ fn print_native_static_libs(
}
}
}
}
fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> PathBuf {
let file_path = sess.target_tlib_path.dir.join(name);

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 {}
}