From 710dcbd3818deca8f193a45e321b58af3c24feae Mon Sep 17 00:00:00 2001 From: Yuning Zhang Date: Mon, 31 Dec 2018 20:43:08 -0500 Subject: Improve type mismatch error messages Replace "integral variable" with "integer" and replace "floating-point variable" with "floating-point number" to make the message less confusing. --- src/test/ui/structs/struct-base-wrong-type-2.rs | 2 +- .../ui/structs/struct-base-wrong-type-2.stderr | 2 +- src/test/ui/structs/struct-base-wrong-type.rs | 2 +- src/test/ui/structs/struct-base-wrong-type.stderr | 2 +- .../structs/structure-constructor-type-mismatch.rs | 12 ++++++------ .../structure-constructor-type-mismatch.stderr | 22 +++++++++++----------- 6 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src/test/ui/structs') diff --git a/src/test/ui/structs/struct-base-wrong-type-2.rs b/src/test/ui/structs/struct-base-wrong-type-2.rs index a88c5d1c13b..562f75b8e85 100644 --- a/src/test/ui/structs/struct-base-wrong-type-2.rs +++ b/src/test/ui/structs/struct-base-wrong-type-2.rs @@ -15,5 +15,5 @@ fn main() { let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types //~| expected type `Foo` //~| found type `{integer}` - //~| expected struct `Foo`, found integral variable + //~| expected struct `Foo`, found integer } diff --git a/src/test/ui/structs/struct-base-wrong-type-2.stderr b/src/test/ui/structs/struct-base-wrong-type-2.stderr index 44ac3483ad6..b15ea51bb2d 100644 --- a/src/test/ui/structs/struct-base-wrong-type-2.stderr +++ b/src/test/ui/structs/struct-base-wrong-type-2.stderr @@ -11,7 +11,7 @@ error[E0308]: mismatched types --> $DIR/struct-base-wrong-type-2.rs:15:34 | LL | let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types - | ^ expected struct `Foo`, found integral variable + | ^ expected struct `Foo`, found integer | = note: expected type `Foo` found type `{integer}` diff --git a/src/test/ui/structs/struct-base-wrong-type.rs b/src/test/ui/structs/struct-base-wrong-type.rs index 83b54448151..6252673c296 100644 --- a/src/test/ui/structs/struct-base-wrong-type.rs +++ b/src/test/ui/structs/struct-base-wrong-type.rs @@ -14,7 +14,7 @@ static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types //~| expected type `Foo` //~| found type `{integer}` - //~| expected struct `Foo`, found integral variable + //~| expected struct `Foo`, found integer fn main() { let b = Bar { x: 5 }; diff --git a/src/test/ui/structs/struct-base-wrong-type.stderr b/src/test/ui/structs/struct-base-wrong-type.stderr index 8519a9510a9..045eb610f7d 100644 --- a/src/test/ui/structs/struct-base-wrong-type.stderr +++ b/src/test/ui/structs/struct-base-wrong-type.stderr @@ -11,7 +11,7 @@ error[E0308]: mismatched types --> $DIR/struct-base-wrong-type.rs:14:35 | LL | static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types - | ^ expected struct `Foo`, found integral variable + | ^ expected struct `Foo`, found integer | = note: expected type `Foo` found type `{integer}` diff --git a/src/test/ui/structs/structure-constructor-type-mismatch.rs b/src/test/ui/structs/structure-constructor-type-mismatch.rs index 54319e1ea4f..8850f6ea89f 100644 --- a/src/test/ui/structs/structure-constructor-type-mismatch.rs +++ b/src/test/ui/structs/structure-constructor-type-mismatch.rs @@ -16,32 +16,32 @@ fn main() { let pt = PointF { x: 1, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer y: 2, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer }; let pt2 = Point:: { x: 3, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer y: 4, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer }; let pair = PairF { x: 5, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer y: 6, }; let pair2 = PairF:: { x: 7, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer y: 8, }; diff --git a/src/test/ui/structs/structure-constructor-type-mismatch.stderr b/src/test/ui/structs/structure-constructor-type-mismatch.stderr index 6abc75110e1..3c1ed8e69a6 100644 --- a/src/test/ui/structs/structure-constructor-type-mismatch.stderr +++ b/src/test/ui/structs/structure-constructor-type-mismatch.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | x: 1, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `1.0` | = note: expected type `f32` @@ -16,7 +16,7 @@ error[E0308]: mismatched types LL | y: 2, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `2.0` | = note: expected type `f32` @@ -28,7 +28,7 @@ error[E0308]: mismatched types LL | x: 3, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `3.0` | = note: expected type `f32` @@ -40,7 +40,7 @@ error[E0308]: mismatched types LL | y: 4, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `4.0` | = note: expected type `f32` @@ -52,7 +52,7 @@ error[E0308]: mismatched types LL | x: 5, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `5.0` | = note: expected type `f32` @@ -64,7 +64,7 @@ error[E0308]: mismatched types LL | x: 7, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `7.0` | = note: expected type `f32` @@ -82,7 +82,7 @@ error[E0308]: mismatched types LL | x: 9, //~ ERROR mismatched types | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `9.0` | = note: expected type `f32` @@ -94,7 +94,7 @@ error[E0308]: mismatched types LL | y: 10, //~ ERROR mismatched types | ^^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `10.0` | = note: expected type `f32` @@ -110,7 +110,7 @@ error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:54:9 | LL | PointF:: { .. } => {} //~ ERROR wrong number of type arguments - | ^^^^^^^^^^^^^^^^^^^^ expected integral variable, found f32 + | ^^^^^^^^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Point<{integer}>` found type `Point` @@ -119,7 +119,7 @@ error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:59:9 | LL | PointF { .. } => {} //~ ERROR mismatched types - | ^^^^^^^^^^^^^ expected integral variable, found f32 + | ^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Point<{integer}>` found type `Point` @@ -128,7 +128,7 @@ error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:67:9 | LL | PairF:: { .. } => {} //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^ expected integral variable, found f32 + | ^^^^^^^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Pair<{integer}, {integer}>` found type `Pair` -- cgit 1.4.1-3-g733a5