@@ -22,7 +22,7 @@ use rustc_span::{FileName, FileNameDisplayPreference, RealFileName, SourceFileHa
22
22
use rustc_target:: abi:: Align ;
23
23
use rustc_target:: spec:: LinkSelfContainedComponents ;
24
24
use rustc_target:: spec:: { PanicStrategy , RelocModel , SanitizerSet , SplitDebuginfo } ;
25
- use rustc_target:: spec:: { Target , TargetTriple , TargetWarnings , TARGETS } ;
25
+ use rustc_target:: spec:: { Target , TargetTriple , TARGETS } ;
26
26
use std:: collections:: btree_map:: {
27
27
Iter as BTreeMapIter , Keys as BTreeMapKeysIter , Values as BTreeMapValuesIter ,
28
28
} ;
@@ -1549,34 +1549,25 @@ pub fn build_configuration(sess: &Session, mut user_cfg: Cfg) -> Cfg {
1549
1549
user_cfg
1550
1550
}
1551
1551
1552
- pub fn build_target_config (
1553
- early_dcx : & EarlyDiagCtxt ,
1554
- opts : & Options ,
1555
- target_override : Option < Target > ,
1556
- sysroot : & Path ,
1557
- ) -> Target {
1558
- let target_result = target_override. map_or_else (
1559
- || Target :: search ( & opts. target_triple , sysroot) ,
1560
- |t| Ok ( ( t, TargetWarnings :: empty ( ) ) ) ,
1561
- ) ;
1562
- let ( target, target_warnings) = target_result. unwrap_or_else ( |e| {
1563
- early_dcx. early_fatal ( format ! (
1552
+ pub fn build_target_config ( early_dcx : & EarlyDiagCtxt , opts : & Options , sysroot : & Path ) -> Target {
1553
+ match Target :: search ( & opts. target_triple , sysroot) {
1554
+ Ok ( ( target, warnings) ) => {
1555
+ for warning in warnings. warning_messages ( ) {
1556
+ early_dcx. early_warn ( warning)
1557
+ }
1558
+ if !matches ! ( target. pointer_width, 16 | 32 | 64 ) {
1559
+ early_dcx. early_fatal ( format ! (
1560
+ "target specification was invalid: unrecognized target-pointer-width {}" ,
1561
+ target. pointer_width
1562
+ ) )
1563
+ }
1564
+ target
1565
+ }
1566
+ Err ( e) => early_dcx. early_fatal ( format ! (
1564
1567
"Error loading target specification: {e}. \
1565
- Run `rustc --print target-list` for a list of built-in targets"
1566
- ) )
1567
- } ) ;
1568
- for warning in target_warnings. warning_messages ( ) {
1569
- early_dcx. early_warn ( warning)
1570
- }
1571
-
1572
- if !matches ! ( target. pointer_width, 16 | 32 | 64 ) {
1573
- early_dcx. early_fatal ( format ! (
1574
- "target specification was invalid: unrecognized target-pointer-width {}" ,
1575
- target. pointer_width
1576
- ) )
1568
+ Run `rustc --print target-list` for a list of built-in targets"
1569
+ ) ) ,
1577
1570
}
1578
-
1579
- target
1580
1571
}
1581
1572
1582
1573
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
0 commit comments