Correctly handle signs in exponents in numeric_literal::format()
This commit is contained in:
@@ -177,6 +177,13 @@ impl<'a> NumericLiteral<'a> {
|
|||||||
|
|
||||||
let mut digits = input.chars().filter(|&c| c != '_');
|
let mut digits = input.chars().filter(|&c| c != '_');
|
||||||
|
|
||||||
|
// The exponent may have a sign, output it early, otherwise it will be
|
||||||
|
// treated as a digit
|
||||||
|
if let Some('-') = digits.clone().next() {
|
||||||
|
let _ = digits.next();
|
||||||
|
output.push('-');
|
||||||
|
}
|
||||||
|
|
||||||
let first_group_size;
|
let first_group_size;
|
||||||
|
|
||||||
if partial_group_first {
|
if partial_group_first {
|
||||||
|
|||||||
@@ -62,5 +62,5 @@ fn main() {
|
|||||||
let num = 0.000_000_000_01e-10f64;
|
let num = 0.000_000_000_01e-10f64;
|
||||||
|
|
||||||
// issue #7744
|
// issue #7744
|
||||||
let _ = 2.225_073_858_507_201e-_308_f64;
|
let _ = 2.225_073_858_507_201e-308_f64;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ error: float has excessive precision
|
|||||||
--> $DIR/excessive_precision.rs:65:13
|
--> $DIR/excessive_precision.rs:65:13
|
||||||
|
|
|
|
||||||
LL | let _ = 2.225_073_858_507_201_1e-308_f64;
|
LL | let _ = 2.225_073_858_507_201_1e-308_f64;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `2.225_073_858_507_201e-_308_f64`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type or truncating it to: `2.225_073_858_507_201e-308_f64`
|
||||||
|
|
||||||
error: aborting due to 14 previous errors
|
error: aborting due to 14 previous errors
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user