From 5e2cc5793a9cf7cdbb4758ce18470dbdefd8491c Mon Sep 17 00:00:00 2001 From: Alan Egerton Date: Tue, 9 Jul 2024 10:40:26 +0100 Subject: [PATCH 1/2] Terminate `--print link-args` output with newline --- compiler/rustc_codegen_ssa/src/back/link.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 1f627353d54..8e07d128dbd 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -750,7 +750,7 @@ fn link_natively( for print in &sess.opts.prints { if print.kind == PrintKind::LinkArgs { - let content = format!("{cmd:?}"); + let content = format!("{cmd:?}\n"); print.out.overwrite(&content, sess); } } From f96f68f2ec4b512a91b27d1b14d3dae66305cc6e Mon Sep 17 00:00:00 2001 From: Alan Egerton Date: Tue, 9 Jul 2024 23:07:38 +0100 Subject: [PATCH 2/2] Test that `--print link-args` ends in newline --- tests/run-make/link-arg/rmake.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/run-make/link-arg/rmake.rs b/tests/run-make/link-arg/rmake.rs index a6d68800792..c0bf8d972af 100644 --- a/tests/run-make/link-arg/rmake.rs +++ b/tests/run-make/link-arg/rmake.rs @@ -17,4 +17,5 @@ fn main() { .run_unchecked(); out.assert_stdout_contains("lfoo"); out.assert_stdout_contains("lbar"); + assert!(out.stdout_utf8().ends_with('\n')); }