@@ -409,23 +409,24 @@ pub(crate) fn validate_codegen_backends(backends: Vec<String>, section: &str) ->
409
409
}
410
410
backends
411
411
}
412
+
412
413
#[ cfg( not( test) ) ]
413
- fn default_lld_opt_in_targets ( ) -> & ' static [ & ' static str ] {
414
- & [ "x86_64-unknown-linux-gnu" ]
414
+ fn default_lld_opt_in_targets ( ) -> Vec < String > {
415
+ vec ! [ "x86_64-unknown-linux-gnu" . to_string ( ) ]
415
416
}
416
417
417
418
#[ cfg( test) ]
418
419
thread_local ! {
419
- static TEST_LLD_OPT_IN_TARGETS : std:: cell:: RefCell <Option <& ' static [ & ' static str ] >> = std:: cell:: RefCell :: new( None ) ;
420
+ static TEST_LLD_OPT_IN_TARGETS : std:: cell:: RefCell <Option <Vec < String > >> = std:: cell:: RefCell :: new( None ) ;
420
421
}
421
422
422
423
#[ cfg( test) ]
423
- fn default_lld_opt_in_targets ( ) -> & ' static [ & ' static str ] {
424
- TEST_LLD_OPT_IN_TARGETS . with ( |cell| cell. borrow ( ) . unwrap_or ( & [ ] ) )
424
+ fn default_lld_opt_in_targets ( ) -> Vec < String > {
425
+ TEST_LLD_OPT_IN_TARGETS . with ( |cell| cell. borrow ( ) . clone ( ) ) . unwrap_or_default ( )
425
426
}
426
427
427
428
#[ cfg( test) ]
428
- pub fn with_lld_opt_in_targets < R > ( targets : & ' static [ & ' static str ] , f : impl FnOnce ( ) -> R ) -> R {
429
+ pub fn with_lld_opt_in_targets < R > ( targets : Vec < String > , f : impl FnOnce ( ) -> R ) -> R {
429
430
TEST_LLD_OPT_IN_TARGETS . with ( |cell| {
430
431
let prev = cell. replace ( Some ( targets) ) ;
431
432
let result = f ( ) ;
@@ -633,13 +634,13 @@ impl Config {
633
634
// thus, disabled
634
635
// - similarly, lld will not be built nor used by default when explicitly asked not to, e.g.
635
636
// when the config sets `rust.lld = false`
636
- if default_lld_opt_in_targets ( ) . contains ( & self . host_target . triple . to_string ( ) . as_str ( ) )
637
+ if default_lld_opt_in_targets ( ) . contains ( & self . host_target . triple . to_string ( ) )
637
638
&& self . hosts == [ self . host_target ]
638
639
{
639
640
let no_llvm_config = self
640
641
. target_config
641
642
. get ( & self . host_target )
642
- . is_some_and ( |target_config| target_config. llvm_config . is_none ( ) ) ;
643
+ . is_none_or ( |target_config| target_config. llvm_config . is_none ( ) ) ;
643
644
let enable_lld = self . llvm_from_ci || no_llvm_config;
644
645
// Prefer the config setting in case an explicit opt-out is needed.
645
646
self . lld_enabled = lld_enabled. unwrap_or ( enable_lld) ;
0 commit comments