@@ -315,7 +315,6 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
315
315
paths:: create_dir_all ( & script_dir) ?;
316
316
paths:: create_dir_all ( & script_out_dir) ?;
317
317
318
- let extra_link_arg = cx. bcx . config . cli_unstable ( ) . extra_link_arg ;
319
318
let nightly_features_allowed = cx. bcx . config . nightly_features_allowed ;
320
319
let targets: Vec < Target > = unit. pkg . targets ( ) . to_vec ( ) ;
321
320
// Need a separate copy for the fresh closure.
@@ -427,7 +426,6 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
427
426
& pkg_descr,
428
427
& script_out_dir,
429
428
& script_out_dir,
430
- extra_link_arg,
431
429
nightly_features_allowed,
432
430
& targets,
433
431
) ?;
@@ -455,7 +453,6 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
455
453
& pkg_descr,
456
454
& prev_script_out_dir,
457
455
& script_out_dir,
458
- extra_link_arg,
459
456
nightly_features_allowed,
460
457
& targets_fresh,
461
458
) ?,
@@ -508,7 +505,6 @@ impl BuildOutput {
508
505
pkg_descr : & str ,
509
506
script_out_dir_when_generated : & Path ,
510
507
script_out_dir : & Path ,
511
- extra_link_arg : bool ,
512
508
nightly_features_allowed : bool ,
513
509
targets : & [ Target ] ,
514
510
) -> CargoResult < BuildOutput > {
@@ -519,7 +515,6 @@ impl BuildOutput {
519
515
pkg_descr,
520
516
script_out_dir_when_generated,
521
517
script_out_dir,
522
- extra_link_arg,
523
518
nightly_features_allowed,
524
519
targets,
525
520
)
@@ -535,7 +530,6 @@ impl BuildOutput {
535
530
pkg_descr : & str ,
536
531
script_out_dir_when_generated : & Path ,
537
532
script_out_dir : & Path ,
538
- extra_link_arg : bool ,
539
533
nightly_features_allowed : bool ,
540
534
targets : & [ Target ] ,
541
535
) -> CargoResult < BuildOutput > {
@@ -606,59 +600,47 @@ impl BuildOutput {
606
600
linker_args. push ( ( LinkType :: Cdylib , value) )
607
601
}
608
602
"rustc-link-arg-bins" => {
609
- if extra_link_arg {
610
- if !targets. iter ( ) . any ( |target| target. is_bin ( ) ) {
611
- bail ! (
612
- "invalid instruction `cargo:{}` from {}\n \
613
- The package {} does not have a bin target.",
614
- key,
615
- whence,
616
- pkg_descr
617
- ) ;
618
- }
619
- linker_args. push ( ( LinkType :: Bin , value) ) ;
620
- } else {
621
- warnings. push ( format ! ( "cargo:{} requires -Zextra-link-arg flag" , key) ) ;
603
+ if !targets. iter ( ) . any ( |target| target. is_bin ( ) ) {
604
+ bail ! (
605
+ "invalid instruction `cargo:{}` from {}\n \
606
+ The package {} does not have a bin target.",
607
+ key,
608
+ whence,
609
+ pkg_descr
610
+ ) ;
622
611
}
612
+ linker_args. push ( ( LinkType :: Bin , value) ) ;
623
613
}
624
614
"rustc-link-arg-bin" => {
625
- if extra_link_arg {
626
- let mut parts = value. splitn ( 2 , '=' ) ;
627
- let bin_name = parts. next ( ) . unwrap ( ) . to_string ( ) ;
628
- let arg = parts. next ( ) . ok_or_else ( || {
629
- anyhow:: format_err!(
630
- "invalid instruction `cargo:{}={}` from {}\n \
631
- The instruction should have the form cargo:{}=BIN=ARG",
632
- key,
633
- value,
634
- whence,
635
- key
636
- )
637
- } ) ?;
638
- if !targets
639
- . iter ( )
640
- . any ( |target| target. is_bin ( ) && target. name ( ) == bin_name)
641
- {
642
- bail ! (
643
- "invalid instruction `cargo:{}` from {}\n \
644
- The package {} does not have a bin target with the name `{}`.",
645
- key,
646
- whence,
647
- pkg_descr,
648
- bin_name
649
- ) ;
650
- }
651
- linker_args. push ( ( LinkType :: SingleBin ( bin_name) , arg. to_string ( ) ) ) ;
652
- } else {
653
- warnings. push ( format ! ( "cargo:{} requires -Zextra-link-arg flag" , key) ) ;
615
+ let mut parts = value. splitn ( 2 , '=' ) ;
616
+ let bin_name = parts. next ( ) . unwrap ( ) . to_string ( ) ;
617
+ let arg = parts. next ( ) . ok_or_else ( || {
618
+ anyhow:: format_err!(
619
+ "invalid instruction `cargo:{}={}` from {}\n \
620
+ The instruction should have the form cargo:{}=BIN=ARG",
621
+ key,
622
+ value,
623
+ whence,
624
+ key
625
+ )
626
+ } ) ?;
627
+ if !targets
628
+ . iter ( )
629
+ . any ( |target| target. is_bin ( ) && target. name ( ) == bin_name)
630
+ {
631
+ bail ! (
632
+ "invalid instruction `cargo:{}` from {}\n \
633
+ The package {} does not have a bin target with the name `{}`.",
634
+ key,
635
+ whence,
636
+ pkg_descr,
637
+ bin_name
638
+ ) ;
654
639
}
640
+ linker_args. push ( ( LinkType :: SingleBin ( bin_name) , arg. to_string ( ) ) ) ;
655
641
}
656
642
"rustc-link-arg" => {
657
- if extra_link_arg {
658
- linker_args. push ( ( LinkType :: All , value) ) ;
659
- } else {
660
- warnings. push ( format ! ( "cargo:{} requires -Zextra-link-arg flag" , key) ) ;
661
- }
643
+ linker_args. push ( ( LinkType :: All , value) ) ;
662
644
}
663
645
"rustc-cfg" => cfgs. push ( value. to_string ( ) ) ,
664
646
"rustc-env" => {
@@ -953,16 +935,13 @@ fn prev_build_output(cx: &mut Context<'_, '_>, unit: &Unit) -> (Option<BuildOutp
953
935
. and_then ( |bytes| paths:: bytes2path ( & bytes) )
954
936
. unwrap_or_else ( |_| script_out_dir. clone ( ) ) ;
955
937
956
- let extra_link_arg = cx. bcx . config . cli_unstable ( ) . extra_link_arg ;
957
-
958
938
(
959
939
BuildOutput :: parse_file (
960
940
& output_file,
961
941
unit. pkg . library ( ) . map ( |t| t. crate_name ( ) ) ,
962
942
& unit. pkg . to_string ( ) ,
963
943
& prev_script_out_dir,
964
944
& script_out_dir,
965
- extra_link_arg,
966
945
cx. bcx . config . nightly_features_allowed ,
967
946
unit. pkg . targets ( ) ,
968
947
)
0 commit comments