File tree 2 files changed +25
-14
lines changed
2 files changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ pub(crate) mod ast_ty {
131
131
use crate :: ir:: function:: FunctionSig ;
132
132
use crate :: ir:: layout:: Layout ;
133
133
use crate :: ir:: ty:: { FloatKind , IntKind } ;
134
+ use crate :: RustTarget ;
134
135
use proc_macro2:: TokenStream ;
135
136
use std:: str:: FromStr ;
136
137
@@ -312,35 +313,44 @@ pub(crate) mod ast_ty {
312
313
}
313
314
314
315
let prefix = ctx. trait_prefix ( ) ;
316
+ let rust_target = ctx. options ( ) . rust_target ;
315
317
316
318
if f. is_nan ( ) {
317
- return Ok ( quote ! {
318
- if rust_target >= RustTarget :: Stable_1_43 {
319
+ let tokens = if rust_target >= RustTarget :: Stable_1_43 {
320
+ quote ! {
319
321
f64 :: NAN
320
- } else {
322
+ }
323
+ } else {
324
+ quote ! {
321
325
:: #prefix:: f64 :: NAN
322
326
}
323
- } ) ;
327
+ } ;
328
+ return Ok ( tokens) ;
324
329
}
325
330
326
331
if f. is_infinite ( ) {
327
- return Ok ( if f. is_sign_positive ( ) {
328
- quote ! {
329
- if rust_target >= RustTarget :: Stable_1_43 {
332
+ let tokens = if f. is_sign_positive ( ) {
333
+ if rust_target >= RustTarget :: Stable_1_43 {
334
+ quote ! {
330
335
f64 :: INFINITY
331
- } else {
336
+ }
337
+ } else {
338
+ quote ! {
332
339
:: #prefix:: f64 :: INFINITY
333
340
}
334
341
}
335
- } else {
336
- quote ! {
337
- if rust_target >= RustTarget :: Stable_1_43 {
342
+ } else { // sign_negative
343
+ if rust_target >= RustTarget :: Stable_1_43 {
344
+ quote ! {
338
345
f64 :: NEG_INFINITY
339
- } else {
346
+ }
347
+ } else {
348
+ quote ! {
340
349
:: #prefix:: f64 :: NEG_INFINITY
341
350
}
342
351
}
343
- } ) ;
352
+ } ;
353
+ return Ok ( tokens) ;
344
354
}
345
355
346
356
warn ! ( "Unknown non-finite float number: {:?}" , f) ;
Original file line number Diff line number Diff line change @@ -106,7 +106,8 @@ define_rust_targets! {
106
106
Stable_1_64 ( 64 ) => { core_ffi_c: #94503 } ,
107
107
Stable_1_59 ( 59 ) => { const_cstr: #54745 } ,
108
108
Stable_1_47 ( 47 ) => { larger_arrays: #74060 } ,
109
- Stable_1_40 ( 40 ) => { non_exhaustive: #44109 } ,
109
+ Stable_1_43 ( 43 ) => { non_exhaustive: #44109 } ,
110
+ Stable_1_40 ( 40 ) => { } ,
110
111
Stable_1_36 ( 36 ) => { maybe_uninit: #60445 } ,
111
112
Stable_1_33 ( 33 ) => { repr_packed_n: #57049 } ,
112
113
#[ deprecated]
You can’t perform that action at this time.
0 commit comments