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 {
46
46
. output ( )
47
47
. unwrap_or_else ( |e| panic ! ( "failed to run `{cmd:?}`: {e}" ) ) ;
48
48
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.
49
52
let rustc_output_ok = out. status . success ( ) ;
50
53
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" ) ;
52
55
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" ) ;
54
57
55
58
Self {
56
59
triple,
Original file line number Diff line number Diff line change @@ -43,9 +43,16 @@ impl Config {
43
43
let out = cmd
44
44
. output ( )
45
45
. unwrap_or_else ( |e| panic ! ( "failed to run `{cmd:?}`: {e}" ) ) ;
46
- assert ! ( out. status. success( ) , "failed to run `{cmd:?}`" ) ;
47
46
let rustc_cfg = str:: from_utf8 ( & out. stdout ) . unwrap ( ) ;
48
47
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
+
49
56
Self {
50
57
target_triple,
51
58
manifest_dir : PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ,
@@ -59,8 +66,8 @@ impl Config {
59
66
target_string : env:: var ( "TARGET" ) . unwrap ( ) ,
60
67
target_vendor : env:: var ( "CARGO_CFG_TARGET_VENDOR" ) . unwrap ( ) ,
61
68
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,
64
71
}
65
72
}
66
73
}
You can’t perform that action at this time.
0 commit comments