Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1536,17 +1536,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(" ")));
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/codegen/empty-static-libs-issue-108825.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Test that linking a no_std application still outputs the
// `native-static-libs: ` note, even though it's empty.
//@ compile-flags: -Cpanic=abort --print=native-static-libs
//@ build-pass
//@ ignore-wasm
//@ ignore-cross-compile This doesn't produce any output on i686-unknown-linux-gnu for some reason?

#![crate_type = "staticlib"]
#![no_std]

#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}
4 changes: 4 additions & 0 deletions tests/ui/codegen/empty-static-libs-issue-108825.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
note: Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.

note: native-static-libs:

Loading