File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
compiler/rustc_middle/src/ty/print Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use crate::ty::{
88} ;
99use crate :: ty:: { GenericArg , GenericArgKind } ;
1010use rustc_apfloat:: ieee:: { Double , Single } ;
11+ use rustc_apfloat:: Float ;
1112use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap } ;
1213use rustc_data_structures:: sso:: SsoHashSet ;
1314use rustc_hir as hir;
@@ -1477,10 +1478,12 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
14771478 ty:: Bool if int == ScalarInt :: TRUE => p ! ( "true" ) ,
14781479 // Float
14791480 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 { "_" } ) )
14811483 }
14821484 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 { "_" } ) )
14841487 }
14851488 // Int
14861489 ty:: Uint ( _) | ty:: Int ( _) => {
You can’t perform that action at this time.
0 commit comments