File tree 1 file changed +5
-2
lines changed
compiler/rustc_middle/src/ty/print
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use crate::ty::{
8
8
} ;
9
9
use crate :: ty:: { GenericArg , GenericArgKind } ;
10
10
use rustc_apfloat:: ieee:: { Double , Single } ;
11
+ use rustc_apfloat:: Float ;
11
12
use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap } ;
12
13
use rustc_data_structures:: sso:: SsoHashSet ;
13
14
use rustc_hir as hir;
@@ -1477,10 +1478,12 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1477
1478
ty:: Bool if int == ScalarInt :: TRUE => p ! ( "true" ) ,
1478
1479
// Float
1479
1480
ty:: Float ( ty:: FloatTy :: F32 ) => {
1480
- p ! ( write( "{}f32" , Single :: try_from( int) . unwrap( ) ) )
1481
+ let val = Single :: try_from ( int) . unwrap ( ) ;
1482
+ p ! ( write( "{}{}f32" , val, if val. is_finite( ) { "" } else { "_" } ) )
1481
1483
}
1482
1484
ty:: Float ( ty:: FloatTy :: F64 ) => {
1483
- p ! ( write( "{}f64" , Double :: try_from( int) . unwrap( ) ) )
1485
+ let val = Double :: try_from ( int) . unwrap ( ) ;
1486
+ p ! ( write( "{}{}f64" , val, if val. is_finite( ) { "" } else { "_" } ) )
1484
1487
}
1485
1488
// Int
1486
1489
ty:: Uint ( _) | ty:: Int ( _) => {
You can’t perform that action at this time.
0 commit comments