@@ -296,9 +296,17 @@ macro_rules! options {
296
296
use std:: path:: PathBuf ;
297
297
use std:: str :: FromStr ;
298
298
299
+ // Sometimes different options need to build a common structure.
300
+ // That structure can kept in one of the options' fields, the others become dummy.
301
+ macro_rules! redirect_field {
302
+ ( $cg: ident. link_arg) => { $cg. link_args } ;
303
+ ( $cg: ident. pre_link_arg) => { $cg. pre_link_args } ;
304
+ ( $cg: ident. $field: ident) => { $cg. $field } ;
305
+ }
306
+
299
307
$(
300
308
pub fn $opt( cg: & mut $struct_name, v: Option <& str >) -> bool {
301
- $parse( & mut cg. $opt, v)
309
+ $parse( & mut redirect_field! ( cg. $opt) , v)
302
310
}
303
311
) *
304
312
@@ -643,9 +651,9 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
643
651
"this option is deprecated and does nothing" ) ,
644
652
linker: Option <PathBuf > = ( None , parse_opt_pathbuf, [ UNTRACKED ] ,
645
653
"system linker to link outputs with" ) ,
646
- link_arg: Vec < String > = ( vec! [ ] , parse_string_push, [ UNTRACKED ] ,
654
+ link_arg: ( /* redirected to link_args */ ) = ( ( ) , parse_string_push, [ UNTRACKED ] ,
647
655
"a single extra argument to append to the linker invocation (can be used several times)" ) ,
648
- link_args: Option < Vec <String >> = ( None , parse_opt_list , [ UNTRACKED ] ,
656
+ link_args: Vec <String > = ( Vec :: new ( ) , parse_list , [ UNTRACKED ] ,
649
657
"extra arguments to append to the linker invocation (space separated)" ) ,
650
658
link_dead_code: bool = ( false , parse_bool, [ UNTRACKED ] ,
651
659
"don't let linker strip dead code (turning it on can be used for code coverage)" ) ,
@@ -876,9 +884,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
876
884
"make rustc print the total optimization fuel used by a crate" ) ,
877
885
force_unstable_if_unmarked: bool = ( false , parse_bool, [ TRACKED ] ,
878
886
"force all crates to be `rustc_private` unstable" ) ,
879
- pre_link_arg: Vec < String > = ( vec! [ ] , parse_string_push, [ UNTRACKED ] ,
887
+ pre_link_arg: ( /* redirected to pre_link_args */ ) = ( ( ) , parse_string_push, [ UNTRACKED ] ,
880
888
"a single extra argument to prepend the linker invocation (can be used several times)" ) ,
881
- pre_link_args: Option < Vec <String >> = ( None , parse_opt_list , [ UNTRACKED ] ,
889
+ pre_link_args: Vec <String > = ( Vec :: new ( ) , parse_list , [ UNTRACKED ] ,
882
890
"extra arguments to prepend to the linker invocation (space separated)" ) ,
883
891
profile: bool = ( false , parse_bool, [ TRACKED ] ,
884
892
"insert profiling code" ) ,
0 commit comments