File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,14 @@ impl Target {
4646 . output ( )
4747 . unwrap_or_else ( |e| panic ! ( "failed to run `{cmd:?}`: {e}" ) ) ;
4848 let rustc_cfg = str:: from_utf8 ( & out. stdout ) . unwrap ( ) ;
49+
50+ // If we couldn't query `rustc` (e.g. a custom JSON target was used), make the safe
51+ // choice and leave `f16` and `f128` disabled.
4952 let rustc_output_ok = out. status . success ( ) ;
5053 let reliable_f128 =
51- ! rustc_output_ok || rustc_cfg. lines ( ) . any ( |l| l == "target_has_reliable_f128" ) ;
54+ rustc_output_ok && rustc_cfg. lines ( ) . any ( |l| l == "target_has_reliable_f128" ) ;
5255 let reliable_f16 =
53- ! rustc_output_ok || rustc_cfg. lines ( ) . any ( |l| l == "target_has_reliable_f16" ) ;
56+ rustc_output_ok && rustc_cfg. lines ( ) . any ( |l| l == "target_has_reliable_f16" ) ;
5457
5558 Self {
5659 triple,
Original file line number Diff line number Diff line change @@ -43,9 +43,16 @@ impl Config {
4343 let out = cmd
4444 . output ( )
4545 . unwrap_or_else ( |e| panic ! ( "failed to run `{cmd:?}`: {e}" ) ) ;
46- assert ! ( out. status. success( ) , "failed to run `{cmd:?}`" ) ;
4746 let rustc_cfg = str:: from_utf8 ( & out. stdout ) . unwrap ( ) ;
4847
48+ // If we couldn't query `rustc` (e.g. a custom JSON target was used), make the safe
49+ // choice and leave `f16` and `f128` disabled.
50+ let rustc_output_ok = out. status . success ( ) ;
51+ let reliable_f128 =
52+ rustc_output_ok && rustc_cfg. lines ( ) . any ( |l| l == "target_has_reliable_f128" ) ;
53+ let reliable_f16 =
54+ rustc_output_ok && rustc_cfg. lines ( ) . any ( |l| l == "target_has_reliable_f16" ) ;
55+
4956 Self {
5057 target_triple,
5158 manifest_dir : PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ,
@@ -59,8 +66,8 @@ impl Config {
5966 target_string : env:: var ( "TARGET" ) . unwrap ( ) ,
6067 target_vendor : env:: var ( "CARGO_CFG_TARGET_VENDOR" ) . unwrap ( ) ,
6168 target_features,
62- reliable_f128 : rustc_cfg . lines ( ) . any ( |l| l == "target_has_reliable_f128" ) ,
63- reliable_f16 : rustc_cfg . lines ( ) . any ( |l| l == "target_has_reliable_f16" ) ,
69+ reliable_f128,
70+ reliable_f16,
6471 }
6572 }
6673}
You can’t perform that action at this time.
0 commit comments