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();
|
self.bump();
|
||||||
let sp = lo.to(self.prev_span);
|
let sp = lo.to(self.prev_span);
|
||||||
let mut err = self.diagnostic()
|
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(
|
err.span_suggestion_with_applicability(
|
||||||
sp,
|
sp,
|
||||||
"numeric float literals must have a significant",
|
"must have an integer part",
|
||||||
format!("0.{}", val),
|
format!("0.{}", val),
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,7 +2,7 @@ struct Foo { bar: f64, baz: i64, bat: i64 }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = Foo { bar: .5, baz: 42 };
|
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 missing field `bat` in initializer of `Foo`
|
||||||
//~| ERROR mismatched types
|
//~| ERROR mismatched types
|
||||||
let bar = 1.5f32;
|
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
|
--> $DIR/issue-52496.rs:4:24
|
||||||
|
|
|
|
||||||
LL | let _ = Foo { bar: .5, baz: 42 };
|
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 `.`
|
error: expected one of `,` or `}`, found `.`
|
||||||
--> $DIR/issue-52496.rs:9:22
|
--> $DIR/issue-52496.rs:9:22
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue