@@ -581,8 +581,10 @@ pub struct TargetOptions {
581581 /// user-defined libraries.
582582 pub post_link_args : LinkArgs ,
583583
584- /// Environment variables to be set before invoking the linker.
584+ /// Environment variables to be set for the linker invocation .
585585 pub link_env : Vec < ( String , String ) > ,
586+ /// Environment variables to be removed for the linker invocation.
587+ pub link_env_remove : Vec < String > ,
586588
587589 /// Extra arguments to pass to the external assembler (when used)
588590 pub asm_args : Vec < String > ,
@@ -844,6 +846,7 @@ impl Default for TargetOptions {
844846 post_link_objects_crt : Vec :: new ( ) ,
845847 late_link_args : LinkArgs :: new ( ) ,
846848 link_env : Vec :: new ( ) ,
849+ link_env_remove : Vec :: new ( ) ,
847850 archive_format : "gnu" . to_string ( ) ,
848851 custom_unwind_resume : false ,
849852 allow_asm : true ,
@@ -1119,6 +1122,7 @@ impl Target {
11191122 key ! ( post_link_objects_crt, list) ;
11201123 key ! ( post_link_args, link_args) ;
11211124 key ! ( link_env, env) ;
1125+ key ! ( link_env_remove, list) ;
11221126 key ! ( asm_args, list) ;
11231127 key ! ( cpu) ;
11241128 key ! ( features) ;
@@ -1335,6 +1339,7 @@ impl ToJson for Target {
13351339 target_option_val ! ( post_link_objects_crt) ;
13361340 target_option_val ! ( link_args - post_link_args) ;
13371341 target_option_val ! ( env - link_env) ;
1342+ target_option_val ! ( link_env_remove) ;
13381343 target_option_val ! ( asm_args) ;
13391344 target_option_val ! ( cpu) ;
13401345 target_option_val ! ( features) ;
0 commit comments