@@ -682,34 +682,29 @@ impl<'cfg> RustcTargetData<'cfg> {
682
682
) -> CargoResult < RustcTargetData < ' cfg > > {
683
683
let config = ws. config ( ) ;
684
684
let rustc = config. load_global_rustc ( Some ( ws) ) ?;
685
- let host_info = TargetInfo :: new ( config, requested_kinds, & rustc, CompileKind :: Host ) ?;
686
685
let mut target_config = HashMap :: new ( ) ;
687
686
let mut target_info = HashMap :: new ( ) ;
687
+ let target_applies_to_host = config. target_applies_to_host ( ) ?;
688
+ let host_info = TargetInfo :: new ( config, requested_kinds, & rustc, CompileKind :: Host ) ?;
689
+ let host_config = if target_applies_to_host {
690
+ config. target_cfg_triple ( & rustc. host ) ?
691
+ } else {
692
+ config. host_cfg_triple ( & rustc. host ) ?
693
+ } ;
688
694
689
695
// This is a hack. The unit_dependency graph builder "pretends" that
690
696
// `CompileKind::Host` is `CompileKind::Target(host)` if the
691
697
// `--target` flag is not specified. Since the unit_dependency code
692
698
// needs access to the target config data, create a copy so that it
693
699
// can be found. See `rebuild_unit_graph_shared` for why this is done.
694
- let target_applies_to_host = config. target_applies_to_host ( ) ?;
695
- let host_config = if requested_kinds. iter ( ) . any ( CompileKind :: is_host) {
700
+ if requested_kinds. iter ( ) . any ( CompileKind :: is_host) {
696
701
let ct = CompileTarget :: new ( & rustc. host ) ?;
697
702
target_info. insert ( ct, host_info. clone ( ) ) ;
698
- let target_host_config = if target_applies_to_host {
699
- let target_cfg_clone = config. target_cfg_triple ( & rustc. host ) ?;
700
- target_config. insert ( ct, target_cfg_clone. clone ( ) ) ;
701
- target_cfg_clone
703
+ if target_applies_to_host {
704
+ target_config. insert ( ct, host_config. clone ( ) ) ;
702
705
} else {
703
706
target_config. insert ( ct, config. target_cfg_triple ( & rustc. host ) ?) ;
704
- config. host_cfg_triple ( & rustc. host ) ?
705
707
} ;
706
- target_host_config
707
- } else {
708
- if target_applies_to_host {
709
- config. target_cfg_triple ( & rustc. host ) ?
710
- } else {
711
- config. host_cfg_triple ( & rustc. host ) ?
712
- }
713
708
} ;
714
709
715
710
let mut res = RustcTargetData {
0 commit comments