diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-01-20 01:49:04 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-01-20 01:49:04 -0800 |
| commit | acbda76f23b8945fd8f45332352269044ecbf2ca (patch) | |
| tree | 03dff9f95bbe01a8be8c6768deba719e04568902 /src/test | |
| parent | b1f169fe7a19cf10f70ee2aa2513276185c70e9b (diff) | |
| download | rust-acbda76f23b8945fd8f45332352269044ecbf2ca.tar.gz rust-acbda76f23b8945fd8f45332352269044ecbf2ca.zip | |
Recover with suggestion from writing `.42` instead of `0.42`
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/issues/issue-52496.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-52496.stderr | 30 |
2 files changed, 21 insertions, 12 deletions
diff --git a/src/test/ui/issues/issue-52496.rs b/src/test/ui/issues/issue-52496.rs index d2636b7ecb3..2e790792675 100644 --- a/src/test/ui/issues/issue-52496.rs +++ b/src/test/ui/issues/issue-52496.rs @@ -2,8 +2,9 @@ struct Foo { bar: f64, baz: i64, bat: i64 } fn main() { let _ = Foo { bar: .5, baz: 42 }; - //~^ ERROR expected expression + //~^ ERROR numeric float literals must have a significant //~| ERROR missing field `bat` in initializer of `Foo` + //~| ERROR mismatched types let bar = 1.5f32; let _ = Foo { bar.into(), bat: -1, . }; //~^ ERROR expected one of diff --git a/src/test/ui/issues/issue-52496.stderr b/src/test/ui/issues/issue-52496.stderr index c98de6ffbed..3c805631660 100644 --- a/src/test/ui/issues/issue-52496.stderr +++ b/src/test/ui/issues/issue-52496.stderr @@ -1,13 +1,11 @@ -error: expected expression, found `.` +error: numeric float literals must have a significant --> $DIR/issue-52496.rs:4:24 | LL | let _ = Foo { bar: .5, baz: 42 }; - | --- ^ expected expression - | | - | while parsing this struct + | ^^ help: numeric float literals must have a significant: `0.5` error: expected one of `,` or `}`, found `.` - --> $DIR/issue-52496.rs:8:22 + --> $DIR/issue-52496.rs:9:22 | LL | let _ = Foo { bar.into(), bat: -1, . }; | --- ^ expected one of `,` or `}` here @@ -15,13 +13,23 @@ LL | let _ = Foo { bar.into(), bat: -1, . }; | while parsing this struct error: expected identifier, found `.` - --> $DIR/issue-52496.rs:8:40 + --> $DIR/issue-52496.rs:9:40 | LL | let _ = Foo { bar.into(), bat: -1, . }; | --- ^ expected identifier | | | while parsing this struct +error[E0308]: mismatched types + --> $DIR/issue-52496.rs:4:24 + | +LL | let _ = Foo { bar: .5, baz: 42 }; + | ^^ expected f64, found f32 +help: change the type of the numeric literal from `f32` to `f64` + | +LL | let _ = Foo { bar: .5f64, baz: 42 }; + | ^^^^^ + error[E0063]: missing field `bat` in initializer of `Foo` --> $DIR/issue-52496.rs:4:13 | @@ -29,22 +37,22 @@ LL | let _ = Foo { bar: .5, baz: 42 }; | ^^^ missing `bat` error[E0308]: mismatched types - --> $DIR/issue-52496.rs:8:19 + --> $DIR/issue-52496.rs:9:19 | LL | let _ = Foo { bar.into(), bat: -1, . }; | ^^^ expected f64, found f32 help: you can cast an `f32` to `f64` in a lossless way | -LL | let _ = Foo { bar: bar.into().into(), bat: -1, . }; - | ^^^^^^^^^^^^^^^ +LL | let _ = Foo { bar.into().into(), bat: -1, . }; + | ^^^^^^^^^^ error[E0063]: missing field `baz` in initializer of `Foo` - --> $DIR/issue-52496.rs:8:13 + --> $DIR/issue-52496.rs:9:13 | LL | let _ = Foo { bar.into(), bat: -1, . }; | ^^^ missing `baz` -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors Some errors occurred: E0063, E0308. For more information about an error, try `rustc --explain E0063`. |
