Surround types with backticks in type errors

This commit is contained in:
Esteban Küber 2019-11-15 09:37:01 -08:00
parent 94c6425464
commit 6f8f70624b
351 changed files with 1086 additions and 1086 deletions

View File

@ -222,8 +222,8 @@ impl<'tcx> ty::TyS<'tcx> {
pub fn sort_string(&self, tcx: TyCtxt<'_>) -> Cow<'static, str> { pub fn sort_string(&self, tcx: TyCtxt<'_>) -> Cow<'static, str> {
match self.kind { match self.kind {
ty::Bool | ty::Char | ty::Int(_) | ty::Bool | ty::Char | ty::Int(_) |
ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => format!("{}", self).into(), ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => format!("`{}`", self).into(),
ty::Tuple(ref tys) if tys.is_empty() => format!("{}", self).into(), ty::Tuple(ref tys) if tys.is_empty() => format!("`{}`", self).into(),
ty::Adt(def, _) => format!("{} `{}`", def.descr(), tcx.def_path_str(def.did)).into(), ty::Adt(def, _) => format!("{} `{}`", def.descr(), tcx.def_path_str(def.did)).into(),
ty::Foreign(def_id) => format!("extern type `{}`", tcx.def_path_str(def_id)).into(), ty::Foreign(def_id) => format!("extern type `{}`", tcx.def_path_str(def_id)).into(),
@ -244,7 +244,7 @@ impl<'tcx> ty::TyS<'tcx> {
if tymut_string != "_" && ( if tymut_string != "_" && (
ty.is_simple_text() || tymut_string.len() < "mutable reference".len() ty.is_simple_text() || tymut_string.len() < "mutable reference".len()
) { ) {
format!("&{}", tymut_string).into() format!("`&{}`", tymut_string).into()
} else { // Unknown type name, it's long or has type arguments } else { // Unknown type name, it's long or has type arguments
match mutbl { match mutbl {
hir::Mutability::Mutable => "mutable reference", hir::Mutability::Mutable => "mutable reference",
@ -256,7 +256,7 @@ impl<'tcx> ty::TyS<'tcx> {
ty::FnPtr(_) => "fn pointer".into(), ty::FnPtr(_) => "fn pointer".into(),
ty::Dynamic(ref inner, ..) => { ty::Dynamic(ref inner, ..) => {
if let Some(principal) = inner.principal() { if let Some(principal) = inner.principal() {
format!("trait {}", tcx.def_path_str(principal.def_id())).into() format!("trait `{}`", tcx.def_path_str(principal.def_id())).into()
} else { } else {
"trait".into() "trait".into()
} }

View File

@ -209,7 +209,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
// LL | impl Bar for Foo { // LL | impl Bar for Foo {
// | ---------------- in this `impl` item // | ---------------- in this `impl` item
// LL | type Ok = (); // LL | type Ok = ();
// | ^^^^^^^^^^^^^ expected u32, found () // | ^^^^^^^^^^^^^ expected `u32`, found `()`
// | // |
// = note: expected type `u32` // = note: expected type `u32`
// found type `()` // found type `()`
@ -228,7 +228,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
// LL | impl Bar for Foo { // LL | impl Bar for Foo {
// | ---------------- in this `impl` item // | ---------------- in this `impl` item
// LL | type Ok = (); // LL | type Ok = ();
// | ^^^^^^^^^^^^^ expected u32, found () // | ^^^^^^^^^^^^^ expected `u32`, found `()`
// ... // ...
// LL | impl Bar2 for Foo2 { // LL | impl Bar2 for Foo2 {
// | ---------------- in this `impl` item // | ---------------- in this `impl` item

View File

@ -285,7 +285,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// || ----- expected because of this // || ----- expected because of this
// LL || } else { // LL || } else {
// LL || 10u32 // LL || 10u32
// || ^^^^^ expected i32, found u32 // || ^^^^^ expected `i32`, found `u32`
// LL || }; // LL || };
// ||_____- if and else have incompatible types // ||_____- if and else have incompatible types
// ``` // ```
@ -294,7 +294,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// The entire expression is in one line, only point at the arms // The entire expression is in one line, only point at the arms
// ``` // ```
// LL | let x = if true { 10i32 } else { 10u32 }; // LL | let x = if true { 10i32 } else { 10u32 };
// | ----- ^^^^^ expected i32, found u32 // | ----- ^^^^^ expected `i32`, found `u32`
// | | // | |
// | expected because of this // | expected because of this
// ``` // ```
@ -323,7 +323,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// | || ^ // | || ^
// | ||_____| // | ||_____|
// | |______if and else have incompatible types // | |______if and else have incompatible types
// | expected integer, found () // | expected integer, found `()`
// ``` // ```
// by not pointing at the entire expression: // by not pointing at the entire expression:
// ``` // ```
@ -335,7 +335,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// | ____________^ // | ____________^
// 5 | | // 5 | |
// 6 | | }; // 6 | | };
// | |_____^ expected integer, found () // | |_____^ expected integer, found `()`
// ``` // ```
if outer_sp.is_some() { if outer_sp.is_some() {
outer_sp = Some(self.tcx.sess.source_map().def_span(span)); outer_sp = Some(self.tcx.sess.source_map().def_span(span));

View File

@ -47,7 +47,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// 4 | let temp: usize = match a + b { /// 4 | let temp: usize = match a + b {
/// | ----- this expression has type `usize` /// | ----- this expression has type `usize`
/// 5 | Ok(num) => num, /// 5 | Ok(num) => num,
/// | ^^^^^^^ expected usize, found enum `std::result::Result` /// | ^^^^^^^ expected `usize`, found enum `std::result::Result`
/// | /// |
/// = note: expected type `usize` /// = note: expected type `usize`
/// found type `std::result::Result<_, _>` /// found type `std::result::Result<_, _>`

View File

@ -9,7 +9,7 @@ error[E0308]: mismatched types
--> $DIR/failed-doctest-missing-codes.rs:9:13 --> $DIR/failed-doctest-missing-codes.rs:9:13
| |
LL | let x: () = 5i32; LL | let x: () = 5i32;
| ^^^^ expected (), found i32 | ^^^^ expected `()`, found `i32`
error: aborting due to previous error error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/arg-type-mismatch.rs:5:30 --> $DIR/arg-type-mismatch.rs:5:30
| |
LL | fn main() { let i: (); i = f(()); } LL | fn main() { let i: (); i = f(()); }
| ^^ expected isize, found () | ^^ expected `isize`, found `()`
error: aborting due to previous error error: aborting due to previous error

View File

@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/array-break-length.rs:3:9 --> $DIR/array-break-length.rs:3:9
| |
LL | |_: [_; break]| {} LL | |_: [_; break]| {}
| ^^^^^^^^^^^^^^^^^^ expected (), found closure | ^^^^^^^^^^^^^^^^^^ expected `()`, found closure
| |
= note: expected unit type `()` = note: expected unit type `()`
found closure `[closure@$DIR/array-break-length.rs:3:9: 3:27]` found closure `[closure@$DIR/array-break-length.rs:3:9: 3:27]`
@ -23,7 +23,7 @@ error[E0308]: mismatched types
--> $DIR/array-break-length.rs:8:9 --> $DIR/array-break-length.rs:8:9
| |
LL | |_: [_; continue]| {} LL | |_: [_; continue]| {}
| ^^^^^^^^^^^^^^^^^^^^^ expected (), found closure | ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found closure
| |
= note: expected unit type `()` = note: expected unit type `()`
found closure `[closure@$DIR/array-break-length.rs:8:9: 8:30]` found closure `[closure@$DIR/array-break-length.rs:8:9: 8:30]`

View File

@ -1,12 +1,12 @@
fn main() { fn main() {
let _x: i32 = [1, 2, 3]; let _x: i32 = [1, 2, 3];
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected i32, found array //~| expected `i32`, found array
let x: &[i32] = &[1, 2, 3]; let x: &[i32] = &[1, 2, 3];
let _y: &i32 = x; let _y: &i32 = x;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected reference `&i32` //~| expected reference `&i32`
//~| found reference `&[i32]` //~| found reference `&[i32]`
//~| expected i32, found slice //~| expected `i32`, found slice
} }

View File

@ -2,13 +2,13 @@ error[E0308]: mismatched types
--> $DIR/array-not-vector.rs:2:19 --> $DIR/array-not-vector.rs:2:19
| |
LL | let _x: i32 = [1, 2, 3]; LL | let _x: i32 = [1, 2, 3];
| ^^^^^^^^^ expected i32, found array `[{integer}; 3]` | ^^^^^^^^^ expected `i32`, found array `[{integer}; 3]`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/array-not-vector.rs:7:20 --> $DIR/array-not-vector.rs:7:20
| |
LL | let _y: &i32 = x; LL | let _y: &i32 = x;
| ^ expected i32, found slice `[i32]` | ^ expected `i32`, found slice `[i32]`
| |
= note: expected reference `&i32` = note: expected reference `&i32`
found reference `&[i32]` found reference `&[i32]`

View File

@ -5,7 +5,7 @@ LL | const FROM: Self::Out;
| --------- type in trait | --------- type in trait
... ...
LL | const FROM: &'static str = "foo"; LL | const FROM: &'static str = "foo";
| ^^^^^^^^^^^^ expected associated type, found &str | ^^^^^^^^^^^^ expected associated type, found `&str`
| |
= note: expected associated type `<T as Foo>::Out` = note: expected associated type `<T as Foo>::Out`
found reference `&'static str` found reference `&'static str`

View File

@ -5,7 +5,7 @@ LL | const BAR: u32;
| --- type in trait | --- type in trait
... ...
LL | const BAR: i32 = -1; LL | const BAR: i32 = -1;
| ^^^ expected u32, found i32 | ^^^ expected `u32`, found `i32`
error: aborting due to previous error error: aborting due to previous error

View File

@ -37,8 +37,8 @@ pub fn main() {
let a = 42; let a = 42;
foo1(a); foo1(a);
//~^ ERROR type mismatch resolving //~^ ERROR type mismatch resolving
//~| expected struct `Bar`, found usize //~| expected struct `Bar`, found `usize`
baz(&a); baz(&a);
//~^ ERROR type mismatch resolving //~^ ERROR type mismatch resolving
//~| expected struct `Bar`, found usize //~| expected struct `Bar`, found `usize`
} }

View File

@ -16,13 +16,13 @@ LL | fn foo1<I: Foo<A=Bar>>(x: I) {
| ---- ----- required by this bound in `foo1` | ---- ----- required by this bound in `foo1`
... ...
LL | foo1(a); LL | foo1(a);
| ^^^^ expected struct `Bar`, found usize | ^^^^ expected struct `Bar`, found `usize`
error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar` error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
--> $DIR/associated-types-eq-3.rs:41:9 --> $DIR/associated-types-eq-3.rs:41:9
| |
LL | baz(&a); LL | baz(&a);
| ^^ expected struct `Bar`, found usize | ^^ expected struct `Bar`, found `usize`
| |
= note: required for the cast to the object type `dyn Foo<A = Bar>` = note: required for the cast to the object type `dyn Foo<A = Bar>`

View File

@ -7,7 +7,7 @@ LL | where T : for<'x> TheTrait<&'x isize, A = &'x isize>
| ------------- required by this bound in `foo` | ------------- required by this bound in `foo`
... ...
LL | foo::<UintStruct>(); LL | foo::<UintStruct>();
| ^^^^^^^^^^^^^^^^^ expected isize, found usize | ^^^^^^^^^^^^^^^^^ expected `isize`, found `usize`
| |
= note: expected reference `&isize` = note: expected reference `&isize`
found reference `&usize` found reference `&usize`
@ -21,7 +21,7 @@ LL | where T : for<'x> TheTrait<&'x isize, A = &'x usize>
| ------------- required by this bound in `bar` | ------------- required by this bound in `bar`
... ...
LL | bar::<IntStruct>(); LL | bar::<IntStruct>();
| ^^^^^^^^^^^^^^^^ expected usize, found isize | ^^^^^^^^^^^^^^^^ expected `usize`, found `isize`
| |
= note: expected reference `&usize` = note: expected reference `&usize`
found reference `&isize` found reference `&isize`

View File

@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<T as Foo>::Y == i32`
--> $DIR/associated-types-multiple-types-one-trait.rs:13:5 --> $DIR/associated-types-multiple-types-one-trait.rs:13:5
| |
LL | want_y(t); LL | want_y(t);
| ^^^^^^ expected i32, found associated type | ^^^^^^ expected `i32`, found associated type
... ...
LL | fn want_y<T:Foo<Y=i32>>(t: &T) { } LL | fn want_y<T:Foo<Y=i32>>(t: &T) { }
| ------ ----- required by this bound in `want_y` | ------ ----- required by this bound in `want_y`
@ -16,7 +16,7 @@ error[E0271]: type mismatch resolving `<T as Foo>::X == u32`
--> $DIR/associated-types-multiple-types-one-trait.rs:18:5 --> $DIR/associated-types-multiple-types-one-trait.rs:18:5
| |
LL | want_x(t); LL | want_x(t);
| ^^^^^^ expected u32, found associated type | ^^^^^^ expected `u32`, found associated type
... ...
LL | fn want_x<T:Foo<X=u32>>(t: &T) { } LL | fn want_x<T:Foo<X=u32>>(t: &T) { }
| ------ ----- required by this bound in `want_x` | ------ ----- required by this bound in `want_x`

View File

@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<std::vec::IntoIter<u32> as std::iter::It
--> $DIR/associated-types-overridden-binding-2.rs:6:43 --> $DIR/associated-types-overridden-binding-2.rs:6:43
| |
LL | let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter(); LL | let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter();
| ^^^^^^^^^^^^^^^^^^^^^ expected i32, found u32 | ^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
| |
= note: required for the cast to the object type `dyn std::iter::Iterator<Item = u32, Item = i32>` = note: required for the cast to the object type `dyn std::iter::Iterator<Item = u32, Item = i32>`

View File

@ -18,7 +18,7 @@ pub fn f2<T: Foo>(a: T) -> T::A {
pub fn f1_int_int() { pub fn f1_int_int() {
f1(2i32, 4i32); f1(2i32, 4i32);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected u32, found i32 //~| expected `u32`, found `i32`
} }
pub fn f1_int_uint() { pub fn f1_int_uint() {
@ -40,7 +40,7 @@ pub fn f1_uint_int() {
pub fn f2_int() { pub fn f2_int() {
let _: i32 = f2(2i32); let _: i32 = f2(2i32);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected i32, found u32 //~| expected `i32`, found `u32`
} }
pub fn main() { } pub fn main() { }

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/associated-types-path-2.rs:19:14 --> $DIR/associated-types-path-2.rs:19:14
| |
LL | f1(2i32, 4i32); LL | f1(2i32, 4i32);
| ^^^^ expected u32, found i32 | ^^^^ expected `u32`, found `i32`
| |
help: change the type of the numeric literal from `i32` to `u32` help: change the type of the numeric literal from `i32` to `u32`
| |
@ -43,7 +43,7 @@ error[E0308]: mismatched types
--> $DIR/associated-types-path-2.rs:41:18 --> $DIR/associated-types-path-2.rs:41:18
| |
LL | let _: i32 = f2(2i32); LL | let _: i32 = f2(2i32);
| ^^^^^^^^ expected i32, found u32 | ^^^^^^^^ expected `i32`, found `u32`
| |
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
| |

View File

@ -5,7 +5,7 @@ LL | fn visit() {}
| ---------- required by `Visit::visit` | ---------- required by `Visit::visit`
... ...
LL | <() as Visit>::visit(); LL | <() as Visit>::visit();
| ^^^^^^^^^^^^^^^^^^^^ expected (), found &() | ^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&()`
| |
= note: required because of the requirements on the impl of `Visit` for `()` = note: required because of the requirements on the impl of `Visit` for `()`

View File

@ -7,7 +7,7 @@ LL | type Ok;
LL | impl Bar for Foo { LL | impl Bar for Foo {
| ---------------- in this `impl` item | ---------------- in this `impl` item
LL | type Ok = (); LL | type Ok = ();
| ^^^^^^^^^^^^^ expected u32, found () | ^^^^^^^^^^^^^ expected `u32`, found `()`
error: aborting due to previous error error: aborting due to previous error

View File

@ -22,7 +22,7 @@ error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:13:43 --> $DIR/async-block-control-flow-static-semantics.rs:13:43
| |
LL | fn return_targets_async_block_not_fn() -> u8 { LL | fn return_targets_async_block_not_fn() -> u8 {
| --------------------------------- ^^ expected u8, found () | --------------------------------- ^^ expected `u8`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
@ -30,7 +30,7 @@ error[E0271]: type mismatch resolving `<impl std::future::Future as std::future:
--> $DIR/async-block-control-flow-static-semantics.rs:18:39 --> $DIR/async-block-control-flow-static-semantics.rs:18:39
| |
LL | let _: &dyn Future<Output = ()> = &block; LL | let _: &dyn Future<Output = ()> = &block;
| ^^^^^^ expected (), found u8 | ^^^^^^ expected `()`, found `u8`
| |
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>` = note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
@ -45,13 +45,13 @@ LL | | return 0u8;
... | ... |
LL | | LL | |
LL | | } LL | | }
| |_^ expected u8, found () | |_^ expected `u8`, found `()`
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()` error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
--> $DIR/async-block-control-flow-static-semantics.rs:27:39 --> $DIR/async-block-control-flow-static-semantics.rs:27:39
| |
LL | let _: &dyn Future<Output = ()> = &block; LL | let _: &dyn Future<Output = ()> = &block;
| ^^^^^^ expected (), found u8 | ^^^^^^ expected `()`, found `u8`
| |
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>` = note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
@ -59,7 +59,7 @@ error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:48:44 --> $DIR/async-block-control-flow-static-semantics.rs:48:44
| |
LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> { LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
| ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found () | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
| |
@ -70,7 +70,7 @@ error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:57:50 --> $DIR/async-block-control-flow-static-semantics.rs:57:50
| |
LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> { LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> {
| ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found () | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
| |

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/dont-suggest-missing-await.rs:14:18 --> $DIR/dont-suggest-missing-await.rs:14:18
| |
LL | take_u32(x) LL | take_u32(x)
| ^ expected u32, found opaque type | ^ expected `u32`, found opaque type
| |
= note: expected type `u32` = note: expected type `u32`
found opaque type `impl std::future::Future` found opaque type `impl std::future::Future`

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | take_u32(x) LL | take_u32(x)
| ^ | ^
| | | |
| expected u32, found opaque type | expected `u32`, found opaque type
| help: consider using `.await` here: `x.await` | help: consider using `.await` here: `x.await`
| |
= note: expected type `u32` = note: expected type `u32`

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | take_u32(x) LL | take_u32(x)
| ^ | ^
| | | |
| expected u32, found opaque type | expected `u32`, found opaque type
| help: consider using `.await` here: `x.await` | help: consider using `.await` here: `x.await`
| |
= note: expected type `u32` = note: expected type `u32`

View File

@ -2,13 +2,13 @@ error[E0308]: mismatched types
--> $DIR/binop-logic-float.rs:1:21 --> $DIR/binop-logic-float.rs:1:21
| |
LL | fn main() { let x = 1.0_f32 || 2.0_f32; } LL | fn main() { let x = 1.0_f32 || 2.0_f32; }
| ^^^^^^^ expected bool, found f32 | ^^^^^^^ expected `bool`, found `f32`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/binop-logic-float.rs:1:32 --> $DIR/binop-logic-float.rs:1:32
| |
LL | fn main() { let x = 1.0_f32 || 2.0_f32; } LL | fn main() { let x = 1.0_f32 || 2.0_f32; }
| ^^^^^^^ expected bool, found f32 | ^^^^^^^ expected `bool`, found `f32`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -2,13 +2,13 @@ error[E0308]: mismatched types
--> $DIR/binop-logic-int.rs:1:21 --> $DIR/binop-logic-int.rs:1:21
| |
LL | fn main() { let x = 1 && 2; } LL | fn main() { let x = 1 && 2; }
| ^ expected bool, found integer | ^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/binop-logic-int.rs:1:26 --> $DIR/binop-logic-int.rs:1:26
| |
LL | fn main() { let x = 1 && 2; } LL | fn main() { let x = 1 && 2; }
| ^ expected bool, found integer | ^ expected `bool`, found integer
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -7,7 +7,7 @@ LL | |
LL | | foo(); LL | | foo();
| | - help: consider removing this semicolon | | - help: consider removing this semicolon
LL | | }; LL | | };
| |_____^ expected i32, found () | |_____^ expected `i32`, found `()`
error: aborting due to previous error error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/block-must-not-have-result-do.rs:3:9 --> $DIR/block-must-not-have-result-do.rs:3:9
| |
LL | true LL | true
| ^^^^ expected (), found bool | ^^^^ expected `()`, found `bool`
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn drop(&mut self) { LL | fn drop(&mut self) {
| - expected `()` because of default return type | - expected `()` because of default return type
LL | true LL | true
| ^^^^ expected (), found bool | ^^^^ expected `()`, found `bool`
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,6 +1,6 @@
fn main() { fn main() {
while true { //~ WARN denote infinite loops with while true { //~ WARN denote infinite loops with
true //~ ERROR mismatched types true //~ ERROR mismatched types
//~| expected (), found bool //~| expected `()`, found `bool`
} }
} }

View File

@ -10,7 +10,7 @@ error[E0308]: mismatched types
--> $DIR/block-must-not-have-result-while.rs:3:9 --> $DIR/block-must-not-have-result-while.rs:3:9
| |
LL | true LL | true
| ^^^^ expected (), found bool | ^^^^ expected `()`, found `bool`
error: aborting due to previous error error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/consider-removing-last-semi.rs:1:11 --> $DIR/consider-removing-last-semi.rs:1:11
| |
LL | fn f() -> String { LL | fn f() -> String {
| - ^^^^^^ expected struct `std::string::String`, found () | - ^^^^^^ expected struct `std::string::String`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
LL | 0u8; LL | 0u8;
@ -13,7 +13,7 @@ error[E0308]: mismatched types
--> $DIR/consider-removing-last-semi.rs:6:11 --> $DIR/consider-removing-last-semi.rs:6:11
| |
LL | fn g() -> String { LL | fn g() -> String {
| - ^^^^^^ expected struct `std::string::String`, found () | - ^^^^^^ expected struct `std::string::String`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
LL | "this won't work".to_string(); LL | "this won't work".to_string();

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-11714.rs:1:14 --> $DIR/issue-11714.rs:1:14
| |
LL | fn blah() -> i32 { LL | fn blah() -> i32 {
| ---- ^^^ expected i32, found () | ---- ^^^ expected `i32`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
... ...

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-13428.rs:3:13 --> $DIR/issue-13428.rs:3:13
| |
LL | fn foo() -> String { LL | fn foo() -> String {
| --- ^^^^^^ expected struct `std::string::String`, found () | --- ^^^^^^ expected struct `std::string::String`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
... ...
@ -13,7 +13,7 @@ error[E0308]: mismatched types
--> $DIR/issue-13428.rs:11:13 --> $DIR/issue-13428.rs:11:13
| |
LL | fn bar() -> String { LL | fn bar() -> String {
| --- ^^^^^^ expected struct `std::string::String`, found () | --- ^^^^^^ expected struct `std::string::String`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
LL | "foobar".to_string() LL | "foobar".to_string()

View File

@ -6,7 +6,7 @@ mod a {
pub fn get_enum_struct_variant() -> () { pub fn get_enum_struct_variant() -> () {
Enum::EnumStructVariant { x: 1, y: 2, z: 3 } Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected (), found enum `a::Enum` //~| expected `()`, found enum `a::Enum`
} }
} }
@ -19,7 +19,7 @@ mod b {
match enum_struct_variant { match enum_struct_variant {
a::Enum::EnumStructVariant { x, y, z } => { a::Enum::EnumStructVariant { x, y, z } => {
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected (), found enum `a::Enum` //~| expected `()`, found enum `a::Enum`
} }
} }
} }

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | pub fn get_enum_struct_variant() -> () { LL | pub fn get_enum_struct_variant() -> () {
| -- expected `()` because of return type | -- expected `()` because of return type
LL | Enum::EnumStructVariant { x: 1, y: 2, z: 3 } LL | Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `a::Enum`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/issue-13624.rs:20:9 --> $DIR/issue-13624.rs:20:9
@ -12,7 +12,7 @@ error[E0308]: mismatched types
LL | match enum_struct_variant { LL | match enum_struct_variant {
| ------------------- this match expression has type `()` | ------------------- this match expression has type `()`
LL | a::Enum::EnumStructVariant { x, y, z } => { LL | a::Enum::EnumStructVariant { x, y, z } => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `a::Enum`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn foo(x: i32) { LL | fn foo(x: i32) {
| - possibly return type missing here? | - possibly return type missing here?
LL | |y| x + y LL | |y| x + y
| ^^^^^^^^^ expected (), found closure | ^^^^^^^^^ expected `()`, found closure
| |
= note: expected unit type `()` = note: expected unit type `()`
found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]` found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]`

View File

@ -15,7 +15,7 @@ LL | fn main() {
| - expected `()` because of default return type | - expected `()` because of default return type
LL | let b = Bob + 3.5; LL | let b = Bob + 3.5;
LL | b + 3 LL | b + 3
| ^^^^^ expected (), found struct `Bob` | ^^^^^ expected `()`, found struct `Bob`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -3,5 +3,5 @@ fn main() {
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected unit type `()` //~| expected unit type `()`
//~| found reference `&_` //~| found reference `&_`
//~| expected (), found reference //~| expected `()`, found reference
} }

View File

@ -6,7 +6,7 @@ LL | fn main() {
LL | &panic!() LL | &panic!()
| ^^^^^^^^^ | ^^^^^^^^^
| | | |
| expected (), found reference | expected `()`, found reference
| help: consider removing the borrow: `panic!()` | help: consider removing the borrow: `panic!()`
| |
= note: expected unit type `()` = note: expected unit type `()`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/unexpected-return-on-unit.rs:9:5 --> $DIR/unexpected-return-on-unit.rs:9:5
| |
LL | foo() LL | foo()
| ^^^^^ expected (), found usize | ^^^^^ expected `()`, found `usize`
| |
help: try adding a semicolon help: try adding a semicolon
| |

View File

@ -5,7 +5,7 @@ LL | let _: ! = {
| ____________________^ | ____________________^
LL | | 'a: while break 'a {}; LL | | 'a: while break 'a {};
LL | | }; LL | | };
| |_________^ expected !, found () | |_________^ expected `!`, found `()`
| |
= note: expected type `!` = note: expected type `!`
found unit type `()` found unit type `()`
@ -16,7 +16,7 @@ error[E0308]: mismatched types
LL | / while false { LL | / while false {
LL | | break LL | | break
LL | | } LL | | }
| |_____________^ expected !, found () | |_____________^ expected `!`, found `()`
| |
= note: expected type `!` = note: expected type `!`
found unit type `()` found unit type `()`
@ -27,7 +27,7 @@ error[E0308]: mismatched types
LL | / while false { LL | / while false {
LL | | return LL | | return
LL | | } LL | | }
| |_____________^ expected !, found () | |_____________^ expected `!`, found `()`
| |
= note: expected type `!` = note: expected type `!`
found unit type `()` found unit type `()`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/type_inference.rs:21:14 --> $DIR/type_inference.rs:21:14
| |
LL | only_foo(x); LL | only_foo(x);
| ^ expected i32, found floating-point number | ^ expected `i32`, found floating-point number
error[E0277]: the trait bound `{float}: Bar` is not satisfied error[E0277]: the trait bound `{float}: Bar` is not satisfied
--> $DIR/type_inference.rs:25:5 --> $DIR/type_inference.rs:25:5

View File

@ -20,7 +20,7 @@ error[E0308]: mismatched types
--> $DIR/closure-array-break-length.rs:4:11 --> $DIR/closure-array-break-length.rs:4:11
| |
LL | while |_: [_; continue]| {} {} LL | while |_: [_; continue]| {} {}
| ^^^^^^^^^^^^^^^^^^^^^ expected bool, found closure | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found closure
| |
= note: expected type `bool` = note: expected type `bool`
found closure `[closure@$DIR/closure-array-break-length.rs:4:11: 4:32]` found closure `[closure@$DIR/closure-array-break-length.rs:4:11: 4:32]`
@ -29,7 +29,7 @@ error[E0308]: mismatched types
--> $DIR/closure-array-break-length.rs:7:11 --> $DIR/closure-array-break-length.rs:7:11
| |
LL | while |_: [_; break]| {} {} LL | while |_: [_; break]| {} {}
| ^^^^^^^^^^^^^^^^^^ expected bool, found closure | ^^^^^^^^^^^^^^^^^^ expected `bool`, found closure
| |
= note: expected type `bool` = note: expected type `bool`
found closure `[closure@$DIR/closure-array-break-length.rs:7:11: 7:29]` found closure `[closure@$DIR/closure-array-break-length.rs:7:11: 7:29]`

View File

@ -10,7 +10,7 @@ error[E0308]: mismatched types
LL | fn foo() { LL | fn foo() {
| - help: try adding a return type: `-> &'static str` | - help: try adding a return type: `-> &'static str`
LL | "bar boo" LL | "bar boo"
| ^^^^^^^^^^^^^^^^^^^^ expected (), found &str | ^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&str`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -29,7 +29,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:13:13 --> $DIR/coerce-expect-unsized-ascribed.rs:13:13
| |
LL | let _ = box { |x| (x as u8) }: Box<dyn Fn(i32) -> _>; LL | let _ = box { |x| (x as u8) }: Box<dyn Fn(i32) -> _>;
| ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | ^^^^^^^^^^^^^^^^^^^^^ expected trait `std::ops::Fn`, found closure
| |
= note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> u8>` = note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> u8>`
found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:32]>` found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:32]>`
@ -38,7 +38,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:14:13 --> $DIR/coerce-expect-unsized-ascribed.rs:14:13
| |
LL | let _ = box if true { false } else { true }: Box<dyn Debug>; LL | let _ = box if true { false } else { true }: Box<dyn Debug>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `bool`
| |
= note: expected struct `std::boxed::Box<dyn std::fmt::Debug>` = note: expected struct `std::boxed::Box<dyn std::fmt::Debug>`
found struct `std::boxed::Box<bool>` found struct `std::boxed::Box<bool>`
@ -47,7 +47,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:15:13 --> $DIR/coerce-expect-unsized-ascribed.rs:15:13
| |
LL | let _ = box match true { true => 'a', false => 'b' }: Box<dyn Debug>; LL | let _ = box match true { true => 'a', false => 'b' }: Box<dyn Debug>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `char`
| |
= note: expected struct `std::boxed::Box<dyn std::fmt::Debug>` = note: expected struct `std::boxed::Box<dyn std::fmt::Debug>`
found struct `std::boxed::Box<char>` found struct `std::boxed::Box<char>`
@ -83,7 +83,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:21:13 --> $DIR/coerce-expect-unsized-ascribed.rs:21:13
| |
LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _;
| ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | ^^^^^^^^^^^^^^^^^^ expected trait `std::ops::Fn`, found closure
| |
= note: expected reference `&dyn std::ops::Fn(i32) -> u8` = note: expected reference `&dyn std::ops::Fn(i32) -> u8`
found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]` found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]`
@ -92,7 +92,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:22:13 --> $DIR/coerce-expect-unsized-ascribed.rs:22:13
| |
LL | let _ = &if true { false } else { true }: &dyn Debug; LL | let _ = &if true { false } else { true }: &dyn Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `bool`
| |
= note: expected reference `&dyn std::fmt::Debug` = note: expected reference `&dyn std::fmt::Debug`
found reference `&bool` found reference `&bool`
@ -101,7 +101,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:23:13 --> $DIR/coerce-expect-unsized-ascribed.rs:23:13
| |
LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `char`
| |
= note: expected reference `&dyn std::fmt::Debug` = note: expected reference `&dyn std::fmt::Debug`
found reference `&char` found reference `&char`
@ -119,7 +119,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:26:13 --> $DIR/coerce-expect-unsized-ascribed.rs:26:13
| |
LL | let _ = Box::new(|x| (x as u8)): Box<dyn Fn(i32) -> _>; LL | let _ = Box::new(|x| (x as u8)): Box<dyn Fn(i32) -> _>;
| ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::ops::Fn`, found closure
| |
= note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> _>` = note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> _>`
found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>` found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>`

View File

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

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/coercion-missing-tail-expected-type.rs:3:24 --> $DIR/coercion-missing-tail-expected-type.rs:3:24
| |
LL | fn plus_one(x: i32) -> i32 { LL | fn plus_one(x: i32) -> i32 {
| -------- ^^^ expected i32, found () | -------- ^^^ expected `i32`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
LL | x + 1; LL | x + 1;
@ -12,7 +12,7 @@ error[E0308]: mismatched types
--> $DIR/coercion-missing-tail-expected-type.rs:7:13 --> $DIR/coercion-missing-tail-expected-type.rs:7:13
| |
LL | fn foo() -> Result<u8, u64> { LL | fn foo() -> Result<u8, u64> {
| --- ^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found () | --- ^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
LL | Ok(1); LL | Ok(1);

View File

@ -3,5 +3,5 @@
fn main() { fn main() {
let _: &[i32] = [0]; let _: &[i32] = [0];
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected &[i32], found array `[{integer}; 1]` //~| expected `&[i32]`, found array `[{integer}; 1]`
} }

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | let _: &[i32] = [0]; LL | let _: &[i32] = [0];
| ^^^ | ^^^
| | | |
| expected &[i32], found array `[{integer}; 1]` | expected `&[i32]`, found array `[{integer}; 1]`
| help: consider borrowing here: `&[0]` | help: consider borrowing here: `&[0]`
error: aborting due to previous error error: aborting due to previous error

View File

@ -19,7 +19,7 @@ error[E0308]: mismatched types
--> $DIR/fn-const-param-infer.rs:20:24 --> $DIR/fn-const-param-infer.rs:20:24
| |
LL | let _ = Checked::<{generic_arg::<u32>}>; LL | let _ = Checked::<{generic_arg::<u32>}>;
| ^^^^^^^^^^^^^^^^^^ expected usize, found u32 | ^^^^^^^^^^^^^^^^^^ expected `usize`, found `u32`
| |
= note: expected fn pointer `fn(usize) -> bool` = note: expected fn pointer `fn(usize) -> bool`
found fn item `fn(u32) -> bool {generic_arg::<u32>}` found fn item `fn(u32) -> bool {generic_arg::<u32>}`

View File

@ -19,7 +19,7 @@ error[E0308]: mismatched types
--> $DIR/types-mismatch-const-args.rs:15:41 --> $DIR/types-mismatch-const-args.rs:15:41
| |
LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u16, found u32 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
| |
= note: expected struct `A<'a, u16, _, _>` = note: expected struct `A<'a, u16, _, _>`
found struct `A<'b, u32, _, _>` found struct `A<'b, u32, _, _>`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/const-cast-wrong-type.rs:2:23 --> $DIR/const-cast-wrong-type.rs:2:23
| |
LL | static b: *const i8 = &a as *const i8; LL | static b: *const i8 = &a as *const i8;
| ^^^^^^^^^^^^^^^ expected u8, found i8 | ^^^^^^^^^^^^^^^ expected `u8`, found `i8`
error: aborting due to previous error error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/const-eval-overflow-3b.rs:18:22 --> $DIR/const-eval-overflow-3b.rs:18:22
| |
LL | = [0; (i8::MAX + 1u8) as usize]; LL | = [0; (i8::MAX + 1u8) as usize];
| ^^^ expected i8, found u8 | ^^^ expected `i8`, found `u8`
error[E0277]: cannot add `u8` to `i8` error[E0277]: cannot add `u8` to `i8`
--> $DIR/const-eval-overflow-3b.rs:18:20 --> $DIR/const-eval-overflow-3b.rs:18:20

View File

@ -11,7 +11,7 @@ use std::{u8, u16, u32, u64, usize};
const A_I8_T const A_I8_T
: [u32; (i8::MAX as i8 + 1u8) as usize] : [u32; (i8::MAX as i8 + 1u8) as usize]
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected i8, found u8 //~| expected `i8`, found `u8`
//~| ERROR cannot add `u8` to `i8` //~| ERROR cannot add `u8` to `i8`
= [0; (i8::MAX as usize) + 1]; = [0; (i8::MAX as usize) + 1];

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/const-eval-overflow-4b.rs:12:30 --> $DIR/const-eval-overflow-4b.rs:12:30
| |
LL | : [u32; (i8::MAX as i8 + 1u8) as usize] LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
| ^^^ expected i8, found u8 | ^^^ expected `i8`, found `u8`
error[E0277]: cannot add `u8` to `i8` error[E0277]: cannot add `u8` to `i8`
--> $DIR/const-eval-overflow-4b.rs:12:28 --> $DIR/const-eval-overflow-4b.rs:12:28

View File

@ -8,7 +8,7 @@ const CONSTANT: S = S(0);
enum E { enum E {
V = CONSTANT, V = CONSTANT,
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected isize, found struct `S` //~| expected `isize`, found struct `S`
} }
fn main() {} fn main() {}

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/const-eval-span.rs:9:9 --> $DIR/const-eval-span.rs:9:9
| |
LL | V = CONSTANT, LL | V = CONSTANT,
| ^^^^^^^^ expected isize, found struct `S` | ^^^^^^^^ expected `isize`, found struct `S`
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,76 +1,76 @@
const X: usize = 42 && 39; const X: usize = 42 && 39;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected bool, found integer //~| expected `bool`, found integer
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected bool, found integer //~| expected `bool`, found integer
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected usize, found bool //~| expected `usize`, found `bool`
const ARR: [i32; X] = [99; 34]; const ARR: [i32; X] = [99; 34];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
const X1: usize = 42 || 39; const X1: usize = 42 || 39;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected bool, found integer //~| expected `bool`, found integer
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected bool, found integer //~| expected `bool`, found integer
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected usize, found bool //~| expected `usize`, found `bool`
const ARR1: [i32; X1] = [99; 47]; const ARR1: [i32; X1] = [99; 47];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
const X2: usize = -42 || -39; const X2: usize = -42 || -39;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected bool, found integer //~| expected `bool`, found integer
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected bool, found integer //~| expected `bool`, found integer
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected usize, found bool //~| expected `usize`, found `bool`
const ARR2: [i32; X2] = [99; 18446744073709551607]; const ARR2: [i32; X2] = [99; 18446744073709551607];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
const X3: usize = -42 && -39; const X3: usize = -42 && -39;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected bool, found integer //~| expected `bool`, found integer
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected bool, found integer //~| expected `bool`, found integer
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected usize, found bool //~| expected `usize`, found `bool`
const ARR3: [i32; X3] = [99; 6]; const ARR3: [i32; X3] = [99; 6];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
const Y: usize = 42.0 == 42.0; const Y: usize = 42.0 == 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected usize, found bool //~| expected `usize`, found `bool`
const ARRR: [i32; Y] = [99; 1]; const ARRR: [i32; Y] = [99; 1];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
const Y1: usize = 42.0 >= 42.0; const Y1: usize = 42.0 >= 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected usize, found bool //~| expected `usize`, found `bool`
const ARRR1: [i32; Y1] = [99; 1]; const ARRR1: [i32; Y1] = [99; 1];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
const Y2: usize = 42.0 <= 42.0; const Y2: usize = 42.0 <= 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected usize, found bool //~| expected `usize`, found `bool`
const ARRR2: [i32; Y2] = [99; 1]; const ARRR2: [i32; Y2] = [99; 1];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
const Y3: usize = 42.0 > 42.0; const Y3: usize = 42.0 > 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected usize, found bool //~| expected `usize`, found `bool`
const ARRR3: [i32; Y3] = [99; 0]; const ARRR3: [i32; Y3] = [99; 0];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
const Y4: usize = 42.0 < 42.0; const Y4: usize = 42.0 < 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected usize, found bool //~| expected `usize`, found `bool`
const ARRR4: [i32; Y4] = [99; 0]; const ARRR4: [i32; Y4] = [99; 0];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
const Y5: usize = 42.0 != 42.0; const Y5: usize = 42.0 != 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected usize, found bool //~| expected `usize`, found `bool`
const ARRR5: [i32; Y5] = [99; 0]; const ARRR5: [i32; Y5] = [99; 0];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed

View File

@ -2,19 +2,19 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:1:18 --> $DIR/const-integer-bool-ops.rs:1:18
| |
LL | const X: usize = 42 && 39; LL | const X: usize = 42 && 39;
| ^^ expected bool, found integer | ^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:1:24 --> $DIR/const-integer-bool-ops.rs:1:24
| |
LL | const X: usize = 42 && 39; LL | const X: usize = 42 && 39;
| ^^ expected bool, found integer | ^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:1:18 --> $DIR/const-integer-bool-ops.rs:1:18
| |
LL | const X: usize = 42 && 39; LL | const X: usize = 42 && 39;
| ^^^^^^^^ expected usize, found bool | ^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:8:18 --> $DIR/const-integer-bool-ops.rs:8:18
@ -26,19 +26,19 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:11:19 --> $DIR/const-integer-bool-ops.rs:11:19
| |
LL | const X1: usize = 42 || 39; LL | const X1: usize = 42 || 39;
| ^^ expected bool, found integer | ^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:11:25 --> $DIR/const-integer-bool-ops.rs:11:25
| |
LL | const X1: usize = 42 || 39; LL | const X1: usize = 42 || 39;
| ^^ expected bool, found integer | ^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:11:19 --> $DIR/const-integer-bool-ops.rs:11:19
| |
LL | const X1: usize = 42 || 39; LL | const X1: usize = 42 || 39;
| ^^^^^^^^ expected usize, found bool | ^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:18:19 --> $DIR/const-integer-bool-ops.rs:18:19
@ -50,19 +50,19 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:21:19 --> $DIR/const-integer-bool-ops.rs:21:19
| |
LL | const X2: usize = -42 || -39; LL | const X2: usize = -42 || -39;
| ^^^ expected bool, found integer | ^^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:21:26 --> $DIR/const-integer-bool-ops.rs:21:26
| |
LL | const X2: usize = -42 || -39; LL | const X2: usize = -42 || -39;
| ^^^ expected bool, found integer | ^^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:21:19 --> $DIR/const-integer-bool-ops.rs:21:19
| |
LL | const X2: usize = -42 || -39; LL | const X2: usize = -42 || -39;
| ^^^^^^^^^^ expected usize, found bool | ^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:28:19 --> $DIR/const-integer-bool-ops.rs:28:19
@ -74,19 +74,19 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:31:19 --> $DIR/const-integer-bool-ops.rs:31:19
| |
LL | const X3: usize = -42 && -39; LL | const X3: usize = -42 && -39;
| ^^^ expected bool, found integer | ^^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:31:26 --> $DIR/const-integer-bool-ops.rs:31:26
| |
LL | const X3: usize = -42 && -39; LL | const X3: usize = -42 && -39;
| ^^^ expected bool, found integer | ^^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:31:19 --> $DIR/const-integer-bool-ops.rs:31:19
| |
LL | const X3: usize = -42 && -39; LL | const X3: usize = -42 && -39;
| ^^^^^^^^^^ expected usize, found bool | ^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:38:19 --> $DIR/const-integer-bool-ops.rs:38:19
@ -98,7 +98,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:41:18 --> $DIR/const-integer-bool-ops.rs:41:18
| |
LL | const Y: usize = 42.0 == 42.0; LL | const Y: usize = 42.0 == 42.0;
| ^^^^^^^^^^^^ expected usize, found bool | ^^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:44:19 --> $DIR/const-integer-bool-ops.rs:44:19
@ -110,7 +110,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:47:19 --> $DIR/const-integer-bool-ops.rs:47:19
| |
LL | const Y1: usize = 42.0 >= 42.0; LL | const Y1: usize = 42.0 >= 42.0;
| ^^^^^^^^^^^^ expected usize, found bool | ^^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:50:20 --> $DIR/const-integer-bool-ops.rs:50:20
@ -122,7 +122,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:53:19 --> $DIR/const-integer-bool-ops.rs:53:19
| |
LL | const Y2: usize = 42.0 <= 42.0; LL | const Y2: usize = 42.0 <= 42.0;
| ^^^^^^^^^^^^ expected usize, found bool | ^^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:56:20 --> $DIR/const-integer-bool-ops.rs:56:20
@ -134,7 +134,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:59:19 --> $DIR/const-integer-bool-ops.rs:59:19
| |
LL | const Y3: usize = 42.0 > 42.0; LL | const Y3: usize = 42.0 > 42.0;
| ^^^^^^^^^^^ expected usize, found bool | ^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:62:20 --> $DIR/const-integer-bool-ops.rs:62:20
@ -146,7 +146,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:65:19 --> $DIR/const-integer-bool-ops.rs:65:19
| |
LL | const Y4: usize = 42.0 < 42.0; LL | const Y4: usize = 42.0 < 42.0;
| ^^^^^^^^^^^ expected usize, found bool | ^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:68:20 --> $DIR/const-integer-bool-ops.rs:68:20
@ -158,7 +158,7 @@ error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:71:19 --> $DIR/const-integer-bool-ops.rs:71:19
| |
LL | const Y5: usize = 42.0 != 42.0; LL | const Y5: usize = 42.0 != 42.0;
| ^^^^^^^^^^^^ expected usize, found bool | ^^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:74:20 --> $DIR/const-integer-bool-ops.rs:74:20

View File

@ -2,7 +2,7 @@
const TUP: (usize,) = 5usize << 64; const TUP: (usize,) = 5usize << 64;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected tuple, found usize //~| expected tuple, found `usize`
const ARR: [i32; TUP.0] = []; const ARR: [i32; TUP.0] = [];
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/const-tup-index-span.rs:3:23 --> $DIR/const-tup-index-span.rs:3:23
| |
LL | const TUP: (usize,) = 5usize << 64; LL | const TUP: (usize,) = 5usize << 64;
| ^^^^^^^^^^^^ expected tuple, found usize | ^^^^^^^^^^^^ expected tuple, found `usize`
| |
= note: expected tuple `(usize,)` = note: expected tuple `(usize,)`
found type `usize` found type `usize`

View File

@ -2,13 +2,13 @@ error[E0308]: mismatched types
--> $DIR/const-type-mismatch.rs:4:21 --> $DIR/const-type-mismatch.rs:4:21
| |
LL | const TWELVE: u16 = TEN + 2; LL | const TWELVE: u16 = TEN + 2;
| ^^^^^^^ expected u16, found u8 | ^^^^^^^ expected `u16`, found `u8`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-type-mismatch.rs:9:27 --> $DIR/const-type-mismatch.rs:9:27
| |
LL | const ALSO_TEN: u16 = TEN; LL | const ALSO_TEN: u16 = TEN;
| ^^^ expected u16, found u8 | ^^^ expected `u16`, found `u8`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/enum-discr-type-err.rs:18:21 --> $DIR/enum-discr-type-err.rs:18:21
| |
LL | $( $v = $s::V, )* LL | $( $v = $s::V, )*
| ^^^^^ expected isize, found i32 | ^^^^^ expected `isize`, found `i32`
... ...
LL | / mac! { LL | / mac! {
LL | | A = F, LL | | A = F,

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—"; LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—";
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
| | | |
| expected struct `std::string::String`, found &str | expected struct `std::string::String`, found `&str`
| help: try using a conversion method: `"'Tis a fond Ambush—".to_string()` | help: try using a conversion method: `"'Tis a fond Ambush—".to_string()`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -13,7 +13,7 @@ error[E0308]: mismatched types
LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise"); LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | | |
| expected struct `std::path::PathBuf`, found &std::path::Path | expected struct `std::path::PathBuf`, found `&std::path::Path`
| help: try using a conversion method: `Path::new("/ern/her/own/surprise").to_path_buf()` | help: try using a conversion method: `Path::new("/ern/her/own/surprise").to_path_buf()`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -31,7 +31,7 @@ error[E0308]: mismatched types
LL | let _prove_piercing_earnest: Vec<usize> = &[1, 2, 3]; LL | let _prove_piercing_earnest: Vec<usize> = &[1, 2, 3];
| ^^^^^^^^^^ | ^^^^^^^^^^
| | | |
| expected struct `std::vec::Vec`, found &[{integer}; 3] | expected struct `std::vec::Vec`, found `&[{integer}; 3]`
| help: try using a conversion method: `(&[1, 2, 3]).to_vec()` | help: try using a conversion method: `(&[1, 2, 3]).to_vec()`
| |
= note: expected struct `std::vec::Vec<usize>` = note: expected struct `std::vec::Vec<usize>`

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | let _y: &dyn Trait = x; LL | let _y: &dyn Trait = x;
| ^ | ^
| | | |
| expected &dyn Trait, found struct `std::boxed::Box` | expected `&dyn Trait`, found struct `std::boxed::Box`
| help: consider borrowing here: `&x` | help: consider borrowing here: `&x`
| |
= note: expected reference `&dyn Trait` = note: expected reference `&dyn Trait`

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | foo(s); LL | foo(s);
| ^ | ^
| | | |
| expected struct `std::string::String`, found &std::string::String | expected struct `std::string::String`, found `&std::string::String`
| help: try using a conversion method: `s.to_string()` | help: try using a conversion method: `s.to_string()`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -13,7 +13,7 @@ error[E0308]: mismatched types
LL | foo3(u); LL | foo3(u);
| ^ | ^
| | | |
| expected u32, found &u32 | expected `u32`, found `&u32`
| help: consider dereferencing the borrow: `*u` | help: consider dereferencing the borrow: `*u`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -22,7 +22,7 @@ error[E0308]: mismatched types
LL | foo(&"aaa".to_owned()); LL | foo(&"aaa".to_owned());
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| | | |
| expected struct `std::string::String`, found &std::string::String | expected struct `std::string::String`, found `&std::string::String`
| help: consider removing the borrow: `"aaa".to_owned()` | help: consider removing the borrow: `"aaa".to_owned()`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -31,14 +31,14 @@ error[E0308]: mismatched types
LL | foo(&mut "aaa".to_owned()); LL | foo(&mut "aaa".to_owned());
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
| | | |
| expected struct `std::string::String`, found &mut std::string::String | expected struct `std::string::String`, found `&mut std::string::String`
| help: consider removing the borrow: `"aaa".to_owned()` | help: consider removing the borrow: `"aaa".to_owned()`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:2:20 --> $DIR/deref-suggestion.rs:2:20
| |
LL | ($x:expr) => { &$x } LL | ($x:expr) => { &$x }
| ^^^ expected u32, found &{integer} | ^^^ expected `u32`, found `&{integer}`
... ...
LL | foo3(borrow!(0)); LL | foo3(borrow!(0));
| ---------- in this macro invocation | ---------- in this macro invocation
@ -47,7 +47,7 @@ error[E0308]: mismatched types
--> $DIR/deref-suggestion.rs:36:5 --> $DIR/deref-suggestion.rs:36:5
| |
LL | assert_eq!(3i32, &3i32); LL | assert_eq!(3i32, &3i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found &i32 | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `&i32`
| |
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
@ -57,7 +57,7 @@ error[E0308]: mismatched types
LL | let s = S { u }; LL | let s = S { u };
| ^ | ^
| | | |
| expected &u32, found integer | expected `&u32`, found integer
| help: consider borrowing here: `u: &u` | help: consider borrowing here: `u: &u`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -66,7 +66,7 @@ error[E0308]: mismatched types
LL | let s = S { u: u }; LL | let s = S { u: u };
| ^ | ^
| | | |
| expected &u32, found integer | expected `&u32`, found integer
| help: consider borrowing here: `&u` | help: consider borrowing here: `&u`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -75,7 +75,7 @@ error[E0308]: mismatched types
LL | let r = R { i }; LL | let r = R { i };
| ^ | ^
| | | |
| expected u32, found &{integer} | expected `u32`, found `&{integer}`
| help: consider dereferencing the borrow: `i: *i` | help: consider dereferencing the borrow: `i: *i`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -84,7 +84,7 @@ error[E0308]: mismatched types
LL | let r = R { i: i }; LL | let r = R { i: i };
| ^ | ^
| | | |
| expected u32, found &{integer} | expected `u32`, found `&{integer}`
| help: consider dereferencing the borrow: `*i` | help: consider dereferencing the borrow: `*i`
error: aborting due to 10 previous errors error: aborting due to 10 previous errors

View File

@ -33,12 +33,12 @@ fn main() {
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected trait object `dyn T` //~| expected trait object `dyn T`
//~| found reference `&_` //~| found reference `&_`
//~| expected trait T, found reference //~| expected trait `T`, found reference
let &&&x = &(&1isize as &dyn T); let &&&x = &(&1isize as &dyn T);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected trait object `dyn T` //~| expected trait object `dyn T`
//~| found reference `&_` //~| found reference `&_`
//~| expected trait T, found reference //~| expected trait `T`, found reference
let box box x = box 1isize as Box<dyn T>; let box box x = box 1isize as Box<dyn T>;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected trait object `dyn T` //~| expected trait object `dyn T`

View File

@ -22,7 +22,7 @@ error[E0308]: mismatched types
LL | let &&x = &1isize as &dyn T; LL | let &&x = &1isize as &dyn T;
| ^^ | ^^
| | | |
| expected trait T, found reference | expected trait `T`, found reference
| help: you can probably remove the explicit borrow: `x` | help: you can probably remove the explicit borrow: `x`
| |
= note: expected trait object `dyn T` = note: expected trait object `dyn T`
@ -34,7 +34,7 @@ error[E0308]: mismatched types
LL | let &&&x = &(&1isize as &dyn T); LL | let &&&x = &(&1isize as &dyn T);
| ^^ | ^^
| | | |
| expected trait T, found reference | expected trait `T`, found reference
| help: you can probably remove the explicit borrow: `x` | help: you can probably remove the explicit borrow: `x`
| |
= note: expected trait object `dyn T` = note: expected trait object `dyn T`
@ -44,7 +44,7 @@ error[E0308]: mismatched types
--> $DIR/destructure-trait-ref.rs:42:13 --> $DIR/destructure-trait-ref.rs:42:13
| |
LL | let box box x = box 1isize as Box<dyn T>; LL | let box box x = box 1isize as Box<dyn T>;
| ^^^^^ expected trait T, found struct `std::boxed::Box` | ^^^^^ expected trait `T`, found struct `std::boxed::Box`
| |
= note: expected trait object `dyn T` = note: expected trait object `dyn T`
found struct `std::boxed::Box<_>` found struct `std::boxed::Box<_>`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-42764.rs:11:43 --> $DIR/issue-42764.rs:11:43
| |
LL | this_function_expects_a_double_option(n); LL | this_function_expects_a_double_option(n);
| ^ expected enum `DoubleOption`, found usize | ^ expected enum `DoubleOption`, found `usize`
| |
= note: expected enum `DoubleOption<_>` = note: expected enum `DoubleOption<_>`
found type `usize` found type `usize`

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | let sixteen: f32 = 16; LL | let sixteen: f32 = 16;
| ^^ | ^^
| | | |
| expected f32, found integer | expected `f32`, found integer
| help: use a float literal: `16.0` | help: use a float literal: `16.0`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -13,7 +13,7 @@ error[E0308]: mismatched types
LL | let a_million_and_seventy: f64 = 1_000_070; LL | let a_million_and_seventy: f64 = 1_000_070;
| ^^^^^^^^^ | ^^^^^^^^^
| | | |
| expected f64, found integer | expected `f64`, found integer
| help: use a float literal: `1_000_070.0` | help: use a float literal: `1_000_070.0`
error[E0308]: mismatched types error[E0308]: mismatched types
@ -22,20 +22,20 @@ error[E0308]: mismatched types
LL | let negative_nine: f32 = -9; LL | let negative_nine: f32 = -9;
| ^^ | ^^
| | | |
| expected f32, found integer | expected `f32`, found integer
| help: use a float literal: `-9.0` | help: use a float literal: `-9.0`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/issue-53280-expected-float-found-integer-literal.rs:15:30 --> $DIR/issue-53280-expected-float-found-integer-literal.rs:15:30
| |
LL | let sixteen_again: f64 = 0x10; LL | let sixteen_again: f64 = 0x10;
| ^^^^ expected f64, found integer | ^^^^ expected `f64`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/issue-53280-expected-float-found-integer-literal.rs:17:30 --> $DIR/issue-53280-expected-float-found-integer-literal.rs:17:30
| |
LL | let and_once_more: f32 = 0o20; LL | let and_once_more: f32 = 0o20;
| ^^^^ expected f32, found integer | ^^^^ expected `f32`, found integer
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View File

@ -16,7 +16,7 @@ fn f_i8() {
Ok2, Ok2,
OhNo = 0_u8, OhNo = 0_u8,
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected i8, found u8 //~| expected `i8`, found `u8`
} }
let x = A::Ok; let x = A::Ok;
@ -29,7 +29,7 @@ fn f_u8() {
Ok2, Ok2,
OhNo = 0_i8, OhNo = 0_i8,
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected u8, found i8 //~| expected `u8`, found `i8`
} }
let x = A::Ok; let x = A::Ok;
@ -42,7 +42,7 @@ fn f_i16() {
Ok2, Ok2,
OhNo = 0_u16, OhNo = 0_u16,
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected i16, found u16 //~| expected `i16`, found `u16`
} }
let x = A::Ok; let x = A::Ok;
@ -55,7 +55,7 @@ fn f_u16() {
Ok2, Ok2,
OhNo = 0_i16, OhNo = 0_i16,
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected u16, found i16 //~| expected `u16`, found `i16`
} }
let x = A::Ok; let x = A::Ok;
@ -68,7 +68,7 @@ fn f_i32() {
Ok2, Ok2,
OhNo = 0_u32, OhNo = 0_u32,
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected i32, found u32 //~| expected `i32`, found `u32`
} }
let x = A::Ok; let x = A::Ok;
@ -81,7 +81,7 @@ fn f_u32() {
Ok2, Ok2,
OhNo = 0_i32, OhNo = 0_i32,
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected u32, found i32 //~| expected `u32`, found `i32`
} }
let x = A::Ok; let x = A::Ok;
@ -94,7 +94,7 @@ fn f_i64() {
Ok2, Ok2,
OhNo = 0_u64, OhNo = 0_u64,
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected i64, found u64 //~| expected `i64`, found `u64`
} }
let x = A::Ok; let x = A::Ok;
@ -107,7 +107,7 @@ fn f_u64() {
Ok2, Ok2,
OhNo = 0_i64, OhNo = 0_i64,
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected u64, found i64 //~| expected `u64`, found `i64`
} }
let x = A::Ok; let x = A::Ok;

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:17:16 --> $DIR/discrim-ill-typed.rs:17:16
| |
LL | OhNo = 0_u8, LL | OhNo = 0_u8,
| ^^^^ expected i8, found u8 | ^^^^ expected `i8`, found `u8`
| |
help: change the type of the numeric literal from `u8` to `i8` help: change the type of the numeric literal from `u8` to `i8`
| |
@ -13,7 +13,7 @@ error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:30:16 --> $DIR/discrim-ill-typed.rs:30:16
| |
LL | OhNo = 0_i8, LL | OhNo = 0_i8,
| ^^^^ expected u8, found i8 | ^^^^ expected `u8`, found `i8`
| |
help: change the type of the numeric literal from `i8` to `u8` help: change the type of the numeric literal from `i8` to `u8`
| |
@ -24,7 +24,7 @@ error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:43:16 --> $DIR/discrim-ill-typed.rs:43:16
| |
LL | OhNo = 0_u16, LL | OhNo = 0_u16,
| ^^^^^ expected i16, found u16 | ^^^^^ expected `i16`, found `u16`
| |
help: change the type of the numeric literal from `u16` to `i16` help: change the type of the numeric literal from `u16` to `i16`
| |
@ -35,7 +35,7 @@ error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:56:16 --> $DIR/discrim-ill-typed.rs:56:16
| |
LL | OhNo = 0_i16, LL | OhNo = 0_i16,
| ^^^^^ expected u16, found i16 | ^^^^^ expected `u16`, found `i16`
| |
help: change the type of the numeric literal from `i16` to `u16` help: change the type of the numeric literal from `i16` to `u16`
| |
@ -46,7 +46,7 @@ error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:69:16 --> $DIR/discrim-ill-typed.rs:69:16
| |
LL | OhNo = 0_u32, LL | OhNo = 0_u32,
| ^^^^^ expected i32, found u32 | ^^^^^ expected `i32`, found `u32`
| |
help: change the type of the numeric literal from `u32` to `i32` help: change the type of the numeric literal from `u32` to `i32`
| |
@ -57,7 +57,7 @@ error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:82:16 --> $DIR/discrim-ill-typed.rs:82:16
| |
LL | OhNo = 0_i32, LL | OhNo = 0_i32,
| ^^^^^ expected u32, found i32 | ^^^^^ expected `u32`, found `i32`
| |
help: change the type of the numeric literal from `i32` to `u32` help: change the type of the numeric literal from `i32` to `u32`
| |
@ -68,7 +68,7 @@ error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:95:16 --> $DIR/discrim-ill-typed.rs:95:16
| |
LL | OhNo = 0_u64, LL | OhNo = 0_u64,
| ^^^^^ expected i64, found u64 | ^^^^^ expected `i64`, found `u64`
| |
help: change the type of the numeric literal from `u64` to `i64` help: change the type of the numeric literal from `u64` to `i64`
| |
@ -79,7 +79,7 @@ error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:108:16 --> $DIR/discrim-ill-typed.rs:108:16
| |
LL | OhNo = 0_i64, LL | OhNo = 0_i64,
| ^^^^^ expected u64, found i64 | ^^^^^ expected `u64`, found `i64`
| |
help: change the type of the numeric literal from `i64` to `u64` help: change the type of the numeric literal from `i64` to `u64`
| |

View File

@ -5,7 +5,7 @@ LL | fn assert_sizeof() -> ! {
| - expected `!` because of return type | - expected `!` because of return type
LL | unsafe { LL | unsafe {
LL | ::std::mem::transmute::<f64, [u8; 8]>(panic!()) LL | ::std::mem::transmute::<f64, [u8; 8]>(panic!())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected !, found array `[u8; 8]` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found array `[u8; 8]`
| |
= note: expected type `!` = note: expected type `!`
found array `[u8; 8]` found array `[u8; 8]`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/diverging-tuple-parts-39485.rs:8:5 --> $DIR/diverging-tuple-parts-39485.rs:8:5
| |
LL | &panic!() LL | &panic!()
| ^^^^^^^^^ expected (), found reference | ^^^^^^^^^ expected `()`, found reference
| |
= note: expected unit type `()` = note: expected unit type `()`
found reference `&_` found reference `&_`
@ -21,7 +21,7 @@ error[E0308]: mismatched types
LL | fn f() -> isize { LL | fn f() -> isize {
| ----- expected `isize` because of return type | ----- expected `isize` because of return type
LL | (return 1, return 2) LL | (return 1, return 2)
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found tuple
| |
= note: expected type `isize` = note: expected type `isize`
found tuple `(!, !)` found tuple `(!, !)`

View File

@ -32,7 +32,7 @@ pub fn main() {
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36}); let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
f5.2 = Bar1 {f: 36}; f5.2 = Bar1 {f: 36};
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected trait ToBar, found struct `Bar1` //~| expected trait `ToBar`, found struct `Bar1`
//~| expected trait object `dyn ToBar` //~| expected trait object `dyn ToBar`
//~| found struct `Bar1` //~| found struct `Bar1`
//~| ERROR the size for values of type //~| ERROR the size for values of type

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/dst-bad-assign-3.rs:33:12 --> $DIR/dst-bad-assign-3.rs:33:12
| |
LL | f5.2 = Bar1 {f: 36}; LL | f5.2 = Bar1 {f: 36};
| ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1` | ^^^^^^^^^^^^ expected trait `ToBar`, found struct `Bar1`
| |
= note: expected trait object `dyn ToBar` = note: expected trait object `dyn ToBar`
found struct `Bar1` found struct `Bar1`

View File

@ -34,7 +34,7 @@ pub fn main() {
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36}); let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = Bar1 {f: 36}; f5.ptr = Bar1 {f: 36};
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected trait ToBar, found struct `Bar1` //~| expected trait `ToBar`, found struct `Bar1`
//~| expected trait object `dyn ToBar` //~| expected trait object `dyn ToBar`
//~| found struct `Bar1` //~| found struct `Bar1`
//~| ERROR the size for values of type //~| ERROR the size for values of type

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/dst-bad-assign.rs:35:14 --> $DIR/dst-bad-assign.rs:35:14
| |
LL | f5.ptr = Bar1 {f: 36}; LL | f5.ptr = Bar1 {f: 36};
| ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1` | ^^^^^^^^^^^^ expected trait `ToBar`, found struct `Bar1`
| |
= note: expected trait object `dyn ToBar` = note: expected trait object `dyn ToBar`
found struct `Bar1` found struct `Bar1`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/dst-bad-coercions.rs:14:17 --> $DIR/dst-bad-coercions.rs:14:17
| |
LL | let y: &S = x; LL | let y: &S = x;
| ^ expected &S, found *-ptr | ^ expected `&S`, found *-ptr
| |
= note: expected reference `&S` = note: expected reference `&S`
found raw pointer `*const S` found raw pointer `*const S`
@ -13,7 +13,7 @@ error[E0308]: mismatched types
LL | let y: &dyn T = x; LL | let y: &dyn T = x;
| ^ | ^
| | | |
| expected &dyn T, found *-ptr | expected `&dyn T`, found *-ptr
| help: consider borrowing here: `&x` | help: consider borrowing here: `&x`
| |
= note: expected reference `&dyn T` = note: expected reference `&dyn T`
@ -23,7 +23,7 @@ error[E0308]: mismatched types
--> $DIR/dst-bad-coercions.rs:19:17 --> $DIR/dst-bad-coercions.rs:19:17
| |
LL | let y: &S = x; LL | let y: &S = x;
| ^ expected &S, found *-ptr | ^ expected `&S`, found *-ptr
| |
= note: expected reference `&S` = note: expected reference `&S`
found raw pointer `*mut S` found raw pointer `*mut S`
@ -34,7 +34,7 @@ error[E0308]: mismatched types
LL | let y: &dyn T = x; LL | let y: &dyn T = x;
| ^ | ^
| | | |
| expected &dyn T, found *-ptr | expected `&dyn T`, found *-ptr
| help: consider borrowing here: `&x` | help: consider borrowing here: `&x`
| |
= note: expected reference `&dyn T` = note: expected reference `&dyn T`

View File

@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/E0070.rs:8:25 --> $DIR/E0070.rs:8:25
| |
LL | some_other_func() = 4; LL | some_other_func() = 4;
| ^ expected (), found integer | ^ expected `()`, found integer
error[E0070]: invalid left-hand side expression error[E0070]: invalid left-hand side expression
--> $DIR/E0070.rs:8:5 --> $DIR/E0070.rs:8:5

View File

@ -5,7 +5,7 @@ LL | fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
| --- ------------------ required by this bound in `foo` | --- ------------------ required by this bound in `foo`
... ...
LL | foo(3_i8); LL | foo(3_i8);
| ^^^ expected u32, found &str | ^^^ expected `u32`, found `&str`
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | match x { LL | match x {
| - this match expression has type `u8` | - this match expression has type `u8`
LL | 0u8..=3i8 => (), LL | 0u8..=3i8 => (),
| ^^^^^^^^^ expected u8, found i8 | ^^^^^^^^^ expected `u8`, found `i8`
error: aborting due to previous error error: aborting due to previous error

View File

@ -2,7 +2,7 @@ error[E0308]: intrinsic has wrong type
--> $DIR/E0308.rs:4:5 --> $DIR/E0308.rs:4:5
| |
LL | fn size_of<T>(); LL | fn size_of<T>();
| ^^^^^^^^^^^^^^^^ expected (), found usize | ^^^^^^^^^^^^^^^^ expected `()`, found `usize`
| |
= note: expected fn pointer `extern "rust-intrinsic" fn()` = note: expected fn pointer `extern "rust-intrinsic" fn()`
found fn pointer `extern "rust-intrinsic" fn() -> usize` found fn pointer `extern "rust-intrinsic" fn() -> usize`

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | wants_uniq(x); LL | wants_uniq(x);
| ^ | ^
| | | |
| expected struct `std::string::String`, found &str | expected struct `std::string::String`, found `&str`
| help: try using a conversion method: `x.to_string()` | help: try using a conversion method: `x.to_string()`
error: aborting due to previous error error: aborting due to previous error

View File

@ -4,14 +4,14 @@ error[E0308]: mismatched types
LL | let x: f32 = 1; LL | let x: f32 = 1;
| ^ | ^
| | | |
| expected f32, found integer | expected `f32`, found integer
| help: use a float literal: `1.0` | help: use a float literal: `1.0`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/float-literal-inference-restrictions.rs:3:18 --> $DIR/float-literal-inference-restrictions.rs:3:18
| |
LL | let y: f32 = 1f64; LL | let y: f32 = 1f64;
| ^^^^ expected f32, found f64 | ^^^^ expected `f32`, found `f64`
| |
help: change the type of the numeric literal from `f64` to `f32` help: change the type of the numeric literal from `f64` to `f32`
| |

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/fn-bad-block-type.rs:3:19 --> $DIR/fn-bad-block-type.rs:3:19
| |
LL | fn f() -> isize { true } LL | fn f() -> isize { true }
| ----- ^^^^ expected isize, found bool | ----- ^^^^ expected `isize`, found `bool`
| | | |
| expected `isize` because of return type | expected `isize` because of return type

View File

@ -18,7 +18,7 @@ fn main() {
eq(foo::<u8>, foo::<i8>); eq(foo::<u8>, foo::<i8>);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected u8, found i8 //~| expected `u8`, found `i8`
eq(bar::<String>, bar::<Vec<u8>>); eq(bar::<String>, bar::<Vec<u8>>);
//~^ ERROR mismatched types //~^ ERROR mismatched types
@ -29,5 +29,5 @@ fn main() {
// Make sure we distinguish between trait methods correctly. // Make sure we distinguish between trait methods correctly.
eq(<u8 as Foo>::foo, <u16 as Foo>::foo); eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected u8, found u16 //~| expected `u8`, found `u16`
} }

View File

@ -11,7 +11,7 @@ error[E0308]: mismatched types
--> $DIR/fn-item-type.rs:19:19 --> $DIR/fn-item-type.rs:19:19
| |
LL | eq(foo::<u8>, foo::<i8>); LL | eq(foo::<u8>, foo::<i8>);
| ^^^^^^^^^ expected u8, found i8 | ^^^^^^^^^ expected `u8`, found `i8`
| |
= note: expected fn item `fn(isize) -> isize {foo::<u8>}` = note: expected fn item `fn(isize) -> isize {foo::<u8>}`
found fn item `fn(isize) -> isize {foo::<i8>}` found fn item `fn(isize) -> isize {foo::<i8>}`
@ -29,7 +29,7 @@ error[E0308]: mismatched types
--> $DIR/fn-item-type.rs:30:26 --> $DIR/fn-item-type.rs:30:26
| |
LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo); LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
| ^^^^^^^^^^^^^^^^^ expected u8, found u16 | ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
| |
= note: expected fn item `fn() {<u8 as Foo>::foo}` = note: expected fn item `fn() {<u8 as Foo>::foo}`
found fn item `fn() {<u16 as Foo>::foo}` found fn item `fn() {<u16 as Foo>::foo}`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:6:17 --> $DIR/fn-trait-formatting.rs:6:17
| |
LL | let _: () = (box |_: isize| {}) as Box<dyn FnOnce(isize)>; LL | let _: () = (box |_: isize| {}) as Box<dyn FnOnce(isize)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `std::boxed::Box`
| |
= note: expected unit type `()` = note: expected unit type `()`
found struct `std::boxed::Box<dyn std::ops::FnOnce(isize)>` found struct `std::boxed::Box<dyn std::ops::FnOnce(isize)>`
@ -11,7 +11,7 @@ error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:10:17 --> $DIR/fn-trait-formatting.rs:10:17
| |
LL | let _: () = (box |_: isize, isize| {}) as Box<dyn Fn(isize, isize)>; LL | let _: () = (box |_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `std::boxed::Box`
| |
= note: expected unit type `()` = note: expected unit type `()`
found struct `std::boxed::Box<dyn std::ops::Fn(isize, isize)>` found struct `std::boxed::Box<dyn std::ops::Fn(isize, isize)>`
@ -20,7 +20,7 @@ error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:14:17 --> $DIR/fn-trait-formatting.rs:14:17
| |
LL | let _: () = (box || -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>; LL | let _: () = (box || -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `std::boxed::Box`
| |
= note: expected unit type `()` = note: expected unit type `()`
found struct `std::boxed::Box<dyn std::ops::FnMut() -> isize>` found struct `std::boxed::Box<dyn std::ops::FnMut() -> isize>`

View File

@ -7,7 +7,7 @@ fn bar(x: usize) -> Option<usize> {
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected enum `std::option::Option<usize>` //~| expected enum `std::option::Option<usize>`
//~| found type `usize` //~| found type `usize`
//~| expected enum `std::option::Option`, found usize //~| expected enum `std::option::Option`, found `usize`
} }
fn main() { fn main() {

View File

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn bar(x: usize) -> Option<usize> { LL | fn bar(x: usize) -> Option<usize> {
| ------------- expected `std::option::Option<usize>` because of return type | ------------- expected `std::option::Option<usize>` because of return type
LL | return x; LL | return x;
| ^ expected enum `std::option::Option`, found usize | ^ expected enum `std::option::Option`, found `usize`
| |
= note: expected enum `std::option::Option<usize>` = note: expected enum `std::option::Option<usize>`
found type `usize` found type `usize`

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/type-mismatch-signature-deduction.rs:8:20 --> $DIR/type-mismatch-signature-deduction.rs:8:20
| |
LL | return Ok(6); LL | return Ok(6);
| ^^^^^ expected i32, found enum `std::result::Result` | ^^^^^ expected `i32`, found enum `std::result::Result`
| |
= note: expected type `i32` = note: expected type `i32`
found enum `std::result::Result<{integer}, _>` found enum `std::result::Result<{integer}, _>`

View File

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

View File

@ -12,40 +12,40 @@ fn main() {
// Ensure that the printed type doesn't include the default type params... // Ensure that the printed type doesn't include the default type params...
let _: Foo<isize> = (); let _: Foo<isize> = ();
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected struct `Foo`, found () //~| expected struct `Foo`, found `()`
//~| expected struct `Foo<isize>` //~| expected struct `Foo<isize>`
//~| found unit type `()` //~| found unit type `()`
// ...even when they're present, but the same types as the defaults. // ...even when they're present, but the same types as the defaults.
let _: Foo<isize, B, C> = (); let _: Foo<isize, B, C> = ();
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected struct `Foo`, found () //~| expected struct `Foo`, found `()`
//~| expected struct `Foo<isize>` //~| expected struct `Foo<isize>`
//~| found unit type `()` //~| found unit type `()`
// Including cases where the default is using previous type params. // Including cases where the default is using previous type params.
let _: HashMap<String, isize> = (); let _: HashMap<String, isize> = ();
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected struct `HashMap`, found () //~| expected struct `HashMap`, found `()`
//~| expected struct `HashMap<std::string::String, isize>` //~| expected struct `HashMap<std::string::String, isize>`
//~| found unit type `()` //~| found unit type `()`
let _: HashMap<String, isize, Hash<String>> = (); let _: HashMap<String, isize, Hash<String>> = ();
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected struct `HashMap`, found () //~| expected struct `HashMap`, found `()`
//~| expected struct `HashMap<std::string::String, isize>` //~| expected struct `HashMap<std::string::String, isize>`
//~| found unit type `()` //~| found unit type `()`
// But not when there's a different type in between. // But not when there's a different type in between.
let _: Foo<A, isize, C> = (); let _: Foo<A, isize, C> = ();
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected struct `Foo`, found () //~| expected struct `Foo`, found `()`
//~| expected struct `Foo<A, isize>` //~| expected struct `Foo<A, isize>`
//~| found unit type `()` //~| found unit type `()`
// And don't print <> at all when there's just defaults. // And don't print <> at all when there's just defaults.
let _: Foo<A, B, C> = (); let _: Foo<A, B, C> = ();
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected struct `Foo`, found () //~| expected struct `Foo`, found `()`
//~| expected struct `Foo` //~| expected struct `Foo`
//~| found unit type `()` //~| found unit type `()`
} }

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/generic-type-params-name-repr.rs:13:25 --> $DIR/generic-type-params-name-repr.rs:13:25
| |
LL | let _: Foo<isize> = (); LL | let _: Foo<isize> = ();
| ^^ expected struct `Foo`, found () | ^^ expected struct `Foo`, found `()`
| |
= note: expected struct `Foo<isize>` = note: expected struct `Foo<isize>`
found unit type `()` found unit type `()`
@ -11,7 +11,7 @@ error[E0308]: mismatched types
--> $DIR/generic-type-params-name-repr.rs:20:31 --> $DIR/generic-type-params-name-repr.rs:20:31
| |
LL | let _: Foo<isize, B, C> = (); LL | let _: Foo<isize, B, C> = ();
| ^^ expected struct `Foo`, found () | ^^ expected struct `Foo`, found `()`
| |
= note: expected struct `Foo<isize>` = note: expected struct `Foo<isize>`
found unit type `()` found unit type `()`
@ -20,7 +20,7 @@ error[E0308]: mismatched types
--> $DIR/generic-type-params-name-repr.rs:27:37 --> $DIR/generic-type-params-name-repr.rs:27:37
| |
LL | let _: HashMap<String, isize> = (); LL | let _: HashMap<String, isize> = ();
| ^^ expected struct `HashMap`, found () | ^^ expected struct `HashMap`, found `()`
| |
= note: expected struct `HashMap<std::string::String, isize>` = note: expected struct `HashMap<std::string::String, isize>`
found unit type `()` found unit type `()`
@ -29,7 +29,7 @@ error[E0308]: mismatched types
--> $DIR/generic-type-params-name-repr.rs:32:51 --> $DIR/generic-type-params-name-repr.rs:32:51
| |
LL | let _: HashMap<String, isize, Hash<String>> = (); LL | let _: HashMap<String, isize, Hash<String>> = ();
| ^^ expected struct `HashMap`, found () | ^^ expected struct `HashMap`, found `()`
| |
= note: expected struct `HashMap<std::string::String, isize>` = note: expected struct `HashMap<std::string::String, isize>`
found unit type `()` found unit type `()`
@ -38,7 +38,7 @@ error[E0308]: mismatched types
--> $DIR/generic-type-params-name-repr.rs:39:31 --> $DIR/generic-type-params-name-repr.rs:39:31
| |
LL | let _: Foo<A, isize, C> = (); LL | let _: Foo<A, isize, C> = ();
| ^^ expected struct `Foo`, found () | ^^ expected struct `Foo`, found `()`
| |
= note: expected struct `Foo<A, isize>` = note: expected struct `Foo<A, isize>`
found unit type `()` found unit type `()`
@ -47,7 +47,7 @@ error[E0308]: mismatched types
--> $DIR/generic-type-params-name-repr.rs:46:27 --> $DIR/generic-type-params-name-repr.rs:46:27
| |
LL | let _: Foo<A, B, C> = (); LL | let _: Foo<A, B, C> = ();
| ^^ expected struct `Foo`, found () | ^^ expected struct `Foo`, found `()`
| |
= note: expected struct `Foo` = note: expected struct `Foo`
found unit type `()` found unit type `()`

View File

@ -7,7 +7,7 @@ LL | | 1i32
| | ---- expected because of this | | ---- expected because of this
LL | | } else { LL | | } else {
LL | | 2u32 LL | | 2u32
| | ^^^^ expected i32, found u32 | | ^^^^ expected `i32`, found `u32`
LL | | }; LL | | };
| |_____- if and else have incompatible types | |_____- if and else have incompatible types
@ -15,7 +15,7 @@ error[E0308]: if and else have incompatible types
--> $DIR/if-else-type-mismatch.rs:8:38 --> $DIR/if-else-type-mismatch.rs:8:38
| |
LL | let _ = if true { 42i32 } else { 42u32 }; LL | let _ = if true { 42i32 } else { 42u32 };
| ----- ^^^^^ expected i32, found u32 | ----- ^^^^^ expected `i32`, found `u32`
| | | |
| expected because of this | expected because of this
@ -31,7 +31,7 @@ LL | | 3u32;
| | expected because of this | | expected because of this
LL | | } else { LL | | } else {
LL | | 4u32 LL | | 4u32
| | ^^^^ expected (), found u32 | | ^^^^ expected `()`, found `u32`
LL | | }; LL | | };
| |_____- if and else have incompatible types | |_____- if and else have incompatible types
@ -47,7 +47,7 @@ LL | | 6u32;
| | ^^^^- | | ^^^^-
| | | | | | | |
| | | help: consider removing this semicolon | | | help: consider removing this semicolon
| | expected u32, found () | | expected `u32`, found `()`
LL | | }; LL | | };
| |_____- if and else have incompatible types | |_____- if and else have incompatible types
@ -60,7 +60,7 @@ LL | | 7i32;
| | ----- expected because of this | | ----- expected because of this
LL | | } else { LL | | } else {
LL | | 8u32 LL | | 8u32
| | ^^^^ expected (), found u32 | | ^^^^ expected `()`, found `u32`
LL | | }; LL | | };
| |_____- if and else have incompatible types | |_____- if and else have incompatible types
@ -73,7 +73,7 @@ LL | | 9i32
| | ---- expected because of this | | ---- expected because of this
LL | | } else { LL | | } else {
LL | | 10u32; LL | | 10u32;
| | ^^^^^^ expected i32, found () | | ^^^^^^ expected `i32`, found `()`
LL | | }; LL | | };
| |_____- if and else have incompatible types | |_____- if and else have incompatible types
@ -86,7 +86,7 @@ LL | |
LL | | } else { LL | | } else {
| |_____- expected because of this | |_____- expected because of this
LL | 11u32 LL | 11u32
| ^^^^^ expected (), found u32 | ^^^^^ expected `()`, found `u32`
error[E0308]: if and else have incompatible types error[E0308]: if and else have incompatible types
--> $DIR/if-else-type-mismatch.rs:42:12 --> $DIR/if-else-type-mismatch.rs:42:12
@ -99,7 +99,7 @@ LL | } else {
| ____________^ | ____________^
LL | | LL | |
LL | | }; LL | | };
| |_____^ expected i32, found () | |_____^ expected `i32`, found `()`
error: aborting due to 8 previous errors error: aborting due to 8 previous errors

View File

@ -1,5 +1,5 @@
fn main() { fn main() {
let x = if true { 10i32 } else { 10u32 }; let x = if true { 10i32 } else { 10u32 };
//~^ ERROR if and else have incompatible types //~^ ERROR if and else have incompatible types
//~| expected i32, found u32 //~| expected `i32`, found `u32`
} }

View File

@ -2,7 +2,7 @@ error[E0308]: if and else have incompatible types
--> $DIR/if-branch-types.rs:2:38 --> $DIR/if-branch-types.rs:2:38
| |
LL | let x = if true { 10i32 } else { 10u32 }; LL | let x = if true { 10i32 } else { 10u32 };
| ----- ^^^^^ expected i32, found u32 | ----- ^^^^^ expected `i32`, found `u32`
| | | |
| expected because of this | expected because of this

View File

@ -7,5 +7,5 @@ fn main() {
1 1
}; };
//~^^ ERROR: if and else have incompatible types //~^^ ERROR: if and else have incompatible types
//~| NOTE expected (), found integer //~| NOTE expected `()`, found integer
} }

Some files were not shown because too many files have changed in this diff Show More