Auto merge of #57250 - codeworm96:tyerr_msg, r=varkor

Improve type mismatch error messages

Closes #56115.

Replace "integral variable" with "integer" and replace "floating-point variable" with "floating-point number" to make the message less confusing.

TODO the book and clippy needs to be changed accordingly later.

r? @varkor
This commit is contained in:
bors 2019-01-02 11:59:15 +00:00
commit a36b960df6
54 changed files with 105 additions and 105 deletions

View File

@ -200,8 +200,8 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
ty::GeneratorWitness(..) => "generator witness".into(),
ty::Tuple(..) => "tuple".into(),
ty::Infer(ty::TyVar(_)) => "inferred type".into(),
ty::Infer(ty::IntVar(_)) => "integral variable".into(),
ty::Infer(ty::FloatVar(_)) => "floating-point variable".into(),
ty::Infer(ty::IntVar(_)) => "integer".into(),
ty::Infer(ty::FloatVar(_)) => "floating-point number".into(),
ty::Placeholder(..) => "placeholder type".into(),
ty::Bound(..) => "bound type".into(),
ty::Infer(ty::FreshTy(_)) => "fresh type".into(),

View File

@ -2,5 +2,5 @@ static i: String = 10;
//~^ ERROR mismatched types
//~| expected type `std::string::String`
//~| found type `{integer}`
//~| expected struct `std::string::String`, found integral variable
//~| expected struct `std::string::String`, found integer
fn main() { println!("{}", i); }

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | static i: String = 10;
| ^^
| |
| expected struct `std::string::String`, found integral variable
| expected struct `std::string::String`, found integer
| help: try using a conversion method: `10.to_string()`
|
= note: expected type `std::string::String`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/binop-logic-int.rs:1:21
|
LL | fn main() { let x = 1 && 2; }
| ^ expected bool, found integral variable
| ^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`
@ -11,7 +11,7 @@ error[E0308]: mismatched types
--> $DIR/binop-logic-int.rs:1:26
|
LL | fn main() { let x = 1 && 2; }
| ^ expected bool, found integral variable
| ^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/blind-item-block-middle.rs:6:9
|
LL | let bar = 5;
| ^^^ expected integral variable, found struct `foo::bar`
| ^^^ expected integer, found struct `foo::bar`
|
= note: expected type `{integer}`
found type `foo::bar`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/type_inference.rs:21:14
|
LL | only_foo(x); //~ ERROR mismatched types
| ^ expected i32, found floating-point variable
| ^ expected i32, found floating-point number
|
= note: expected type `i32`
found type `{float}`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:6:17
|
LL | foo(return, 22, 44);
| ^^ expected !, found integral variable
| ^^ expected !, found integer
|
= note: expected type `!`
found type `{integer}`
@ -11,7 +11,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:18:13
|
LL | foo(22, 44, return); //~ ERROR mismatched types
| ^^ expected !, found integral variable
| ^^ expected !, found integer
|
= note: expected type `!`
found type `{integer}`
@ -20,7 +20,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:26:12
|
LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverge.
| ^ expected !, found integral variable
| ^ expected !, found integer
|
= note: expected type `!`
found type `{integer}`
@ -29,7 +29,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:36:12
|
LL | foo(a, b, c); //~ ERROR mismatched types
| ^ expected !, found integral variable
| ^ expected !, found integer
|
= note: expected type `!`
found type `{integer}`
@ -38,7 +38,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:45:12
|
LL | foo(a, b, c); //~ ERROR mismatched types
| ^ expected !, found integral variable
| ^ expected !, found integer
|
= note: expected type `!`
found type `{integer}`
@ -47,7 +47,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:50:21
|
LL | let x: [!; 2] = [return, 22]; //~ ERROR mismatched types
| ^^^^^^^^^^^^ expected !, found integral variable
| ^^^^^^^^^^^^ expected !, found integer
|
= note: expected type `[!; 2]`
found type `[{integer}; 2]`
@ -56,7 +56,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:55:22
|
LL | let x: [!; 2] = [22, return]; //~ ERROR mismatched types
| ^^ expected !, found integral variable
| ^^ expected !, found integer
|
= note: expected type `!`
found type `{integer}`
@ -65,7 +65,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:60:37
|
LL | let x: (usize, !, usize) = (22, 44, 66); //~ ERROR mismatched types
| ^^ expected !, found integral variable
| ^^ expected !, found integer
|
= note: expected type `!`
found type `{integer}`
@ -74,7 +74,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:65:41
|
LL | let x: (usize, !, usize) = (return, 44, 66);
| ^^ expected !, found integral variable
| ^^ expected !, found integer
|
= note: expected type `!`
found type `{integer}`
@ -83,7 +83,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:76:37
|
LL | let x: (usize, !, usize) = (22, 44, return); //~ ERROR mismatched types
| ^^ expected !, found integral variable
| ^^ expected !, found integer
|
= note: expected type `!`
found type `{integer}`

View File

@ -1,8 +1,8 @@
const X: usize = 42 && 39;
//~^ ERROR mismatched types
//~| expected bool, found integral variable
//~| expected bool, found integer
//~| ERROR mismatched types
//~| expected bool, found integral variable
//~| expected bool, found integer
//~| ERROR mismatched types
//~| expected usize, found bool
const ARR: [i32; X] = [99; 34];
@ -10,9 +10,9 @@ const ARR: [i32; X] = [99; 34];
const X1: usize = 42 || 39;
//~^ ERROR mismatched types
//~| expected bool, found integral variable
//~| expected bool, found integer
//~| ERROR mismatched types
//~| expected bool, found integral variable
//~| expected bool, found integer
//~| ERROR mismatched types
//~| expected usize, found bool
const ARR1: [i32; X1] = [99; 47];
@ -20,9 +20,9 @@ const ARR1: [i32; X1] = [99; 47];
const X2: usize = -42 || -39;
//~^ ERROR mismatched types
//~| expected bool, found integral variable
//~| expected bool, found integer
//~| ERROR mismatched types
//~| expected bool, found integral variable
//~| expected bool, found integer
//~| ERROR mismatched types
//~| expected usize, found bool
const ARR2: [i32; X2] = [99; 18446744073709551607];
@ -30,9 +30,9 @@ const ARR2: [i32; X2] = [99; 18446744073709551607];
const X3: usize = -42 && -39;
//~^ ERROR mismatched types
//~| expected bool, found integral variable
//~| expected bool, found integer
//~| ERROR mismatched types
//~| expected bool, found integral variable
//~| expected bool, found integer
//~| ERROR mismatched types
//~| expected usize, found bool
const ARR3: [i32; X3] = [99; 6];

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:1:18
|
LL | const X: usize = 42 && 39;
| ^^ expected bool, found integral variable
| ^^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`
@ -11,7 +11,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:1:24
|
LL | const X: usize = 42 && 39;
| ^^ expected bool, found integral variable
| ^^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`
@ -32,7 +32,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:11:19
|
LL | const X1: usize = 42 || 39;
| ^^ expected bool, found integral variable
| ^^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`
@ -41,7 +41,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:11:25
|
LL | const X1: usize = 42 || 39;
| ^^ expected bool, found integral variable
| ^^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`
@ -62,7 +62,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:21:19
|
LL | const X2: usize = -42 || -39;
| ^^^ expected bool, found integral variable
| ^^^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`
@ -71,7 +71,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:21:26
|
LL | const X2: usize = -42 || -39;
| ^^^ expected bool, found integral variable
| ^^^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`
@ -92,7 +92,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:31:19
|
LL | const X3: usize = -42 && -39;
| ^^^ expected bool, found integral variable
| ^^^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`
@ -101,7 +101,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:31:26
|
LL | const X3: usize = -42 && -39;
| ^^^ expected bool, found integral variable
| ^^^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`

View File

@ -28,7 +28,7 @@ error[E0308]: mismatched types
LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here
| ^
| |
| expected struct `std::string::String`, found integral variable
| expected struct `std::string::String`, found integer
| help: try using a conversion method: `2.to_string()`
|
= note: expected type `std::string::String`

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | let sixteen: f32 = 16;
| ^^
| |
| expected f32, found integral variable
| expected f32, found integer
| help: use a float literal: `16.0`
|
= note: expected type `f32`
@ -16,7 +16,7 @@ error[E0308]: mismatched types
LL | let a_million_and_seventy: f64 = 1_000_070;
| ^^^^^^^^^
| |
| expected f64, found integral variable
| expected f64, found integer
| help: use a float literal: `1_000_070.0`
|
= note: expected type `f64`
@ -28,7 +28,7 @@ error[E0308]: mismatched types
LL | let negative_nine: f32 = -9;
| ^^
| |
| expected f32, found integral variable
| expected f32, found integer
| help: use a float literal: `-9.0`
|
= note: expected type `f32`
@ -38,7 +38,7 @@ error[E0308]: mismatched types
--> $DIR/issue-53280-expected-float-found-integer-literal.rs:15:30
|
LL | let sixteen_again: f64 = 0x10;
| ^^^^ expected f64, found integral variable
| ^^^^ expected f64, found integer
|
= note: expected type `f64`
found type `{integer}`
@ -47,7 +47,7 @@ error[E0308]: mismatched types
--> $DIR/issue-53280-expected-float-found-integer-literal.rs:17:30
|
LL | let and_once_more: f32 = 0o20;
| ^^^^ expected f32, found integral variable
| ^^^^ expected f32, found integer
|
= note: expected type `f32`
found type `{integer}`

View File

@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/E0070.rs:8:25
|
LL | some_other_func() = 4; //~ ERROR E0070
| ^ expected (), found integral variable
| ^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | let x: f32 = 1; //~ ERROR mismatched types
| ^
| |
| expected f32, found integral variable
| expected f32, found integer
| help: use a float literal: `1.0`
|
= note: expected type `f32`

View File

@ -6,5 +6,5 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `std::option::Option<usize>`
//~| found type `{integer}`
//~| expected enum `std::option::Option`, found integral variable
//~| expected enum `std::option::Option`, found integer
}

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | x = 5;
| ^
| |
| expected enum `std::option::Option`, found integral variable
| expected enum `std::option::Option`, found integer
| help: try using a variant of the expected type: `Some(5)`
|
= note: expected type `std::option::Option<usize>`

View File

@ -8,7 +8,7 @@ error[E0308]: mismatched types
--> $DIR/generic-arg-mismatch-recover.rs:6:33
|
LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments
| ^^ expected (), found integral variable
| ^^ expected (), found integer
|
= note: expected type `&'static ()`
found type `&{integer}`

View File

@ -1,6 +1,6 @@
fn main() {
if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types
//~^ expected (), found integral variable
//~^ expected (), found integer
//~| expected type `()`
//~| found type `{integer}`
()

View File

@ -2,13 +2,13 @@ error[E0308]: `if let` arms have incompatible types
--> $DIR/if-let-arm-types.rs:2:5
|
LL | / if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types
LL | | //~^ expected (), found integral variable
LL | | //~^ expected (), found integer
LL | | //~| expected type `()`
LL | | //~| found type `{integer}`
... |
LL | | 1
LL | | };
| |_____^ expected (), found integral variable
| |_____^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`

View File

@ -4,5 +4,5 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `{integer}`
//~| found type `{float}`
//~| expected integral variable, found floating-point variable
//~| expected integer, found floating-point number
}

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/integral-variable-unification-error.rs:3:9
|
LL | x = 5.0;
| ^^^ expected integral variable, found floating-point variable
| ^^^ expected integer, found floating-point number
|
= note: expected type `{integer}`
found type `{float}`

View File

@ -8,7 +8,7 @@ error[E0308]: mismatched types
--> $DIR/issue-13407.rs:6:12
|
LL | A::C = 1;
| ^ expected struct `A::C`, found integral variable
| ^ expected struct `A::C`, found integer
|
= note: expected type `A::C`
found type `{integer}`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-14091.rs:2:5
|
LL | assert!(1,1);
| ^^^^^^^^^^^^^ expected bool, found integral variable
| ^^^^^^^^^^^^^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`

View File

@ -5,7 +5,7 @@ fn main() {
if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause
//~| expected type `()`
//~| found type `{integer}`
//~| expected (), found integral variable
//~| expected (), found integer
765
};
}

View File

@ -4,10 +4,10 @@ error[E0317]: if may be missing an else clause
LL | / if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause
LL | | //~| expected type `()`
LL | | //~| found type `{integer}`
LL | | //~| expected (), found integral variable
LL | | //~| expected (), found integer
LL | | 765
LL | | };
| |_____^ expected (), found integral variable
| |_____^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-33504.rs:7:13
|
LL | let Test = 1; //~ ERROR mismatched types
| ^^^^ expected integral variable, found struct `Test`
| ^^^^ expected integer, found struct `Test`
|
= note: expected type `{integer}`
found type `Test`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-37665.rs:10:17
|
LL | let x: () = 0; //~ ERROR: mismatched types
| ^ expected (), found integral variable
| ^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`

View File

@ -5,7 +5,7 @@ fn main() {
//~^ ERROR if may be missing an else clause
//~| expected type `()`
//~| found type `{integer}`
//~| expected (), found integral variable
//~| expected (), found integer
1
};
}

View File

@ -6,10 +6,10 @@ LL | } else if false {
LL | | //~^ ERROR if may be missing an else clause
LL | | //~| expected type `()`
LL | | //~| found type `{integer}`
LL | | //~| expected (), found integral variable
LL | | //~| expected (), found integer
LL | | 1
LL | | };
| |_____^ expected (), found integral variable
| |_____^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`

View File

@ -6,5 +6,5 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `{integer}`
//~| found type `(isize, isize)`
//~| expected integral variable, found tuple
//~| expected integer, found tuple
}

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-4968.rs:5:16
|
LL | match 42 { A => () }
| ^ expected integral variable, found tuple
| ^ expected integer, found tuple
|
= note: expected type `{integer}`
found type `(isize, isize)`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/keyword-false-as-identifier.rs:2:9
|
LL | let false = 22; //~ error: mismatched types
| ^^^^^ expected integral variable, found bool
| ^^^^^ expected integer, found bool
|
= note: expected type `{integer}`
found type `bool`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/keyword-true-as-identifier.rs:2:9
|
LL | let true = 22; //~ error: mismatched types
| ^^^^ expected integral variable, found bool
| ^^^^ expected integer, found bool
|
= note: expected type `{integer}`
found type `bool`

View File

@ -91,7 +91,7 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:11:19
|
LL | break 123; //~ ERROR mismatched types
| ^^^ expected &str, found integral variable
| ^^^ expected &str, found integer
|
= note: expected type `&str`
found type `{integer}`
@ -118,7 +118,7 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:73:26
|
LL | break 'c 123; //~ ERROR mismatched types
| ^^^ expected (), found integral variable
| ^^^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`
@ -136,7 +136,7 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:85:15
|
LL | break 2; //~ ERROR mismatched types
| ^ expected (), found integral variable
| ^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`
@ -145,7 +145,7 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:90:9
|
LL | break; //~ ERROR mismatched types
| ^^^^^ expected (), found integral variable
| ^^^^^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`

View File

@ -20,7 +20,7 @@ error[E0308]: mismatched types
--> $DIR/match-range-fail.rs:17:9
|
LL | 'c' ..= 100 => { }
| ^^^^^^^^^^^ expected integral variable, found char
| ^^^^^^^^^^^ expected integer, found char
|
= note: expected type `{integer}`
found type `char`

View File

@ -15,5 +15,5 @@ fn main() {
Foo::bar(&42); //~ ERROR mismatched types
//~| expected type `&Foo`
//~| found type `&{integer}`
//~| expected struct `Foo`, found integral variable
//~| expected struct `Foo`, found integer
}

View File

@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/method-self-arg-1.rs:15:14
|
LL | Foo::bar(&42); //~ ERROR mismatched types
| ^^^ expected struct `Foo`, found integral variable
| ^^^ expected struct `Foo`, found integer
|
= note: expected type `&Foo`
found type `&{integer}`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/mir-unpretty.rs:4:17
|
LL | let x: () = 0; //~ ERROR: mismatched types
| ^ expected (), found integral variable
| ^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`

View File

@ -10,7 +10,7 @@ error[E0308]: mismatched types
--> $DIR/E0409.rs:5:23
|
LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409
| ^ expected &{integer}, found integral variable
| ^ expected &{integer}, found integer
|
= note: expected type `&{integer}`
found type `{integer}`

View File

@ -49,7 +49,7 @@ LL | fn d() -> X<X<String, String>, String> {
| ---------------------------- expected `X<X<std::string::String, std::string::String>, std::string::String>` because of return type
...
LL | x //~ ERROR mismatched types
| ^ expected struct `std::string::String`, found integral variable
| ^ expected struct `std::string::String`, found integer
|
= note: expected type `X<X<_, std::string::String>, std::string::String>`
found type `X<X<_, {integer}>, {integer}>`
@ -61,7 +61,7 @@ LL | fn e() -> X<X<String, String>, String> {
| ---------------------------- expected `X<X<std::string::String, std::string::String>, std::string::String>` because of return type
...
LL | x //~ ERROR mismatched types
| ^ expected struct `std::string::String`, found integral variable
| ^ expected struct `std::string::String`, found integer
|
= note: expected type `X<X<_, std::string::String>, _>`
found type `X<X<_, {integer}>, _>`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/for-loop-has-unit-body.rs:3:9
|
LL | x //~ ERROR mismatched types
| ^ expected (), found integral variable
| ^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`

View File

@ -38,7 +38,7 @@ error[E0308]: mismatched types
LL | extern "C" fn baz() {
| - possibly return type missing here?
LL | 0 //~ ERROR mismatched types
| ^ expected (), found integral variable
| ^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`

View File

@ -16,7 +16,7 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `usize`
//~| found type `{float}`
//~| expected usize, found floating-point variable
//~| expected usize, found floating-point number
let e = [0; "foo"];
//~^ ERROR mismatched types
//~| expected type `usize`

View File

@ -23,7 +23,7 @@ error[E0308]: mismatched types
--> $DIR/repeat_count.rs:15:17
|
LL | let d = [0; 0.5];
| ^^^ expected usize, found floating-point variable
| ^^^ expected usize, found floating-point number
|
= note: expected type `usize`
found type `{float}`

View File

@ -8,7 +8,7 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `Foo<{float}, _>`
//~| found type `{integer}`
//~| expected struct `Foo`, found integral variable
//~| expected struct `Foo`, found integer
}
}

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/slightly-nice-generic-literal-messages.rs:7:9
|
LL | 1 => {}
| ^ expected struct `Foo`, found integral variable
| ^ expected struct `Foo`, found integer
|
= note: expected type `Foo<{float}, _>`
found type `{integer}`

View File

@ -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
}

View File

@ -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}`

View File

@ -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 };

View File

@ -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}`

View File

@ -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::<f32> {
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::<i32> {
x: 7,
//~^ ERROR mismatched types
//~| expected f32, found integral variable
//~| expected f32, found integer
y: 8,
};

View File

@ -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::<u32> { .. } => {} //~ ERROR wrong number of type arguments
| ^^^^^^^^^^^^^^^^^^^^ expected integral variable, found f32
| ^^^^^^^^^^^^^^^^^^^^ expected integer, found f32
|
= note: expected type `Point<{integer}>`
found type `Point<f32>`
@ -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<f32>`
@ -128,7 +128,7 @@ error[E0308]: mismatched types
--> $DIR/structure-constructor-type-mismatch.rs:67:9
|
LL | PairF::<u32> { .. } => {} //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^ expected integral variable, found f32
| ^^^^^^^^^^^^^^^^^^^ expected integer, found f32
|
= note: expected type `Pair<{integer}, {integer}>`
found type `Pair<f32, u32>`

View File

@ -4,7 +4,7 @@ error[E0271]: type mismatch resolving `<std::option::Option<f32> as std::ops::Tr
LL | 42
| ^^
| |
| expected f32, found integral variable
| expected f32, found integer
| help: use a float literal: `42.0`
|
= note: expected type `f32`

View File

@ -4,7 +4,7 @@ fn main() { let a: bool = 1; let b: i32 = true; }
//~^ ERROR mismatched types
//~| expected type `bool`
//~| found type `{integer}`
//~| expected bool, found integral variable
//~| expected bool, found integer
//~| ERROR mismatched types
//~| expected i32, found bool

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/type-mismatch-multiple.rs:3:27
|
LL | fn main() { let a: bool = 1; let b: i32 = true; }
| ^ expected bool, found integral variable
| ^ expected bool, found integer
|
= note: expected type `bool`
found type `{integer}`