diff options
| author | Michael Goulet <michael@errs.io> | 2023-11-24 23:35:05 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-11-24 23:35:18 +0000 |
| commit | b601b40b402028639cac8d6b87e6a9cabd11b457 (patch) | |
| tree | fba297b08a47211c07c73fae959ba9bd415662ef /compiler/rustc_middle/src/ty | |
| parent | 4fd68eb47bad1c121417ac4450b2f0456150db86 (diff) | |
| download | rust-b601b40b402028639cac8d6b87e6a9cabd11b457.tar.gz rust-b601b40b402028639cac8d6b87e6a9cabd11b457.zip | |
Separate Nan/Inf floats with _
Diffstat (limited to 'compiler/rustc_middle/src/ty')
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 25a151443d5..2bde339ec77 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -8,6 +8,7 @@ use crate::ty::{ }; use crate::ty::{GenericArg, GenericArgKind}; use rustc_apfloat::ieee::{Double, Single}; +use rustc_apfloat::Float; use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; use rustc_data_structures::sso::SsoHashSet; use rustc_hir as hir; @@ -1477,10 +1478,12 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { ty::Bool if int == ScalarInt::TRUE => p!("true"), // Float ty::Float(ty::FloatTy::F32) => { - p!(write("{}f32", Single::try_from(int).unwrap())) + let val = Single::try_from(int).unwrap(); + p!(write("{}{}f32", val, if val.is_finite() { "" } else { "_" })) } ty::Float(ty::FloatTy::F64) => { - p!(write("{}f64", Double::try_from(int).unwrap())) + let val = Double::try_from(int).unwrap(); + p!(write("{}{}f64", val, if val.is_finite() { "" } else { "_" })) } // Int ty::Uint(_) | ty::Int(_) => { |
