Reword message for incorrect float literal
This commit is contained in:
parent
acbda76f23
commit
e387597a8f
3 changed files with 5 additions and 5 deletions
|
@ -2002,10 +2002,10 @@ impl<'a> Parser<'a> {
|
|||
self.bump();
|
||||
let sp = lo.to(self.prev_span);
|
||||
let mut err = self.diagnostic()
|
||||
.struct_span_err(sp, "numeric float literals must have a significant");
|
||||
.struct_span_err(sp, "float literals must have an integer part");
|
||||
err.span_suggestion_with_applicability(
|
||||
sp,
|
||||
"numeric float literals must have a significant",
|
||||
"must have an integer part",
|
||||
format!("0.{}", val),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@ struct Foo { bar: f64, baz: i64, bat: i64 }
|
|||
|
||||
fn main() {
|
||||
let _ = Foo { bar: .5, baz: 42 };
|
||||
//~^ ERROR numeric float literals must have a significant
|
||||
//~^ ERROR float literals must have an integer part
|
||||
//~| ERROR missing field `bat` in initializer of `Foo`
|
||||
//~| ERROR mismatched types
|
||||
let bar = 1.5f32;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
error: numeric float literals must have a significant
|
||||
error: float literals must have an integer part
|
||||
--> $DIR/issue-52496.rs:4:24
|
||||
|
|
||||
LL | let _ = Foo { bar: .5, baz: 42 };
|
||||
| ^^ help: numeric float literals must have a significant: `0.5`
|
||||
| ^^ help: must have an integer part: `0.5`
|
||||
|
||||
error: expected one of `,` or `}`, found `.`
|
||||
--> $DIR/issue-52496.rs:9:22
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue