about summary refs log tree commit diff
path: root/src/librustc_interface
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2020-04-06 00:53:43 +0200
committerGitHub <noreply@github.com>2020-04-06 00:53:43 +0200
commitaafbe07af3eb9b497c5c24db0a5c7253b2125bbf (patch)
tree7b3e41c22dd1e72db2296cbee22cc6f4bb5b7436 /src/librustc_interface
parentbe93b1cdc5fbc94d4ab0c58f4c1542c1e45da877 (diff)
parent13bd25e4722a02f7b38797c7d116bfb9d1667e72 (diff)
Rollup merge of #70665 - petrochenkov:linkargs, r=nagisa
Do not lose or reorder user-provided linker arguments

Linker arguments are potentially order-dependent, so the order in which `-C link-arg` and `-C link-args` options are passed to `rustc` should be preserved when they are passed further to the linker.

Also, multiple `-C link-args` options are now appended to each other rather than overwrite each other.

In other words, `-C link-arg=a -C link-args="b c" -C link-args="d e" -C link-arg=f` is now passed as `"a" "b" "c" "d" "e" "f"` and not as `"d" "e" "a" "f"`.

Addresses https://github.com/rust-lang/rust/pull/70505#issuecomment-606780163.
Diffstat (limited to 'src/librustc_interface')
-rw-r--r--src/librustc_interface/tests.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_interface/tests.rs b/src/librustc_interface/tests.rs
index f58c5cc8eeb..b452ccfe33a 100644
--- a/src/librustc_interface/tests.rs
+++ b/src/librustc_interface/tests.rs
@@ -382,7 +382,7 @@ fn test_codegen_options_tracking_hash() {
     opts.cg.linker = Some(PathBuf::from("linker"));
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
-    opts.cg.link_args = Some(vec![String::from("abc"), String::from("def")]);
+    opts.cg.link_args = vec![String::from("abc"), String::from("def")];
     assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
 
     opts.cg.link_dead_code = true;