Access members of FormattingOptions
directly instead of via getters/setters
This commit is contained in:
parent
2f9e0c984b
commit
31a5657109
4 changed files with 205 additions and 205 deletions
|
@ -86,7 +86,7 @@ where
|
||||||
true => flt2dec::Sign::MinusPlus,
|
true => flt2dec::Sign::MinusPlus,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(precision) = fmt.precision() {
|
if let Some(precision) = fmt.options.precision {
|
||||||
float_to_decimal_common_exact(fmt, num, sign, precision)
|
float_to_decimal_common_exact(fmt, num, sign, precision)
|
||||||
} else {
|
} else {
|
||||||
let min_precision = 0;
|
let min_precision = 0;
|
||||||
|
@ -162,7 +162,7 @@ where
|
||||||
true => flt2dec::Sign::MinusPlus,
|
true => flt2dec::Sign::MinusPlus,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(precision) = fmt.precision() {
|
if let Some(precision) = fmt.options.precision {
|
||||||
// 1 integral digit + `precision` fractional digits = `precision + 1` total digits
|
// 1 integral digit + `precision` fractional digits = `precision + 1` total digits
|
||||||
float_to_exponential_common_exact(fmt, num, sign, precision + 1, upper)
|
float_to_exponential_common_exact(fmt, num, sign, precision + 1, upper)
|
||||||
} else {
|
} else {
|
||||||
|
@ -180,7 +180,7 @@ where
|
||||||
true => flt2dec::Sign::MinusPlus,
|
true => flt2dec::Sign::MinusPlus,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(precision) = fmt.precision() {
|
if let Some(precision) = fmt.options.precision {
|
||||||
// this behavior of {:.PREC?} predates exponential formatting for {:?}
|
// this behavior of {:.PREC?} predates exponential formatting for {:?}
|
||||||
float_to_decimal_common_exact(fmt, num, sign, precision)
|
float_to_decimal_common_exact(fmt, num, sign, precision)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1466,14 +1466,14 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::Placeholder, args: &[rt::Argument<'_>]) -> Result {
|
unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::Placeholder, args: &[rt::Argument<'_>]) -> Result {
|
||||||
fmt.options.fill(arg.fill);
|
fmt.options.fill = arg.fill;
|
||||||
fmt.options.align(arg.align.into());
|
fmt.options.align = arg.align.into();
|
||||||
fmt.options.flags(arg.flags);
|
fmt.options.flags = arg.flags;
|
||||||
// SAFETY: arg and args come from the same Arguments,
|
// SAFETY: arg and args come from the same Arguments,
|
||||||
// which guarantees the indexes are always within bounds.
|
// which guarantees the indexes are always within bounds.
|
||||||
unsafe {
|
unsafe {
|
||||||
fmt.options.width(getcount(args, &arg.width));
|
fmt.options.width = getcount(args, &arg.width);
|
||||||
fmt.options.precision(getcount(args, &arg.precision));
|
fmt.options.precision = getcount(args, &arg.precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the correct argument
|
// Extract the correct argument
|
||||||
|
@ -1613,7 +1613,7 @@ impl<'a> Formatter<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The `width` field is more of a `min-width` parameter at this point.
|
// The `width` field is more of a `min-width` parameter at this point.
|
||||||
match self.width() {
|
match self.options.width {
|
||||||
// If there's no minimum length requirements then we can just
|
// If there's no minimum length requirements then we can just
|
||||||
// write the bytes.
|
// write the bytes.
|
||||||
None => {
|
None => {
|
||||||
|
@ -1682,12 +1682,12 @@ impl<'a> Formatter<'a> {
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn pad(&mut self, s: &str) -> Result {
|
pub fn pad(&mut self, s: &str) -> Result {
|
||||||
// Make sure there's a fast path up front
|
// Make sure there's a fast path up front
|
||||||
if self.width().is_none() && self.precision().is_none() {
|
if self.options.width.is_none() && self.options.precision.is_none() {
|
||||||
return self.buf.write_str(s);
|
return self.buf.write_str(s);
|
||||||
}
|
}
|
||||||
// The `precision` field can be interpreted as a `max-width` for the
|
// The `precision` field can be interpreted as a `max-width` for the
|
||||||
// string being formatted.
|
// string being formatted.
|
||||||
let s = if let Some(max) = self.precision() {
|
let s = if let Some(max) = self.options.precision {
|
||||||
// If our string is longer that the precision, then we must have
|
// If our string is longer that the precision, then we must have
|
||||||
// truncation. However other flags like `fill`, `width` and `align`
|
// truncation. However other flags like `fill`, `width` and `align`
|
||||||
// must act as always.
|
// must act as always.
|
||||||
|
@ -1704,7 +1704,7 @@ impl<'a> Formatter<'a> {
|
||||||
&s
|
&s
|
||||||
};
|
};
|
||||||
// The `width` field is more of a `min-width` parameter at this point.
|
// The `width` field is more of a `min-width` parameter at this point.
|
||||||
match self.width() {
|
match self.options.width {
|
||||||
// If we're under the maximum length, and there's no minimum length
|
// If we're under the maximum length, and there's no minimum length
|
||||||
// requirements, then we can just emit the string
|
// requirements, then we can just emit the string
|
||||||
None => self.buf.write_str(s),
|
None => self.buf.write_str(s),
|
||||||
|
@ -1745,10 +1745,10 @@ impl<'a> Formatter<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
for _ in 0..pre_pad {
|
for _ in 0..pre_pad {
|
||||||
self.buf.write_char(self.fill())?;
|
self.buf.write_char(self.options.fill)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(PostPadding::new(self.fill(), post_pad))
|
Ok(PostPadding::new(self.options.fill, post_pad))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Takes the formatted parts and applies the padding.
|
/// Takes the formatted parts and applies the padding.
|
||||||
|
@ -1760,12 +1760,12 @@ impl<'a> Formatter<'a> {
|
||||||
///
|
///
|
||||||
/// Any `numfmt::Part::Copy` parts in `formatted` must contain valid UTF-8.
|
/// Any `numfmt::Part::Copy` parts in `formatted` must contain valid UTF-8.
|
||||||
unsafe fn pad_formatted_parts(&mut self, formatted: &numfmt::Formatted<'_>) -> Result {
|
unsafe fn pad_formatted_parts(&mut self, formatted: &numfmt::Formatted<'_>) -> Result {
|
||||||
if let Some(mut width) = self.width() {
|
if let Some(mut width) = self.options.width {
|
||||||
// for the sign-aware zero padding, we render the sign first and
|
// for the sign-aware zero padding, we render the sign first and
|
||||||
// behave as if we had no sign from the beginning.
|
// behave as if we had no sign from the beginning.
|
||||||
let mut formatted = formatted.clone();
|
let mut formatted = formatted.clone();
|
||||||
let old_fill = self.fill();
|
let old_fill = self.options.fill;
|
||||||
let old_align = self.align();
|
let old_align = self.options.align;
|
||||||
if self.sign_aware_zero_pad() {
|
if self.sign_aware_zero_pad() {
|
||||||
// a sign always goes first
|
// a sign always goes first
|
||||||
let sign = formatted.sign;
|
let sign = formatted.sign;
|
||||||
|
@ -1774,8 +1774,8 @@ impl<'a> Formatter<'a> {
|
||||||
// remove the sign from the formatted parts
|
// remove the sign from the formatted parts
|
||||||
formatted.sign = "";
|
formatted.sign = "";
|
||||||
width = width.saturating_sub(sign.len());
|
width = width.saturating_sub(sign.len());
|
||||||
self.options.fill('0');
|
self.options.fill = '0';
|
||||||
self.options.align(Some(Alignment::Right));
|
self.options.align = Some(Alignment::Right);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remaining parts go through the ordinary padding process.
|
// remaining parts go through the ordinary padding process.
|
||||||
|
@ -1792,8 +1792,8 @@ impl<'a> Formatter<'a> {
|
||||||
}
|
}
|
||||||
post_padding.write(self)
|
post_padding.write(self)
|
||||||
};
|
};
|
||||||
self.options.fill(old_fill);
|
self.options.fill = old_fill;
|
||||||
self.options.align(old_align);
|
self.options.align = old_align;
|
||||||
ret
|
ret
|
||||||
} else {
|
} else {
|
||||||
// this is the common case and we take a shortcut
|
// this is the common case and we take a shortcut
|
||||||
|
@ -1919,7 +1919,7 @@ impl<'a> Formatter<'a> {
|
||||||
or `sign_aware_zero_pad` methods instead"
|
or `sign_aware_zero_pad` methods instead"
|
||||||
)]
|
)]
|
||||||
pub fn flags(&self) -> u32 {
|
pub fn flags(&self) -> u32 {
|
||||||
self.options.get_flags()
|
self.options.flags
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the character used as 'fill' whenever there is alignment.
|
/// Returns the character used as 'fill' whenever there is alignment.
|
||||||
|
@ -1952,7 +1952,7 @@ impl<'a> Formatter<'a> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
||||||
pub fn fill(&self) -> char {
|
pub fn fill(&self) -> char {
|
||||||
self.options.get_fill()
|
self.options.fill
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a flag indicating what form of alignment was requested.
|
/// Returns a flag indicating what form of alignment was requested.
|
||||||
|
@ -1987,7 +1987,7 @@ impl<'a> Formatter<'a> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "fmt_flags_align", since = "1.28.0")]
|
#[stable(feature = "fmt_flags_align", since = "1.28.0")]
|
||||||
pub fn align(&self) -> Option<Alignment> {
|
pub fn align(&self) -> Option<Alignment> {
|
||||||
self.options.get_align()
|
self.options.align
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the optionally specified integer width that the output should be.
|
/// Returns the optionally specified integer width that the output should be.
|
||||||
|
@ -2017,7 +2017,7 @@ impl<'a> Formatter<'a> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
||||||
pub fn width(&self) -> Option<usize> {
|
pub fn width(&self) -> Option<usize> {
|
||||||
self.options.get_width()
|
self.options.width
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the optionally specified precision for numeric types.
|
/// Returns the optionally specified precision for numeric types.
|
||||||
|
@ -2048,7 +2048,7 @@ impl<'a> Formatter<'a> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
||||||
pub fn precision(&self) -> Option<usize> {
|
pub fn precision(&self) -> Option<usize> {
|
||||||
self.options.get_precision()
|
self.options.precision
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determines if the `+` flag was specified.
|
/// Determines if the `+` flag was specified.
|
||||||
|
@ -2080,7 +2080,7 @@ impl<'a> Formatter<'a> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
||||||
pub fn sign_plus(&self) -> bool {
|
pub fn sign_plus(&self) -> bool {
|
||||||
self.options.get_sign() == Some(Sign::Plus)
|
self.options.flags & (1 << rt::Flag::SignPlus as u32) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determines if the `-` flag was specified.
|
/// Determines if the `-` flag was specified.
|
||||||
|
@ -2109,7 +2109,7 @@ impl<'a> Formatter<'a> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
||||||
pub fn sign_minus(&self) -> bool {
|
pub fn sign_minus(&self) -> bool {
|
||||||
self.options.get_sign() == Some(Sign::Minus)
|
self.options.flags & (1 << rt::Flag::SignMinus as u32) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determines if the `#` flag was specified.
|
/// Determines if the `#` flag was specified.
|
||||||
|
@ -2137,7 +2137,7 @@ impl<'a> Formatter<'a> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
||||||
pub fn alternate(&self) -> bool {
|
pub fn alternate(&self) -> bool {
|
||||||
self.options.get_alternate()
|
self.options.flags & (1 << rt::Flag::Alternate as u32) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determines if the `0` flag was specified.
|
/// Determines if the `0` flag was specified.
|
||||||
|
@ -2163,7 +2163,7 @@ impl<'a> Formatter<'a> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
#[stable(feature = "fmt_flags", since = "1.5.0")]
|
||||||
pub fn sign_aware_zero_pad(&self) -> bool {
|
pub fn sign_aware_zero_pad(&self) -> bool {
|
||||||
self.options.get_sign_aware_zero_pad()
|
self.options.flags & (1 << rt::Flag::SignAwareZeroPad as u32) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Decide what public API we want for these two flags.
|
// FIXME: Decide what public API we want for these two flags.
|
||||||
|
@ -2753,7 +2753,7 @@ impl Debug for char {
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl Display for char {
|
impl Display for char {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
||||||
if f.width().is_none() && f.precision().is_none() {
|
if f.options.width.is_none() && f.options.precision.is_none() {
|
||||||
f.write_char(*self)
|
f.write_char(*self)
|
||||||
} else {
|
} else {
|
||||||
f.pad(self.encode_utf8(&mut [0; 4]))
|
f.pad(self.encode_utf8(&mut [0; 4]))
|
||||||
|
@ -2777,28 +2777,26 @@ impl<T: ?Sized> Pointer for *const T {
|
||||||
///
|
///
|
||||||
/// [problematic]: https://github.com/rust-lang/rust/issues/95489
|
/// [problematic]: https://github.com/rust-lang/rust/issues/95489
|
||||||
pub(crate) fn pointer_fmt_inner(ptr_addr: usize, f: &mut Formatter<'_>) -> Result {
|
pub(crate) fn pointer_fmt_inner(ptr_addr: usize, f: &mut Formatter<'_>) -> Result {
|
||||||
let old_width = f.width();
|
let old_width = f.options.width;
|
||||||
let old_alternate = f.alternate();
|
let old_flags = f.options.flags;
|
||||||
let old_zero_pad = f.sign_aware_zero_pad();
|
|
||||||
|
|
||||||
// The alternate flag is already treated by LowerHex as being special-
|
// The alternate flag is already treated by LowerHex as being special-
|
||||||
// it denotes whether to prefix with 0x. We use it to work out whether
|
// it denotes whether to prefix with 0x. We use it to work out whether
|
||||||
// or not to zero extend, and then unconditionally set it to get the
|
// or not to zero extend, and then unconditionally set it to get the
|
||||||
// prefix.
|
// prefix.
|
||||||
if f.alternate() {
|
if f.alternate() {
|
||||||
f.options.sign_aware_zero_pad(true);
|
f.options.flags |= 1 << (rt::Flag::SignAwareZeroPad as u32);
|
||||||
|
|
||||||
if f.width().is_none() {
|
if f.options.width.is_none() {
|
||||||
f.options.width(Some((usize::BITS / 4) as usize + 2));
|
f.options.width = Some((usize::BITS / 4) as usize + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f.options.alternate(true);
|
f.options.flags |= 1 << (rt::Flag::Alternate as u32);
|
||||||
|
|
||||||
let ret = LowerHex::fmt(&ptr_addr, f);
|
let ret = LowerHex::fmt(&ptr_addr, f);
|
||||||
|
|
||||||
f.options.width(old_width);
|
f.options.width = old_width;
|
||||||
f.options.alternate(old_alternate);
|
f.options.flags = old_flags;
|
||||||
f.options.sign_aware_zero_pad(old_zero_pad);
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,133 +7,134 @@
|
||||||
debug upper => _3;
|
debug upper => _3;
|
||||||
let mut _0: std::result::Result<(), std::fmt::Error>;
|
let mut _0: std::result::Result<(), std::fmt::Error>;
|
||||||
let _4: bool;
|
let _4: bool;
|
||||||
let mut _5: &std::fmt::Formatter<'_>;
|
let mut _6: std::option::Option<usize>;
|
||||||
let mut _7: std::option::Option<usize>;
|
let mut _7: isize;
|
||||||
let mut _8: isize;
|
let mut _9: &mut std::fmt::Formatter<'_>;
|
||||||
let mut _10: &mut std::fmt::Formatter<'_>;
|
let mut _10: &T;
|
||||||
let mut _11: &T;
|
let mut _11: core::num::flt2dec::Sign;
|
||||||
let mut _12: core::num::flt2dec::Sign;
|
let mut _12: u32;
|
||||||
let mut _13: u32;
|
let mut _13: u32;
|
||||||
let mut _14: u32;
|
let mut _14: usize;
|
||||||
let mut _15: usize;
|
let mut _15: bool;
|
||||||
let mut _16: bool;
|
let mut _16: &mut std::fmt::Formatter<'_>;
|
||||||
let mut _17: &mut std::fmt::Formatter<'_>;
|
let mut _17: &T;
|
||||||
let mut _18: &T;
|
let mut _18: core::num::flt2dec::Sign;
|
||||||
let mut _19: core::num::flt2dec::Sign;
|
let mut _19: bool;
|
||||||
let mut _20: bool;
|
|
||||||
scope 1 {
|
scope 1 {
|
||||||
debug force_sign => _4;
|
debug force_sign => _4;
|
||||||
let _6: core::num::flt2dec::Sign;
|
let _5: core::num::flt2dec::Sign;
|
||||||
scope 2 {
|
scope 2 {
|
||||||
debug sign => _6;
|
debug sign => _5;
|
||||||
scope 3 {
|
scope 3 {
|
||||||
debug precision => _9;
|
debug precision => _8;
|
||||||
let _9: usize;
|
let _8: usize;
|
||||||
scope 4 (inlined Formatter::<'_>::precision) {
|
scope 5 (inlined Formatter::<'_>::precision) {
|
||||||
scope 5 (inlined FormattingOptions::get_precision) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
scope 4 (inlined Formatter::<'_>::sign_plus) {
|
||||||
|
let mut _20: u32;
|
||||||
|
let mut _21: u32;
|
||||||
|
}
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_4);
|
StorageLive(_4);
|
||||||
|
StorageLive(_20);
|
||||||
|
StorageLive(_21);
|
||||||
|
_21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
|
||||||
|
_20 = BitAnd(move _21, const 1_u32);
|
||||||
|
StorageDead(_21);
|
||||||
|
_4 = Ne(move _20, const 0_u32);
|
||||||
|
StorageDead(_20);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
_5 = &(*_1);
|
switchInt(copy _4) -> [0: bb2, otherwise: bb1];
|
||||||
_4 = Formatter::<'_>::sign_plus(move _5) -> [return: bb1, unwind unreachable];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bb1: {
|
bb1: {
|
||||||
StorageDead(_5);
|
- _5 = MinusPlus;
|
||||||
StorageLive(_6);
|
+ _5 = const MinusPlus;
|
||||||
switchInt(copy _4) -> [0: bb3, otherwise: bb2];
|
goto -> bb3;
|
||||||
}
|
}
|
||||||
|
|
||||||
bb2: {
|
bb2: {
|
||||||
- _6 = MinusPlus;
|
- _5 = core::num::flt2dec::Sign::Minus;
|
||||||
+ _6 = const MinusPlus;
|
+ _5 = const core::num::flt2dec::Sign::Minus;
|
||||||
goto -> bb4;
|
goto -> bb3;
|
||||||
}
|
}
|
||||||
|
|
||||||
bb3: {
|
bb3: {
|
||||||
- _6 = core::num::flt2dec::Sign::Minus;
|
StorageLive(_6);
|
||||||
+ _6 = const core::num::flt2dec::Sign::Minus;
|
_6 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<usize>);
|
||||||
goto -> bb4;
|
_7 = discriminant(_6);
|
||||||
|
switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb9];
|
||||||
}
|
}
|
||||||
|
|
||||||
bb4: {
|
bb4: {
|
||||||
StorageLive(_7);
|
- StorageLive(_8);
|
||||||
_7 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<usize>);
|
+ nop;
|
||||||
_8 = discriminant(_7);
|
_8 = copy ((_6 as Some).0: usize);
|
||||||
switchInt(move _8) -> [1: bb5, 0: bb7, otherwise: bb10];
|
StorageLive(_9);
|
||||||
|
_9 = copy _1;
|
||||||
|
StorageLive(_10);
|
||||||
|
_10 = copy _2;
|
||||||
|
StorageLive(_11);
|
||||||
|
_11 = copy _5;
|
||||||
|
StorageLive(_12);
|
||||||
|
StorageLive(_13);
|
||||||
|
StorageLive(_14);
|
||||||
|
_14 = copy _8;
|
||||||
|
- _13 = move _14 as u32 (IntToInt);
|
||||||
|
+ _13 = copy _8 as u32 (IntToInt);
|
||||||
|
StorageDead(_14);
|
||||||
|
_12 = Add(move _13, const 1_u32);
|
||||||
|
StorageDead(_13);
|
||||||
|
StorageLive(_15);
|
||||||
|
_15 = copy _3;
|
||||||
|
- _0 = float_to_exponential_common_exact::<T>(move _9, move _10, move _11, move _12, move _15) -> [return: bb5, unwind unreachable];
|
||||||
|
+ _0 = float_to_exponential_common_exact::<T>(copy _1, copy _2, move _11, move _12, copy _3) -> [return: bb5, unwind unreachable];
|
||||||
}
|
}
|
||||||
|
|
||||||
bb5: {
|
bb5: {
|
||||||
- StorageLive(_9);
|
|
||||||
+ nop;
|
|
||||||
_9 = copy ((_7 as Some).0: usize);
|
|
||||||
StorageLive(_10);
|
|
||||||
_10 = copy _1;
|
|
||||||
StorageLive(_11);
|
|
||||||
_11 = copy _2;
|
|
||||||
StorageLive(_12);
|
|
||||||
_12 = copy _6;
|
|
||||||
StorageLive(_13);
|
|
||||||
StorageLive(_14);
|
|
||||||
StorageLive(_15);
|
|
||||||
_15 = copy _9;
|
|
||||||
- _14 = move _15 as u32 (IntToInt);
|
|
||||||
+ _14 = copy _9 as u32 (IntToInt);
|
|
||||||
StorageDead(_15);
|
StorageDead(_15);
|
||||||
_13 = Add(move _14, const 1_u32);
|
|
||||||
StorageDead(_14);
|
|
||||||
StorageLive(_16);
|
|
||||||
_16 = copy _3;
|
|
||||||
- _0 = float_to_exponential_common_exact::<T>(move _10, move _11, move _12, move _13, move _16) -> [return: bb6, unwind unreachable];
|
|
||||||
+ _0 = float_to_exponential_common_exact::<T>(copy _1, copy _2, move _12, move _13, copy _3) -> [return: bb6, unwind unreachable];
|
|
||||||
}
|
|
||||||
|
|
||||||
bb6: {
|
|
||||||
StorageDead(_16);
|
|
||||||
StorageDead(_13);
|
|
||||||
StorageDead(_12);
|
StorageDead(_12);
|
||||||
StorageDead(_11);
|
StorageDead(_11);
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
- StorageDead(_9);
|
StorageDead(_9);
|
||||||
|
- StorageDead(_8);
|
||||||
+ nop;
|
+ nop;
|
||||||
goto -> bb9;
|
goto -> bb8;
|
||||||
|
}
|
||||||
|
|
||||||
|
bb6: {
|
||||||
|
StorageLive(_16);
|
||||||
|
_16 = copy _1;
|
||||||
|
StorageLive(_17);
|
||||||
|
_17 = copy _2;
|
||||||
|
StorageLive(_18);
|
||||||
|
_18 = copy _5;
|
||||||
|
StorageLive(_19);
|
||||||
|
_19 = copy _3;
|
||||||
|
- _0 = float_to_exponential_common_shortest::<T>(move _16, move _17, move _18, move _19) -> [return: bb7, unwind unreachable];
|
||||||
|
+ _0 = float_to_exponential_common_shortest::<T>(copy _1, copy _2, move _18, copy _3) -> [return: bb7, unwind unreachable];
|
||||||
}
|
}
|
||||||
|
|
||||||
bb7: {
|
bb7: {
|
||||||
StorageLive(_17);
|
|
||||||
_17 = copy _1;
|
|
||||||
StorageLive(_18);
|
|
||||||
_18 = copy _2;
|
|
||||||
StorageLive(_19);
|
|
||||||
_19 = copy _6;
|
|
||||||
StorageLive(_20);
|
|
||||||
_20 = copy _3;
|
|
||||||
- _0 = float_to_exponential_common_shortest::<T>(move _17, move _18, move _19, move _20) -> [return: bb8, unwind unreachable];
|
|
||||||
+ _0 = float_to_exponential_common_shortest::<T>(copy _1, copy _2, move _19, copy _3) -> [return: bb8, unwind unreachable];
|
|
||||||
}
|
|
||||||
|
|
||||||
bb8: {
|
|
||||||
StorageDead(_20);
|
|
||||||
StorageDead(_19);
|
StorageDead(_19);
|
||||||
StorageDead(_18);
|
StorageDead(_18);
|
||||||
StorageDead(_17);
|
StorageDead(_17);
|
||||||
goto -> bb9;
|
StorageDead(_16);
|
||||||
|
goto -> bb8;
|
||||||
}
|
}
|
||||||
|
|
||||||
bb9: {
|
bb8: {
|
||||||
StorageDead(_6);
|
StorageDead(_5);
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
StorageDead(_7);
|
StorageDead(_6);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bb10: {
|
bb9: {
|
||||||
unreachable;
|
unreachable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,133 +7,134 @@
|
||||||
debug upper => _3;
|
debug upper => _3;
|
||||||
let mut _0: std::result::Result<(), std::fmt::Error>;
|
let mut _0: std::result::Result<(), std::fmt::Error>;
|
||||||
let _4: bool;
|
let _4: bool;
|
||||||
let mut _5: &std::fmt::Formatter<'_>;
|
let mut _6: std::option::Option<usize>;
|
||||||
let mut _7: std::option::Option<usize>;
|
let mut _7: isize;
|
||||||
let mut _8: isize;
|
let mut _9: &mut std::fmt::Formatter<'_>;
|
||||||
let mut _10: &mut std::fmt::Formatter<'_>;
|
let mut _10: &T;
|
||||||
let mut _11: &T;
|
let mut _11: core::num::flt2dec::Sign;
|
||||||
let mut _12: core::num::flt2dec::Sign;
|
let mut _12: u32;
|
||||||
let mut _13: u32;
|
let mut _13: u32;
|
||||||
let mut _14: u32;
|
let mut _14: usize;
|
||||||
let mut _15: usize;
|
let mut _15: bool;
|
||||||
let mut _16: bool;
|
let mut _16: &mut std::fmt::Formatter<'_>;
|
||||||
let mut _17: &mut std::fmt::Formatter<'_>;
|
let mut _17: &T;
|
||||||
let mut _18: &T;
|
let mut _18: core::num::flt2dec::Sign;
|
||||||
let mut _19: core::num::flt2dec::Sign;
|
let mut _19: bool;
|
||||||
let mut _20: bool;
|
|
||||||
scope 1 {
|
scope 1 {
|
||||||
debug force_sign => _4;
|
debug force_sign => _4;
|
||||||
let _6: core::num::flt2dec::Sign;
|
let _5: core::num::flt2dec::Sign;
|
||||||
scope 2 {
|
scope 2 {
|
||||||
debug sign => _6;
|
debug sign => _5;
|
||||||
scope 3 {
|
scope 3 {
|
||||||
debug precision => _9;
|
debug precision => _8;
|
||||||
let _9: usize;
|
let _8: usize;
|
||||||
scope 4 (inlined Formatter::<'_>::precision) {
|
scope 5 (inlined Formatter::<'_>::precision) {
|
||||||
scope 5 (inlined FormattingOptions::get_precision) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
scope 4 (inlined Formatter::<'_>::sign_plus) {
|
||||||
|
let mut _20: u32;
|
||||||
|
let mut _21: u32;
|
||||||
|
}
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_4);
|
StorageLive(_4);
|
||||||
|
StorageLive(_20);
|
||||||
|
StorageLive(_21);
|
||||||
|
_21 = copy (((*_1).0: std::fmt::FormattingOptions).0: u32);
|
||||||
|
_20 = BitAnd(move _21, const 1_u32);
|
||||||
|
StorageDead(_21);
|
||||||
|
_4 = Ne(move _20, const 0_u32);
|
||||||
|
StorageDead(_20);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
_5 = &(*_1);
|
switchInt(copy _4) -> [0: bb2, otherwise: bb1];
|
||||||
_4 = Formatter::<'_>::sign_plus(move _5) -> [return: bb1, unwind continue];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bb1: {
|
bb1: {
|
||||||
StorageDead(_5);
|
- _5 = MinusPlus;
|
||||||
StorageLive(_6);
|
+ _5 = const MinusPlus;
|
||||||
switchInt(copy _4) -> [0: bb3, otherwise: bb2];
|
goto -> bb3;
|
||||||
}
|
}
|
||||||
|
|
||||||
bb2: {
|
bb2: {
|
||||||
- _6 = MinusPlus;
|
- _5 = core::num::flt2dec::Sign::Minus;
|
||||||
+ _6 = const MinusPlus;
|
+ _5 = const core::num::flt2dec::Sign::Minus;
|
||||||
goto -> bb4;
|
goto -> bb3;
|
||||||
}
|
}
|
||||||
|
|
||||||
bb3: {
|
bb3: {
|
||||||
- _6 = core::num::flt2dec::Sign::Minus;
|
StorageLive(_6);
|
||||||
+ _6 = const core::num::flt2dec::Sign::Minus;
|
_6 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<usize>);
|
||||||
goto -> bb4;
|
_7 = discriminant(_6);
|
||||||
|
switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb9];
|
||||||
}
|
}
|
||||||
|
|
||||||
bb4: {
|
bb4: {
|
||||||
StorageLive(_7);
|
- StorageLive(_8);
|
||||||
_7 = copy (((*_1).0: std::fmt::FormattingOptions).4: std::option::Option<usize>);
|
+ nop;
|
||||||
_8 = discriminant(_7);
|
_8 = copy ((_6 as Some).0: usize);
|
||||||
switchInt(move _8) -> [1: bb5, 0: bb7, otherwise: bb10];
|
StorageLive(_9);
|
||||||
|
_9 = copy _1;
|
||||||
|
StorageLive(_10);
|
||||||
|
_10 = copy _2;
|
||||||
|
StorageLive(_11);
|
||||||
|
_11 = copy _5;
|
||||||
|
StorageLive(_12);
|
||||||
|
StorageLive(_13);
|
||||||
|
StorageLive(_14);
|
||||||
|
_14 = copy _8;
|
||||||
|
- _13 = move _14 as u32 (IntToInt);
|
||||||
|
+ _13 = copy _8 as u32 (IntToInt);
|
||||||
|
StorageDead(_14);
|
||||||
|
_12 = Add(move _13, const 1_u32);
|
||||||
|
StorageDead(_13);
|
||||||
|
StorageLive(_15);
|
||||||
|
_15 = copy _3;
|
||||||
|
- _0 = float_to_exponential_common_exact::<T>(move _9, move _10, move _11, move _12, move _15) -> [return: bb5, unwind continue];
|
||||||
|
+ _0 = float_to_exponential_common_exact::<T>(copy _1, copy _2, move _11, move _12, copy _3) -> [return: bb5, unwind continue];
|
||||||
}
|
}
|
||||||
|
|
||||||
bb5: {
|
bb5: {
|
||||||
- StorageLive(_9);
|
|
||||||
+ nop;
|
|
||||||
_9 = copy ((_7 as Some).0: usize);
|
|
||||||
StorageLive(_10);
|
|
||||||
_10 = copy _1;
|
|
||||||
StorageLive(_11);
|
|
||||||
_11 = copy _2;
|
|
||||||
StorageLive(_12);
|
|
||||||
_12 = copy _6;
|
|
||||||
StorageLive(_13);
|
|
||||||
StorageLive(_14);
|
|
||||||
StorageLive(_15);
|
|
||||||
_15 = copy _9;
|
|
||||||
- _14 = move _15 as u32 (IntToInt);
|
|
||||||
+ _14 = copy _9 as u32 (IntToInt);
|
|
||||||
StorageDead(_15);
|
StorageDead(_15);
|
||||||
_13 = Add(move _14, const 1_u32);
|
|
||||||
StorageDead(_14);
|
|
||||||
StorageLive(_16);
|
|
||||||
_16 = copy _3;
|
|
||||||
- _0 = float_to_exponential_common_exact::<T>(move _10, move _11, move _12, move _13, move _16) -> [return: bb6, unwind continue];
|
|
||||||
+ _0 = float_to_exponential_common_exact::<T>(copy _1, copy _2, move _12, move _13, copy _3) -> [return: bb6, unwind continue];
|
|
||||||
}
|
|
||||||
|
|
||||||
bb6: {
|
|
||||||
StorageDead(_16);
|
|
||||||
StorageDead(_13);
|
|
||||||
StorageDead(_12);
|
StorageDead(_12);
|
||||||
StorageDead(_11);
|
StorageDead(_11);
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
- StorageDead(_9);
|
StorageDead(_9);
|
||||||
|
- StorageDead(_8);
|
||||||
+ nop;
|
+ nop;
|
||||||
goto -> bb9;
|
goto -> bb8;
|
||||||
|
}
|
||||||
|
|
||||||
|
bb6: {
|
||||||
|
StorageLive(_16);
|
||||||
|
_16 = copy _1;
|
||||||
|
StorageLive(_17);
|
||||||
|
_17 = copy _2;
|
||||||
|
StorageLive(_18);
|
||||||
|
_18 = copy _5;
|
||||||
|
StorageLive(_19);
|
||||||
|
_19 = copy _3;
|
||||||
|
- _0 = float_to_exponential_common_shortest::<T>(move _16, move _17, move _18, move _19) -> [return: bb7, unwind continue];
|
||||||
|
+ _0 = float_to_exponential_common_shortest::<T>(copy _1, copy _2, move _18, copy _3) -> [return: bb7, unwind continue];
|
||||||
}
|
}
|
||||||
|
|
||||||
bb7: {
|
bb7: {
|
||||||
StorageLive(_17);
|
|
||||||
_17 = copy _1;
|
|
||||||
StorageLive(_18);
|
|
||||||
_18 = copy _2;
|
|
||||||
StorageLive(_19);
|
|
||||||
_19 = copy _6;
|
|
||||||
StorageLive(_20);
|
|
||||||
_20 = copy _3;
|
|
||||||
- _0 = float_to_exponential_common_shortest::<T>(move _17, move _18, move _19, move _20) -> [return: bb8, unwind continue];
|
|
||||||
+ _0 = float_to_exponential_common_shortest::<T>(copy _1, copy _2, move _19, copy _3) -> [return: bb8, unwind continue];
|
|
||||||
}
|
|
||||||
|
|
||||||
bb8: {
|
|
||||||
StorageDead(_20);
|
|
||||||
StorageDead(_19);
|
StorageDead(_19);
|
||||||
StorageDead(_18);
|
StorageDead(_18);
|
||||||
StorageDead(_17);
|
StorageDead(_17);
|
||||||
goto -> bb9;
|
StorageDead(_16);
|
||||||
|
goto -> bb8;
|
||||||
}
|
}
|
||||||
|
|
||||||
bb9: {
|
bb8: {
|
||||||
StorageDead(_6);
|
StorageDead(_5);
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
StorageDead(_7);
|
StorageDead(_6);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bb10: {
|
bb9: {
|
||||||
unreachable;
|
unreachable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue