mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Surround types with backticks in type errors
This commit is contained in:
parent
94c6425464
commit
6f8f70624b
@ -222,8 +222,8 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
pub fn sort_string(&self, tcx: TyCtxt<'_>) -> Cow<'static, str> {
|
||||
match self.kind {
|
||||
ty::Bool | ty::Char | ty::Int(_) |
|
||||
ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => format!("{}", self).into(),
|
||||
ty::Tuple(ref tys) if tys.is_empty() => 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::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(),
|
||||
@ -244,7 +244,7 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
if tymut_string != "_" && (
|
||||
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
|
||||
match mutbl {
|
||||
hir::Mutability::Mutable => "mutable reference",
|
||||
@ -256,7 +256,7 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
ty::FnPtr(_) => "fn pointer".into(),
|
||||
ty::Dynamic(ref inner, ..) => {
|
||||
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 {
|
||||
"trait".into()
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
||||
// LL | impl Bar for Foo {
|
||||
// | ---------------- in this `impl` item
|
||||
// LL | type Ok = ();
|
||||
// | ^^^^^^^^^^^^^ expected u32, found ()
|
||||
// | ^^^^^^^^^^^^^ expected `u32`, found `()`
|
||||
// |
|
||||
// = note: expected type `u32`
|
||||
// found type `()`
|
||||
@ -228,7 +228,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
||||
// LL | impl Bar for Foo {
|
||||
// | ---------------- in this `impl` item
|
||||
// LL | type Ok = ();
|
||||
// | ^^^^^^^^^^^^^ expected u32, found ()
|
||||
// | ^^^^^^^^^^^^^ expected `u32`, found `()`
|
||||
// ...
|
||||
// LL | impl Bar2 for Foo2 {
|
||||
// | ---------------- in this `impl` item
|
||||
|
@ -285,7 +285,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// || ----- expected because of this
|
||||
// LL || } else {
|
||||
// LL || 10u32
|
||||
// || ^^^^^ expected i32, found u32
|
||||
// || ^^^^^ expected `i32`, found `u32`
|
||||
// LL || };
|
||||
// ||_____- 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
|
||||
// ```
|
||||
// LL | let x = if true { 10i32 } else { 10u32 };
|
||||
// | ----- ^^^^^ expected i32, found u32
|
||||
// | ----- ^^^^^ expected `i32`, found `u32`
|
||||
// | |
|
||||
// | expected because of this
|
||||
// ```
|
||||
@ -323,7 +323,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// | || ^
|
||||
// | ||_____|
|
||||
// | |______if and else have incompatible types
|
||||
// | expected integer, found ()
|
||||
// | expected integer, found `()`
|
||||
// ```
|
||||
// by not pointing at the entire expression:
|
||||
// ```
|
||||
@ -335,7 +335,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// | ____________^
|
||||
// 5 | |
|
||||
// 6 | | };
|
||||
// | |_____^ expected integer, found ()
|
||||
// | |_____^ expected integer, found `()`
|
||||
// ```
|
||||
if outer_sp.is_some() {
|
||||
outer_sp = Some(self.tcx.sess.source_map().def_span(span));
|
||||
|
@ -47,7 +47,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
/// 4 | let temp: usize = match a + b {
|
||||
/// | ----- this expression has type `usize`
|
||||
/// 5 | Ok(num) => num,
|
||||
/// | ^^^^^^^ expected usize, found enum `std::result::Result`
|
||||
/// | ^^^^^^^ expected `usize`, found enum `std::result::Result`
|
||||
/// |
|
||||
/// = note: expected type `usize`
|
||||
/// found type `std::result::Result<_, _>`
|
||||
|
@ -9,7 +9,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/failed-doctest-missing-codes.rs:9:13
|
||||
|
|
||||
LL | let x: () = 5i32;
|
||||
| ^^^^ expected (), found i32
|
||||
| ^^^^ expected `()`, found `i32`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/arg-type-mismatch.rs:5:30
|
||||
|
|
||||
LL | fn main() { let i: (); i = f(()); }
|
||||
| ^^ expected isize, found ()
|
||||
| ^^ expected `isize`, found `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -14,7 +14,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/array-break-length.rs:3:9
|
||||
|
|
||||
LL | |_: [_; break]| {}
|
||||
| ^^^^^^^^^^^^^^^^^^ expected (), found closure
|
||||
| ^^^^^^^^^^^^^^^^^^ expected `()`, found closure
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
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
|
||||
|
|
||||
LL | |_: [_; continue]| {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected (), found closure
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found closure
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found closure `[closure@$DIR/array-break-length.rs:8:9: 8:30]`
|
||||
|
@ -1,12 +1,12 @@
|
||||
fn main() {
|
||||
let _x: i32 = [1, 2, 3];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected i32, found array
|
||||
//~| expected `i32`, found array
|
||||
|
||||
let x: &[i32] = &[1, 2, 3];
|
||||
let _y: &i32 = x;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected reference `&i32`
|
||||
//~| found reference `&[i32]`
|
||||
//~| expected i32, found slice
|
||||
//~| expected `i32`, found slice
|
||||
}
|
||||
|
@ -2,13 +2,13 @@ error[E0308]: mismatched types
|
||||
--> $DIR/array-not-vector.rs:2:19
|
||||
|
|
||||
LL | let _x: i32 = [1, 2, 3];
|
||||
| ^^^^^^^^^ expected i32, found array `[{integer}; 3]`
|
||||
| ^^^^^^^^^ expected `i32`, found array `[{integer}; 3]`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/array-not-vector.rs:7:20
|
||||
|
|
||||
LL | let _y: &i32 = x;
|
||||
| ^ expected i32, found slice `[i32]`
|
||||
| ^ expected `i32`, found slice `[i32]`
|
||||
|
|
||||
= note: expected reference `&i32`
|
||||
found reference `&[i32]`
|
||||
|
@ -5,7 +5,7 @@ LL | const FROM: Self::Out;
|
||||
| --------- type in trait
|
||||
...
|
||||
LL | const FROM: &'static str = "foo";
|
||||
| ^^^^^^^^^^^^ expected associated type, found &str
|
||||
| ^^^^^^^^^^^^ expected associated type, found `&str`
|
||||
|
|
||||
= note: expected associated type `<T as Foo>::Out`
|
||||
found reference `&'static str`
|
||||
|
@ -5,7 +5,7 @@ LL | const BAR: u32;
|
||||
| --- type in trait
|
||||
...
|
||||
LL | const BAR: i32 = -1;
|
||||
| ^^^ expected u32, found i32
|
||||
| ^^^ expected `u32`, found `i32`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -37,8 +37,8 @@ pub fn main() {
|
||||
let a = 42;
|
||||
foo1(a);
|
||||
//~^ ERROR type mismatch resolving
|
||||
//~| expected struct `Bar`, found usize
|
||||
//~| expected struct `Bar`, found `usize`
|
||||
baz(&a);
|
||||
//~^ ERROR type mismatch resolving
|
||||
//~| expected struct `Bar`, found usize
|
||||
//~| expected struct `Bar`, found `usize`
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ LL | fn foo1<I: Foo<A=Bar>>(x: I) {
|
||||
| ---- ----- required by this bound in `foo1`
|
||||
...
|
||||
LL | foo1(a);
|
||||
| ^^^^ expected struct `Bar`, found usize
|
||||
| ^^^^ expected struct `Bar`, found `usize`
|
||||
|
||||
error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
|
||||
--> $DIR/associated-types-eq-3.rs:41:9
|
||||
|
|
||||
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>`
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | where T : for<'x> TheTrait<&'x isize, A = &'x isize>
|
||||
| ------------- required by this bound in `foo`
|
||||
...
|
||||
LL | foo::<UintStruct>();
|
||||
| ^^^^^^^^^^^^^^^^^ expected isize, found usize
|
||||
| ^^^^^^^^^^^^^^^^^ expected `isize`, found `usize`
|
||||
|
|
||||
= note: expected reference `&isize`
|
||||
found reference `&usize`
|
||||
@ -21,7 +21,7 @@ LL | where T : for<'x> TheTrait<&'x isize, A = &'x usize>
|
||||
| ------------- required by this bound in `bar`
|
||||
...
|
||||
LL | bar::<IntStruct>();
|
||||
| ^^^^^^^^^^^^^^^^ expected usize, found isize
|
||||
| ^^^^^^^^^^^^^^^^ expected `usize`, found `isize`
|
||||
|
|
||||
= note: expected reference `&usize`
|
||||
found reference `&isize`
|
||||
|
@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<T as Foo>::Y == i32`
|
||||
--> $DIR/associated-types-multiple-types-one-trait.rs:13:5
|
||||
|
|
||||
LL | want_y(t);
|
||||
| ^^^^^^ expected i32, found associated type
|
||||
| ^^^^^^ expected `i32`, found associated type
|
||||
...
|
||||
LL | fn want_y<T:Foo<Y=i32>>(t: &T) { }
|
||||
| ------ ----- 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
|
||||
|
|
||||
LL | want_x(t);
|
||||
| ^^^^^^ expected u32, found associated type
|
||||
| ^^^^^^ expected `u32`, found associated type
|
||||
...
|
||||
LL | fn want_x<T:Foo<X=u32>>(t: &T) { }
|
||||
| ------ ----- required by this bound in `want_x`
|
||||
|
@ -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
|
||||
|
|
||||
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>`
|
||||
|
||||
|
@ -18,7 +18,7 @@ pub fn f2<T: Foo>(a: T) -> T::A {
|
||||
pub fn f1_int_int() {
|
||||
f1(2i32, 4i32);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected u32, found i32
|
||||
//~| expected `u32`, found `i32`
|
||||
}
|
||||
|
||||
pub fn f1_int_uint() {
|
||||
@ -40,7 +40,7 @@ pub fn f1_uint_int() {
|
||||
pub fn f2_int() {
|
||||
let _: i32 = f2(2i32);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected i32, found u32
|
||||
//~| expected `i32`, found `u32`
|
||||
}
|
||||
|
||||
pub fn main() { }
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/associated-types-path-2.rs:19:14
|
||||
|
|
||||
LL | f1(2i32, 4i32);
|
||||
| ^^^^ expected u32, found i32
|
||||
| ^^^^ expected `u32`, found `i32`
|
||||
|
|
||||
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
|
||||
|
|
||||
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
|
||||
|
|
||||
|
@ -5,7 +5,7 @@ LL | fn visit() {}
|
||||
| ---------- required by `Visit::visit`
|
||||
...
|
||||
LL | <() as Visit>::visit();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected (), found &()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&()`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `Visit` for `()`
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | type Ok;
|
||||
LL | impl Bar for Foo {
|
||||
| ---------------- in this `impl` item
|
||||
LL | type Ok = ();
|
||||
| ^^^^^^^^^^^^^ expected u32, found ()
|
||||
| ^^^^^^^^^^^^^ expected `u32`, found `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -22,7 +22,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/async-block-control-flow-static-semantics.rs:13:43
|
||||
|
|
||||
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
|
||||
|
||||
@ -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
|
||||
|
|
||||
LL | let _: &dyn Future<Output = ()> = █
|
||||
| ^^^^^^ expected (), found u8
|
||||
| ^^^^^^ expected `()`, found `u8`
|
||||
|
|
||||
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
|
||||
|
||||
@ -45,13 +45,13 @@ LL | | return 0u8;
|
||||
... |
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_^ expected u8, found ()
|
||||
| |_^ expected `u8`, found `()`
|
||||
|
||||
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
|
||||
--> $DIR/async-block-control-flow-static-semantics.rs:27:39
|
||||
|
|
||||
LL | let _: &dyn Future<Output = ()> = █
|
||||
| ^^^^^^ expected (), found u8
|
||||
| ^^^^^^ expected `()`, found `u8`
|
||||
|
|
||||
= 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
|
||||
|
|
||||
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
|
||||
|
|
||||
@ -70,7 +70,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/async-block-control-flow-static-semantics.rs:57:50
|
||||
|
|
||||
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
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dont-suggest-missing-await.rs:14:18
|
||||
|
|
||||
LL | take_u32(x)
|
||||
| ^ expected u32, found opaque type
|
||||
| ^ expected `u32`, found opaque type
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found opaque type `impl std::future::Future`
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | take_u32(x)
|
||||
| ^
|
||||
| |
|
||||
| expected u32, found opaque type
|
||||
| expected `u32`, found opaque type
|
||||
| help: consider using `.await` here: `x.await`
|
||||
|
|
||||
= note: expected type `u32`
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | take_u32(x)
|
||||
| ^
|
||||
| |
|
||||
| expected u32, found opaque type
|
||||
| expected `u32`, found opaque type
|
||||
| help: consider using `.await` here: `x.await`
|
||||
|
|
||||
= note: expected type `u32`
|
||||
|
@ -2,13 +2,13 @@ error[E0308]: mismatched types
|
||||
--> $DIR/binop-logic-float.rs:1:21
|
||||
|
|
||||
LL | fn main() { let x = 1.0_f32 || 2.0_f32; }
|
||||
| ^^^^^^^ expected bool, found f32
|
||||
| ^^^^^^^ expected `bool`, found `f32`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/binop-logic-float.rs:1:32
|
||||
|
|
||||
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
|
||||
|
||||
|
@ -2,13 +2,13 @@ error[E0308]: mismatched types
|
||||
--> $DIR/binop-logic-int.rs:1:21
|
||||
|
|
||||
LL | fn main() { let x = 1 && 2; }
|
||||
| ^ expected bool, found integer
|
||||
| ^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/binop-logic-int.rs:1:26
|
||||
|
|
||||
LL | fn main() { let x = 1 && 2; }
|
||||
| ^ expected bool, found integer
|
||||
| ^ expected `bool`, found integer
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | |
|
||||
LL | | foo();
|
||||
| | - help: consider removing this semicolon
|
||||
LL | | };
|
||||
| |_____^ expected i32, found ()
|
||||
| |_____^ expected `i32`, found `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/block-must-not-have-result-do.rs:3:9
|
||||
|
|
||||
LL | true
|
||||
| ^^^^ expected (), found bool
|
||||
| ^^^^ expected `()`, found `bool`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn drop(&mut self) {
|
||||
| - expected `()` because of default return type
|
||||
LL | true
|
||||
| ^^^^ expected (), found bool
|
||||
| ^^^^ expected `()`, found `bool`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
fn main() {
|
||||
while true { //~ WARN denote infinite loops with
|
||||
true //~ ERROR mismatched types
|
||||
//~| expected (), found bool
|
||||
//~| expected `()`, found `bool`
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/block-must-not-have-result-while.rs:3:9
|
||||
|
|
||||
LL | true
|
||||
| ^^^^ expected (), found bool
|
||||
| ^^^^ expected `()`, found `bool`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/consider-removing-last-semi.rs:1:11
|
||||
|
|
||||
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
|
||||
LL | 0u8;
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/consider-removing-last-semi.rs:6:11
|
||||
|
|
||||
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
|
||||
LL | "this won't work".to_string();
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-11714.rs:1:14
|
||||
|
|
||||
LL | fn blah() -> i32 {
|
||||
| ---- ^^^ expected i32, found ()
|
||||
| ---- ^^^ expected `i32`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
...
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-13428.rs:3:13
|
||||
|
|
||||
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
|
||||
...
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-13428.rs:11:13
|
||||
|
|
||||
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
|
||||
LL | "foobar".to_string()
|
||||
|
@ -6,7 +6,7 @@ mod a {
|
||||
pub fn get_enum_struct_variant() -> () {
|
||||
Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected (), found enum `a::Enum`
|
||||
//~| expected `()`, found enum `a::Enum`
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ mod b {
|
||||
match enum_struct_variant {
|
||||
a::Enum::EnumStructVariant { x, y, z } => {
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected (), found enum `a::Enum`
|
||||
//~| expected `()`, found enum `a::Enum`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | pub fn get_enum_struct_variant() -> () {
|
||||
| -- expected `()` because of return type
|
||||
LL | Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `a::Enum`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-13624.rs:20:9
|
||||
@ -12,7 +12,7 @@ error[E0308]: mismatched types
|
||||
LL | match enum_struct_variant {
|
||||
| ------------------- this match expression has type `()`
|
||||
LL | a::Enum::EnumStructVariant { x, y, z } => {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `a::Enum`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn foo(x: i32) {
|
||||
| - possibly return type missing here?
|
||||
LL | |y| x + y
|
||||
| ^^^^^^^^^ expected (), found closure
|
||||
| ^^^^^^^^^ expected `()`, found closure
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]`
|
||||
|
@ -15,7 +15,7 @@ LL | fn main() {
|
||||
| - expected `()` because of default return type
|
||||
LL | let b = Bob + 3.5;
|
||||
LL | b + 3
|
||||
| ^^^^^ expected (), found struct `Bob`
|
||||
| ^^^^^ expected `()`, found struct `Bob`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -3,5 +3,5 @@ fn main() {
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected unit type `()`
|
||||
//~| found reference `&_`
|
||||
//~| expected (), found reference
|
||||
//~| expected `()`, found reference
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ LL | fn main() {
|
||||
LL | &panic!()
|
||||
| ^^^^^^^^^
|
||||
| |
|
||||
| expected (), found reference
|
||||
| expected `()`, found reference
|
||||
| help: consider removing the borrow: `panic!()`
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/unexpected-return-on-unit.rs:9:5
|
||||
|
|
||||
LL | foo()
|
||||
| ^^^^^ expected (), found usize
|
||||
| ^^^^^ expected `()`, found `usize`
|
||||
|
|
||||
help: try adding a semicolon
|
||||
|
|
||||
|
@ -5,7 +5,7 @@ LL | let _: ! = {
|
||||
| ____________________^
|
||||
LL | | 'a: while break 'a {};
|
||||
LL | | };
|
||||
| |_________^ expected !, found ()
|
||||
| |_________^ expected `!`, found `()`
|
||||
|
|
||||
= note: expected type `!`
|
||||
found unit type `()`
|
||||
@ -16,7 +16,7 @@ error[E0308]: mismatched types
|
||||
LL | / while false {
|
||||
LL | | break
|
||||
LL | | }
|
||||
| |_____________^ expected !, found ()
|
||||
| |_____________^ expected `!`, found `()`
|
||||
|
|
||||
= note: expected type `!`
|
||||
found unit type `()`
|
||||
@ -27,7 +27,7 @@ error[E0308]: mismatched types
|
||||
LL | / while false {
|
||||
LL | | return
|
||||
LL | | }
|
||||
| |_____________^ expected !, found ()
|
||||
| |_____________^ expected `!`, found `()`
|
||||
|
|
||||
= note: expected type `!`
|
||||
found unit type `()`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/type_inference.rs:21:14
|
||||
|
|
||||
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
|
||||
--> $DIR/type_inference.rs:25:5
|
||||
|
@ -20,7 +20,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/closure-array-break-length.rs:4:11
|
||||
|
|
||||
LL | while |_: [_; continue]| {} {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected bool, found closure
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found closure
|
||||
|
|
||||
= note: expected type `bool`
|
||||
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
|
||||
|
|
||||
LL | while |_: [_; break]| {} {}
|
||||
| ^^^^^^^^^^^^^^^^^^ expected bool, found closure
|
||||
| ^^^^^^^^^^^^^^^^^^ expected `bool`, found closure
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found closure `[closure@$DIR/closure-array-break-length.rs:7:11: 7:29]`
|
||||
|
@ -10,7 +10,7 @@ error[E0308]: mismatched types
|
||||
LL | fn foo() {
|
||||
| - help: try adding a return type: `-> &'static str`
|
||||
LL | "bar boo"
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected (), found &str
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&str`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -29,7 +29,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:13:13
|
||||
|
|
||||
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>`
|
||||
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
|
||||
|
|
||||
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>`
|
||||
found struct `std::boxed::Box<bool>`
|
||||
@ -47,7 +47,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:15:13
|
||||
|
|
||||
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>`
|
||||
found struct `std::boxed::Box<char>`
|
||||
@ -83,7 +83,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:21:13
|
||||
|
|
||||
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`
|
||||
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
|
||||
|
|
||||
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`
|
||||
found reference `&bool`
|
||||
@ -101,7 +101,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:23:13
|
||||
|
|
||||
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`
|
||||
found reference `&char`
|
||||
@ -119,7 +119,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:26:13
|
||||
|
|
||||
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) -> _>`
|
||||
found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:6:17
|
||||
|
|
||||
LL | foo(return, 22, 44);
|
||||
| ^^ expected !, found integer
|
||||
| ^^ expected `!`, found integer
|
||||
|
|
||||
= note: expected type `!`
|
||||
found type `{integer}`
|
||||
@ -11,7 +11,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:18:13
|
||||
|
|
||||
LL | foo(22, 44, return);
|
||||
| ^^ expected !, found integer
|
||||
| ^^ expected `!`, found integer
|
||||
|
|
||||
= note: expected type `!`
|
||||
found type `{integer}`
|
||||
@ -20,7 +20,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:26:12
|
||||
|
|
||||
LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverge.
|
||||
| ^ expected !, found integer
|
||||
| ^ expected `!`, found integer
|
||||
|
|
||||
= note: expected type `!`
|
||||
found type `{integer}`
|
||||
@ -29,7 +29,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:36:12
|
||||
|
|
||||
LL | foo(a, b, c);
|
||||
| ^ expected !, found integer
|
||||
| ^ expected `!`, found integer
|
||||
|
|
||||
= note: expected type `!`
|
||||
found type `{integer}`
|
||||
@ -38,7 +38,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:45:12
|
||||
|
|
||||
LL | foo(a, b, c);
|
||||
| ^ expected !, found integer
|
||||
| ^ expected `!`, found integer
|
||||
|
|
||||
= note: expected type `!`
|
||||
found type `{integer}`
|
||||
@ -47,7 +47,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:50:21
|
||||
|
|
||||
LL | let x: [!; 2] = [return, 22];
|
||||
| ^^^^^^^^^^^^ expected !, found integer
|
||||
| ^^^^^^^^^^^^ expected `!`, found integer
|
||||
|
|
||||
= note: expected array `[!; 2]`
|
||||
found array `[{integer}; 2]`
|
||||
@ -56,7 +56,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:55:22
|
||||
|
|
||||
LL | let x: [!; 2] = [22, return];
|
||||
| ^^ expected !, found integer
|
||||
| ^^ expected `!`, found integer
|
||||
|
|
||||
= note: expected type `!`
|
||||
found type `{integer}`
|
||||
@ -65,7 +65,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:60:37
|
||||
|
|
||||
LL | let x: (usize, !, usize) = (22, 44, 66);
|
||||
| ^^ expected !, found integer
|
||||
| ^^ expected `!`, found integer
|
||||
|
|
||||
= note: expected type `!`
|
||||
found type `{integer}`
|
||||
@ -74,7 +74,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:65:41
|
||||
|
|
||||
LL | let x: (usize, !, usize) = (return, 44, 66);
|
||||
| ^^ expected !, found integer
|
||||
| ^^ expected `!`, found integer
|
||||
|
|
||||
= note: expected type `!`
|
||||
found type `{integer}`
|
||||
@ -83,7 +83,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:76:37
|
||||
|
|
||||
LL | let x: (usize, !, usize) = (22, 44, return);
|
||||
| ^^ expected !, found integer
|
||||
| ^^ expected `!`, found integer
|
||||
|
|
||||
= note: expected type `!`
|
||||
found type `{integer}`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coercion-missing-tail-expected-type.rs:3:24
|
||||
|
|
||||
LL | fn plus_one(x: i32) -> i32 {
|
||||
| -------- ^^^ expected i32, found ()
|
||||
| -------- ^^^ expected `i32`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
LL | x + 1;
|
||||
@ -12,7 +12,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coercion-missing-tail-expected-type.rs:7:13
|
||||
|
|
||||
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
|
||||
LL | Ok(1);
|
||||
|
@ -3,5 +3,5 @@
|
||||
fn main() {
|
||||
let _: &[i32] = [0];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected &[i32], found array `[{integer}; 1]`
|
||||
//~| expected `&[i32]`, found array `[{integer}; 1]`
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | let _: &[i32] = [0];
|
||||
| ^^^
|
||||
| |
|
||||
| expected &[i32], found array `[{integer}; 1]`
|
||||
| expected `&[i32]`, found array `[{integer}; 1]`
|
||||
| help: consider borrowing here: `&[0]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -19,7 +19,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/fn-const-param-infer.rs:20:24
|
||||
|
|
||||
LL | let _ = Checked::<{generic_arg::<u32>}>;
|
||||
| ^^^^^^^^^^^^^^^^^^ expected usize, found u32
|
||||
| ^^^^^^^^^^^^^^^^^^ expected `usize`, found `u32`
|
||||
|
|
||||
= note: expected fn pointer `fn(usize) -> bool`
|
||||
found fn item `fn(u32) -> bool {generic_arg::<u32>}`
|
||||
|
@ -19,7 +19,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/types-mismatch-const-args.rs:15:41
|
||||
|
|
||||
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, _, _>`
|
||||
found struct `A<'b, u32, _, _>`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-cast-wrong-type.rs:2:23
|
||||
|
|
||||
LL | static b: *const i8 = &a as *const i8;
|
||||
| ^^^^^^^^^^^^^^^ expected u8, found i8
|
||||
| ^^^^^^^^^^^^^^^ expected `u8`, found `i8`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-eval-overflow-3b.rs:18:22
|
||||
|
|
||||
LL | = [0; (i8::MAX + 1u8) as usize];
|
||||
| ^^^ expected i8, found u8
|
||||
| ^^^ expected `i8`, found `u8`
|
||||
|
||||
error[E0277]: cannot add `u8` to `i8`
|
||||
--> $DIR/const-eval-overflow-3b.rs:18:20
|
||||
|
@ -11,7 +11,7 @@ use std::{u8, u16, u32, u64, usize};
|
||||
const A_I8_T
|
||||
: [u32; (i8::MAX as i8 + 1u8) as usize]
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected i8, found u8
|
||||
//~| expected `i8`, found `u8`
|
||||
//~| ERROR cannot add `u8` to `i8`
|
||||
= [0; (i8::MAX as usize) + 1];
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-eval-overflow-4b.rs:12:30
|
||||
|
|
||||
LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
|
||||
| ^^^ expected i8, found u8
|
||||
| ^^^ expected `i8`, found `u8`
|
||||
|
||||
error[E0277]: cannot add `u8` to `i8`
|
||||
--> $DIR/const-eval-overflow-4b.rs:12:28
|
||||
|
@ -8,7 +8,7 @@ const CONSTANT: S = S(0);
|
||||
enum E {
|
||||
V = CONSTANT,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected isize, found struct `S`
|
||||
//~| expected `isize`, found struct `S`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-eval-span.rs:9:9
|
||||
|
|
||||
LL | V = CONSTANT,
|
||||
| ^^^^^^^^ expected isize, found struct `S`
|
||||
| ^^^^^^^^ expected `isize`, found struct `S`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,76 +1,76 @@
|
||||
const X: usize = 42 && 39;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected bool, found integer
|
||||
//~| expected `bool`, found integer
|
||||
//~| ERROR mismatched types
|
||||
//~| expected bool, found integer
|
||||
//~| expected `bool`, found integer
|
||||
//~| ERROR mismatched types
|
||||
//~| expected usize, found bool
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARR: [i32; X] = [99; 34];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const X1: usize = 42 || 39;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected bool, found integer
|
||||
//~| expected `bool`, found integer
|
||||
//~| ERROR mismatched types
|
||||
//~| expected bool, found integer
|
||||
//~| expected `bool`, found integer
|
||||
//~| ERROR mismatched types
|
||||
//~| expected usize, found bool
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARR1: [i32; X1] = [99; 47];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const X2: usize = -42 || -39;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected bool, found integer
|
||||
//~| expected `bool`, found integer
|
||||
//~| ERROR mismatched types
|
||||
//~| expected bool, found integer
|
||||
//~| expected `bool`, found integer
|
||||
//~| ERROR mismatched types
|
||||
//~| expected usize, found bool
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARR2: [i32; X2] = [99; 18446744073709551607];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const X3: usize = -42 && -39;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected bool, found integer
|
||||
//~| expected `bool`, found integer
|
||||
//~| ERROR mismatched types
|
||||
//~| expected bool, found integer
|
||||
//~| expected `bool`, found integer
|
||||
//~| ERROR mismatched types
|
||||
//~| expected usize, found bool
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARR3: [i32; X3] = [99; 6];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y: usize = 42.0 == 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected usize, found bool
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR: [i32; Y] = [99; 1];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y1: usize = 42.0 >= 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected usize, found bool
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR1: [i32; Y1] = [99; 1];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y2: usize = 42.0 <= 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected usize, found bool
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR2: [i32; Y2] = [99; 1];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y3: usize = 42.0 > 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected usize, found bool
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR3: [i32; Y3] = [99; 0];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y4: usize = 42.0 < 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected usize, found bool
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR4: [i32; Y4] = [99; 0];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y5: usize = 42.0 != 42.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected usize, found bool
|
||||
//~| expected `usize`, found `bool`
|
||||
const ARRR5: [i32; Y5] = [99; 0];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
|
@ -2,19 +2,19 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:1:18
|
||||
|
|
||||
LL | const X: usize = 42 && 39;
|
||||
| ^^ expected bool, found integer
|
||||
| ^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:1:24
|
||||
|
|
||||
LL | const X: usize = 42 && 39;
|
||||
| ^^ expected bool, found integer
|
||||
| ^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:1:18
|
||||
|
|
||||
LL | const X: usize = 42 && 39;
|
||||
| ^^^^^^^^ expected usize, found bool
|
||||
| ^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:8:18
|
||||
@ -26,19 +26,19 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:11:19
|
||||
|
|
||||
LL | const X1: usize = 42 || 39;
|
||||
| ^^ expected bool, found integer
|
||||
| ^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:11:25
|
||||
|
|
||||
LL | const X1: usize = 42 || 39;
|
||||
| ^^ expected bool, found integer
|
||||
| ^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:11:19
|
||||
|
|
||||
LL | const X1: usize = 42 || 39;
|
||||
| ^^^^^^^^ expected usize, found bool
|
||||
| ^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:18:19
|
||||
@ -50,19 +50,19 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:21:19
|
||||
|
|
||||
LL | const X2: usize = -42 || -39;
|
||||
| ^^^ expected bool, found integer
|
||||
| ^^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:21:26
|
||||
|
|
||||
LL | const X2: usize = -42 || -39;
|
||||
| ^^^ expected bool, found integer
|
||||
| ^^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:21:19
|
||||
|
|
||||
LL | const X2: usize = -42 || -39;
|
||||
| ^^^^^^^^^^ expected usize, found bool
|
||||
| ^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:28:19
|
||||
@ -74,19 +74,19 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:31:19
|
||||
|
|
||||
LL | const X3: usize = -42 && -39;
|
||||
| ^^^ expected bool, found integer
|
||||
| ^^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:31:26
|
||||
|
|
||||
LL | const X3: usize = -42 && -39;
|
||||
| ^^^ expected bool, found integer
|
||||
| ^^^ expected `bool`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:31:19
|
||||
|
|
||||
LL | const X3: usize = -42 && -39;
|
||||
| ^^^^^^^^^^ expected usize, found bool
|
||||
| ^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:38:19
|
||||
@ -98,7 +98,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:41:18
|
||||
|
|
||||
LL | const Y: usize = 42.0 == 42.0;
|
||||
| ^^^^^^^^^^^^ expected usize, found bool
|
||||
| ^^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:44:19
|
||||
@ -110,7 +110,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:47:19
|
||||
|
|
||||
LL | const Y1: usize = 42.0 >= 42.0;
|
||||
| ^^^^^^^^^^^^ expected usize, found bool
|
||||
| ^^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:50:20
|
||||
@ -122,7 +122,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:53:19
|
||||
|
|
||||
LL | const Y2: usize = 42.0 <= 42.0;
|
||||
| ^^^^^^^^^^^^ expected usize, found bool
|
||||
| ^^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:56:20
|
||||
@ -134,7 +134,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:59:19
|
||||
|
|
||||
LL | const Y3: usize = 42.0 > 42.0;
|
||||
| ^^^^^^^^^^^ expected usize, found bool
|
||||
| ^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:62:20
|
||||
@ -146,7 +146,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:65:19
|
||||
|
|
||||
LL | const Y4: usize = 42.0 < 42.0;
|
||||
| ^^^^^^^^^^^ expected usize, found bool
|
||||
| ^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:68:20
|
||||
@ -158,7 +158,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:71:19
|
||||
|
|
||||
LL | const Y5: usize = 42.0 != 42.0;
|
||||
| ^^^^^^^^^^^^ expected usize, found bool
|
||||
| ^^^^^^^^^^^^ expected `usize`, found `bool`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const-integer-bool-ops.rs:74:20
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const TUP: (usize,) = 5usize << 64;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected tuple, found usize
|
||||
//~| expected tuple, found `usize`
|
||||
const ARR: [i32; TUP.0] = [];
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-tup-index-span.rs:3:23
|
||||
|
|
||||
LL | const TUP: (usize,) = 5usize << 64;
|
||||
| ^^^^^^^^^^^^ expected tuple, found usize
|
||||
| ^^^^^^^^^^^^ expected tuple, found `usize`
|
||||
|
|
||||
= note: expected tuple `(usize,)`
|
||||
found type `usize`
|
||||
|
@ -2,13 +2,13 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-type-mismatch.rs:4:21
|
||||
|
|
||||
LL | const TWELVE: u16 = TEN + 2;
|
||||
| ^^^^^^^ expected u16, found u8
|
||||
| ^^^^^^^ expected `u16`, found `u8`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-type-mismatch.rs:9:27
|
||||
|
|
||||
LL | const ALSO_TEN: u16 = TEN;
|
||||
| ^^^ expected u16, found u8
|
||||
| ^^^ expected `u16`, found `u8`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-discr-type-err.rs:18:21
|
||||
|
|
||||
LL | $( $v = $s::V, )*
|
||||
| ^^^^^ expected isize, found i32
|
||||
| ^^^^^ expected `isize`, found `i32`
|
||||
...
|
||||
LL | / mac! {
|
||||
LL | | A = F,
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
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()`
|
||||
|
||||
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");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| 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()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -31,7 +31,7 @@ error[E0308]: mismatched types
|
||||
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()`
|
||||
|
|
||||
= note: expected struct `std::vec::Vec<usize>`
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
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`
|
||||
|
|
||||
= note: expected reference `&dyn Trait`
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
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()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
LL | foo3(u);
|
||||
| ^
|
||||
| |
|
||||
| expected u32, found &u32
|
||||
| expected `u32`, found `&u32`
|
||||
| help: consider dereferencing the borrow: `*u`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -22,7 +22,7 @@ error[E0308]: mismatched types
|
||||
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()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -31,14 +31,14 @@ error[E0308]: mismatched types
|
||||
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()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:2:20
|
||||
|
|
||||
LL | ($x:expr) => { &$x }
|
||||
| ^^^ expected u32, found &{integer}
|
||||
| ^^^ expected `u32`, found `&{integer}`
|
||||
...
|
||||
LL | foo3(borrow!(0));
|
||||
| ---------- in this macro invocation
|
||||
@ -47,7 +47,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:36:5
|
||||
|
|
||||
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)
|
||||
|
||||
@ -57,7 +57,7 @@ error[E0308]: mismatched types
|
||||
LL | let s = S { u };
|
||||
| ^
|
||||
| |
|
||||
| expected &u32, found integer
|
||||
| expected `&u32`, found integer
|
||||
| help: consider borrowing here: `u: &u`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -66,7 +66,7 @@ error[E0308]: mismatched types
|
||||
LL | let s = S { u: u };
|
||||
| ^
|
||||
| |
|
||||
| expected &u32, found integer
|
||||
| expected `&u32`, found integer
|
||||
| help: consider borrowing here: `&u`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -75,7 +75,7 @@ error[E0308]: mismatched types
|
||||
LL | let r = R { i };
|
||||
| ^
|
||||
| |
|
||||
| expected u32, found &{integer}
|
||||
| expected `u32`, found `&{integer}`
|
||||
| help: consider dereferencing the borrow: `i: *i`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -84,7 +84,7 @@ error[E0308]: mismatched types
|
||||
LL | let r = R { i: i };
|
||||
| ^
|
||||
| |
|
||||
| expected u32, found &{integer}
|
||||
| expected `u32`, found `&{integer}`
|
||||
| help: consider dereferencing the borrow: `*i`
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
@ -33,12 +33,12 @@ fn main() {
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected trait object `dyn T`
|
||||
//~| found reference `&_`
|
||||
//~| expected trait T, found reference
|
||||
//~| expected trait `T`, found reference
|
||||
let &&&x = &(&1isize as &dyn T);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected trait object `dyn T`
|
||||
//~| found reference `&_`
|
||||
//~| expected trait T, found reference
|
||||
//~| expected trait `T`, found reference
|
||||
let box box x = box 1isize as Box<dyn T>;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected trait object `dyn T`
|
||||
|
@ -22,7 +22,7 @@ error[E0308]: mismatched types
|
||||
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`
|
||||
|
|
||||
= note: expected trait object `dyn T`
|
||||
@ -34,7 +34,7 @@ error[E0308]: mismatched types
|
||||
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`
|
||||
|
|
||||
= note: expected trait object `dyn T`
|
||||
@ -44,7 +44,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/destructure-trait-ref.rs:42:13
|
||||
|
|
||||
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`
|
||||
found struct `std::boxed::Box<_>`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-42764.rs:11:43
|
||||
|
|
||||
LL | this_function_expects_a_double_option(n);
|
||||
| ^ expected enum `DoubleOption`, found usize
|
||||
| ^ expected enum `DoubleOption`, found `usize`
|
||||
|
|
||||
= note: expected enum `DoubleOption<_>`
|
||||
found type `usize`
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | let sixteen: f32 = 16;
|
||||
| ^^
|
||||
| |
|
||||
| expected f32, found integer
|
||||
| expected `f32`, found integer
|
||||
| help: use a float literal: `16.0`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
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`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -22,20 +22,20 @@ error[E0308]: mismatched types
|
||||
LL | let negative_nine: f32 = -9;
|
||||
| ^^
|
||||
| |
|
||||
| expected f32, found integer
|
||||
| expected `f32`, found integer
|
||||
| help: use a float literal: `-9.0`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-53280-expected-float-found-integer-literal.rs:15:30
|
||||
|
|
||||
LL | let sixteen_again: f64 = 0x10;
|
||||
| ^^^^ expected f64, found integer
|
||||
| ^^^^ expected `f64`, found integer
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-53280-expected-float-found-integer-literal.rs:17:30
|
||||
|
|
||||
LL | let and_once_more: f32 = 0o20;
|
||||
| ^^^^ expected f32, found integer
|
||||
| ^^^^ expected `f32`, found integer
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -16,7 +16,7 @@ fn f_i8() {
|
||||
Ok2,
|
||||
OhNo = 0_u8,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected i8, found u8
|
||||
//~| expected `i8`, found `u8`
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -29,7 +29,7 @@ fn f_u8() {
|
||||
Ok2,
|
||||
OhNo = 0_i8,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected u8, found i8
|
||||
//~| expected `u8`, found `i8`
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -42,7 +42,7 @@ fn f_i16() {
|
||||
Ok2,
|
||||
OhNo = 0_u16,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected i16, found u16
|
||||
//~| expected `i16`, found `u16`
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -55,7 +55,7 @@ fn f_u16() {
|
||||
Ok2,
|
||||
OhNo = 0_i16,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected u16, found i16
|
||||
//~| expected `u16`, found `i16`
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -68,7 +68,7 @@ fn f_i32() {
|
||||
Ok2,
|
||||
OhNo = 0_u32,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected i32, found u32
|
||||
//~| expected `i32`, found `u32`
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -81,7 +81,7 @@ fn f_u32() {
|
||||
Ok2,
|
||||
OhNo = 0_i32,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected u32, found i32
|
||||
//~| expected `u32`, found `i32`
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -94,7 +94,7 @@ fn f_i64() {
|
||||
Ok2,
|
||||
OhNo = 0_u64,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected i64, found u64
|
||||
//~| expected `i64`, found `u64`
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
@ -107,7 +107,7 @@ fn f_u64() {
|
||||
Ok2,
|
||||
OhNo = 0_i64,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected u64, found i64
|
||||
//~| expected `u64`, found `i64`
|
||||
}
|
||||
|
||||
let x = A::Ok;
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/discrim-ill-typed.rs:17:16
|
||||
|
|
||||
LL | OhNo = 0_u8,
|
||||
| ^^^^ expected i8, found u8
|
||||
| ^^^^ expected `i8`, found `u8`
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | OhNo = 0_i8,
|
||||
| ^^^^ expected u8, found i8
|
||||
| ^^^^ expected `u8`, found `i8`
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | OhNo = 0_u16,
|
||||
| ^^^^^ expected i16, found u16
|
||||
| ^^^^^ expected `i16`, found `u16`
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | OhNo = 0_i16,
|
||||
| ^^^^^ expected u16, found i16
|
||||
| ^^^^^ expected `u16`, found `i16`
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | OhNo = 0_u32,
|
||||
| ^^^^^ expected i32, found u32
|
||||
| ^^^^^ expected `i32`, found `u32`
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | OhNo = 0_i32,
|
||||
| ^^^^^ expected u32, found i32
|
||||
| ^^^^^ expected `u32`, found `i32`
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | OhNo = 0_u64,
|
||||
| ^^^^^ expected i64, found u64
|
||||
| ^^^^^ expected `i64`, found `u64`
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | OhNo = 0_i64,
|
||||
| ^^^^^ expected u64, found i64
|
||||
| ^^^^^ expected `u64`, found `i64`
|
||||
|
|
||||
help: change the type of the numeric literal from `i64` to `u64`
|
||||
|
|
||||
|
@ -5,7 +5,7 @@ LL | fn assert_sizeof() -> ! {
|
||||
| - expected `!` because of return type
|
||||
LL | unsafe {
|
||||
LL | ::std::mem::transmute::<f64, [u8; 8]>(panic!())
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected !, found array `[u8; 8]`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found array `[u8; 8]`
|
||||
|
|
||||
= note: expected type `!`
|
||||
found array `[u8; 8]`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/diverging-tuple-parts-39485.rs:8:5
|
||||
|
|
||||
LL | &panic!()
|
||||
| ^^^^^^^^^ expected (), found reference
|
||||
| ^^^^^^^^^ expected `()`, found reference
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found reference `&_`
|
||||
@ -21,7 +21,7 @@ error[E0308]: mismatched types
|
||||
LL | fn f() -> isize {
|
||||
| ----- expected `isize` because of return type
|
||||
LL | (return 1, return 2)
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found tuple
|
||||
|
|
||||
= note: expected type `isize`
|
||||
found tuple `(!, !)`
|
||||
|
@ -32,7 +32,7 @@ pub fn main() {
|
||||
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
|
||||
f5.2 = Bar1 {f: 36};
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected trait ToBar, found struct `Bar1`
|
||||
//~| expected trait `ToBar`, found struct `Bar1`
|
||||
//~| expected trait object `dyn ToBar`
|
||||
//~| found struct `Bar1`
|
||||
//~| ERROR the size for values of type
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-assign-3.rs:33:12
|
||||
|
|
||||
LL | f5.2 = Bar1 {f: 36};
|
||||
| ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1`
|
||||
| ^^^^^^^^^^^^ expected trait `ToBar`, found struct `Bar1`
|
||||
|
|
||||
= note: expected trait object `dyn ToBar`
|
||||
found struct `Bar1`
|
||||
|
@ -34,7 +34,7 @@ pub fn main() {
|
||||
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
|
||||
f5.ptr = Bar1 {f: 36};
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected trait ToBar, found struct `Bar1`
|
||||
//~| expected trait `ToBar`, found struct `Bar1`
|
||||
//~| expected trait object `dyn ToBar`
|
||||
//~| found struct `Bar1`
|
||||
//~| ERROR the size for values of type
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-assign.rs:35:14
|
||||
|
|
||||
LL | f5.ptr = Bar1 {f: 36};
|
||||
| ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1`
|
||||
| ^^^^^^^^^^^^ expected trait `ToBar`, found struct `Bar1`
|
||||
|
|
||||
= note: expected trait object `dyn ToBar`
|
||||
found struct `Bar1`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-coercions.rs:14:17
|
||||
|
|
||||
LL | let y: &S = x;
|
||||
| ^ expected &S, found *-ptr
|
||||
| ^ expected `&S`, found *-ptr
|
||||
|
|
||||
= note: expected reference `&S`
|
||||
found raw pointer `*const S`
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
LL | let y: &dyn T = x;
|
||||
| ^
|
||||
| |
|
||||
| expected &dyn T, found *-ptr
|
||||
| expected `&dyn T`, found *-ptr
|
||||
| help: consider borrowing here: `&x`
|
||||
|
|
||||
= note: expected reference `&dyn T`
|
||||
@ -23,7 +23,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-coercions.rs:19:17
|
||||
|
|
||||
LL | let y: &S = x;
|
||||
| ^ expected &S, found *-ptr
|
||||
| ^ expected `&S`, found *-ptr
|
||||
|
|
||||
= note: expected reference `&S`
|
||||
found raw pointer `*mut S`
|
||||
@ -34,7 +34,7 @@ error[E0308]: mismatched types
|
||||
LL | let y: &dyn T = x;
|
||||
| ^
|
||||
| |
|
||||
| expected &dyn T, found *-ptr
|
||||
| expected `&dyn T`, found *-ptr
|
||||
| help: consider borrowing here: `&x`
|
||||
|
|
||||
= note: expected reference `&dyn T`
|
||||
|
@ -14,7 +14,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/E0070.rs:8:25
|
||||
|
|
||||
LL | some_other_func() = 4;
|
||||
| ^ expected (), found integer
|
||||
| ^ expected `()`, found integer
|
||||
|
||||
error[E0070]: invalid left-hand side expression
|
||||
--> $DIR/E0070.rs:8:5
|
||||
|
@ -5,7 +5,7 @@ LL | fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
|
||||
| --- ------------------ required by this bound in `foo`
|
||||
...
|
||||
LL | foo(3_i8);
|
||||
| ^^^ expected u32, found &str
|
||||
| ^^^ expected `u32`, found `&str`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | match x {
|
||||
| - this match expression has type `u8`
|
||||
LL | 0u8..=3i8 => (),
|
||||
| ^^^^^^^^^ expected u8, found i8
|
||||
| ^^^^^^^^^ expected `u8`, found `i8`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: intrinsic has wrong type
|
||||
--> $DIR/E0308.rs:4:5
|
||||
|
|
||||
LL | fn size_of<T>();
|
||||
| ^^^^^^^^^^^^^^^^ expected (), found usize
|
||||
| ^^^^^^^^^^^^^^^^ expected `()`, found `usize`
|
||||
|
|
||||
= note: expected fn pointer `extern "rust-intrinsic" fn()`
|
||||
found fn pointer `extern "rust-intrinsic" fn() -> usize`
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
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()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -4,14 +4,14 @@ error[E0308]: mismatched types
|
||||
LL | let x: f32 = 1;
|
||||
| ^
|
||||
| |
|
||||
| expected f32, found integer
|
||||
| expected `f32`, found integer
|
||||
| help: use a float literal: `1.0`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/float-literal-inference-restrictions.rs:3:18
|
||||
|
|
||||
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`
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/fn-bad-block-type.rs:3:19
|
||||
|
|
||||
LL | fn f() -> isize { true }
|
||||
| ----- ^^^^ expected isize, found bool
|
||||
| ----- ^^^^ expected `isize`, found `bool`
|
||||
| |
|
||||
| expected `isize` because of return type
|
||||
|
||||
|
@ -18,7 +18,7 @@ fn main() {
|
||||
|
||||
eq(foo::<u8>, foo::<i8>);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected u8, found i8
|
||||
//~| expected `u8`, found `i8`
|
||||
|
||||
eq(bar::<String>, bar::<Vec<u8>>);
|
||||
//~^ ERROR mismatched types
|
||||
@ -29,5 +29,5 @@ fn main() {
|
||||
// Make sure we distinguish between trait methods correctly.
|
||||
eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected u8, found u16
|
||||
//~| expected `u8`, found `u16`
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/fn-item-type.rs:19:19
|
||||
|
|
||||
LL | eq(foo::<u8>, foo::<i8>);
|
||||
| ^^^^^^^^^ expected u8, found i8
|
||||
| ^^^^^^^^^ expected `u8`, found `i8`
|
||||
|
|
||||
= note: expected fn item `fn(isize) -> isize {foo::<u8>}`
|
||||
found fn item `fn(isize) -> isize {foo::<i8>}`
|
||||
@ -29,7 +29,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/fn-item-type.rs:30:26
|
||||
|
|
||||
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}`
|
||||
found fn item `fn() {<u16 as Foo>::foo}`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/fn-trait-formatting.rs:6:17
|
||||
|
|
||||
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 `()`
|
||||
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
|
||||
|
|
||||
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 `()`
|
||||
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
|
||||
|
|
||||
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 `()`
|
||||
found struct `std::boxed::Box<dyn std::ops::FnMut() -> isize>`
|
||||
|
@ -7,7 +7,7 @@ fn bar(x: usize) -> Option<usize> {
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected enum `std::option::Option<usize>`
|
||||
//~| found type `usize`
|
||||
//~| expected enum `std::option::Option`, found usize
|
||||
//~| expected enum `std::option::Option`, found `usize`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn bar(x: usize) -> Option<usize> {
|
||||
| ------------- expected `std::option::Option<usize>` because of return type
|
||||
LL | return x;
|
||||
| ^ expected enum `std::option::Option`, found usize
|
||||
| ^ expected enum `std::option::Option`, found `usize`
|
||||
|
|
||||
= note: expected enum `std::option::Option<usize>`
|
||||
found type `usize`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/type-mismatch-signature-deduction.rs:8:20
|
||||
|
|
||||
LL | return Ok(6);
|
||||
| ^^^^^ expected i32, found enum `std::result::Result`
|
||||
| ^^^^^ expected `i32`, found enum `std::result::Result`
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found enum `std::result::Result<{integer}, _>`
|
||||
|
@ -8,7 +8,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/generic-arg-mismatch-recover.rs:6:33
|
||||
|
|
||||
LL | Foo::<'static, 'static, ()>(&0);
|
||||
| ^^ expected (), found integer
|
||||
| ^^ expected `()`, found integer
|
||||
|
|
||||
= note: expected reference `&'static ()`
|
||||
found reference `&{integer}`
|
||||
|
@ -12,40 +12,40 @@ fn main() {
|
||||
// Ensure that the printed type doesn't include the default type params...
|
||||
let _: Foo<isize> = ();
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected struct `Foo`, found ()
|
||||
//~| expected struct `Foo`, found `()`
|
||||
//~| expected struct `Foo<isize>`
|
||||
//~| found unit type `()`
|
||||
|
||||
// ...even when they're present, but the same types as the defaults.
|
||||
let _: Foo<isize, B, C> = ();
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected struct `Foo`, found ()
|
||||
//~| expected struct `Foo`, found `()`
|
||||
//~| expected struct `Foo<isize>`
|
||||
//~| found unit type `()`
|
||||
|
||||
// Including cases where the default is using previous type params.
|
||||
let _: HashMap<String, isize> = ();
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected struct `HashMap`, found ()
|
||||
//~| expected struct `HashMap`, found `()`
|
||||
//~| expected struct `HashMap<std::string::String, isize>`
|
||||
//~| found unit type `()`
|
||||
let _: HashMap<String, isize, Hash<String>> = ();
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected struct `HashMap`, found ()
|
||||
//~| expected struct `HashMap`, found `()`
|
||||
//~| expected struct `HashMap<std::string::String, isize>`
|
||||
//~| found unit type `()`
|
||||
|
||||
// But not when there's a different type in between.
|
||||
let _: Foo<A, isize, C> = ();
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected struct `Foo`, found ()
|
||||
//~| expected struct `Foo`, found `()`
|
||||
//~| expected struct `Foo<A, isize>`
|
||||
//~| found unit type `()`
|
||||
|
||||
// And don't print <> at all when there's just defaults.
|
||||
let _: Foo<A, B, C> = ();
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected struct `Foo`, found ()
|
||||
//~| expected struct `Foo`, found `()`
|
||||
//~| expected struct `Foo`
|
||||
//~| found unit type `()`
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/generic-type-params-name-repr.rs:13:25
|
||||
|
|
||||
LL | let _: Foo<isize> = ();
|
||||
| ^^ expected struct `Foo`, found ()
|
||||
| ^^ expected struct `Foo`, found `()`
|
||||
|
|
||||
= note: expected struct `Foo<isize>`
|
||||
found unit type `()`
|
||||
@ -11,7 +11,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/generic-type-params-name-repr.rs:20:31
|
||||
|
|
||||
LL | let _: Foo<isize, B, C> = ();
|
||||
| ^^ expected struct `Foo`, found ()
|
||||
| ^^ expected struct `Foo`, found `()`
|
||||
|
|
||||
= note: expected struct `Foo<isize>`
|
||||
found unit type `()`
|
||||
@ -20,7 +20,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/generic-type-params-name-repr.rs:27:37
|
||||
|
|
||||
LL | let _: HashMap<String, isize> = ();
|
||||
| ^^ expected struct `HashMap`, found ()
|
||||
| ^^ expected struct `HashMap`, found `()`
|
||||
|
|
||||
= note: expected struct `HashMap<std::string::String, isize>`
|
||||
found unit type `()`
|
||||
@ -29,7 +29,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/generic-type-params-name-repr.rs:32:51
|
||||
|
|
||||
LL | let _: HashMap<String, isize, Hash<String>> = ();
|
||||
| ^^ expected struct `HashMap`, found ()
|
||||
| ^^ expected struct `HashMap`, found `()`
|
||||
|
|
||||
= note: expected struct `HashMap<std::string::String, isize>`
|
||||
found unit type `()`
|
||||
@ -38,7 +38,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/generic-type-params-name-repr.rs:39:31
|
||||
|
|
||||
LL | let _: Foo<A, isize, C> = ();
|
||||
| ^^ expected struct `Foo`, found ()
|
||||
| ^^ expected struct `Foo`, found `()`
|
||||
|
|
||||
= note: expected struct `Foo<A, isize>`
|
||||
found unit type `()`
|
||||
@ -47,7 +47,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/generic-type-params-name-repr.rs:46:27
|
||||
|
|
||||
LL | let _: Foo<A, B, C> = ();
|
||||
| ^^ expected struct `Foo`, found ()
|
||||
| ^^ expected struct `Foo`, found `()`
|
||||
|
|
||||
= note: expected struct `Foo`
|
||||
found unit type `()`
|
||||
|
@ -7,7 +7,7 @@ LL | | 1i32
|
||||
| | ---- expected because of this
|
||||
LL | | } else {
|
||||
LL | | 2u32
|
||||
| | ^^^^ expected i32, found u32
|
||||
| | ^^^^ expected `i32`, found `u32`
|
||||
LL | | };
|
||||
| |_____- 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
|
||||
|
|
||||
LL | let _ = if true { 42i32 } else { 42u32 };
|
||||
| ----- ^^^^^ expected i32, found u32
|
||||
| ----- ^^^^^ expected `i32`, found `u32`
|
||||
| |
|
||||
| expected because of this
|
||||
|
||||
@ -31,7 +31,7 @@ LL | | 3u32;
|
||||
| | expected because of this
|
||||
LL | | } else {
|
||||
LL | | 4u32
|
||||
| | ^^^^ expected (), found u32
|
||||
| | ^^^^ expected `()`, found `u32`
|
||||
LL | | };
|
||||
| |_____- if and else have incompatible types
|
||||
|
||||
@ -47,7 +47,7 @@ LL | | 6u32;
|
||||
| | ^^^^-
|
||||
| | | |
|
||||
| | | help: consider removing this semicolon
|
||||
| | expected u32, found ()
|
||||
| | expected `u32`, found `()`
|
||||
LL | | };
|
||||
| |_____- if and else have incompatible types
|
||||
|
||||
@ -60,7 +60,7 @@ LL | | 7i32;
|
||||
| | ----- expected because of this
|
||||
LL | | } else {
|
||||
LL | | 8u32
|
||||
| | ^^^^ expected (), found u32
|
||||
| | ^^^^ expected `()`, found `u32`
|
||||
LL | | };
|
||||
| |_____- if and else have incompatible types
|
||||
|
||||
@ -73,7 +73,7 @@ LL | | 9i32
|
||||
| | ---- expected because of this
|
||||
LL | | } else {
|
||||
LL | | 10u32;
|
||||
| | ^^^^^^ expected i32, found ()
|
||||
| | ^^^^^^ expected `i32`, found `()`
|
||||
LL | | };
|
||||
| |_____- if and else have incompatible types
|
||||
|
||||
@ -86,7 +86,7 @@ LL | |
|
||||
LL | | } else {
|
||||
| |_____- expected because of this
|
||||
LL | 11u32
|
||||
| ^^^^^ expected (), found u32
|
||||
| ^^^^^ expected `()`, found `u32`
|
||||
|
||||
error[E0308]: if and else have incompatible types
|
||||
--> $DIR/if-else-type-mismatch.rs:42:12
|
||||
@ -99,7 +99,7 @@ LL | } else {
|
||||
| ____________^
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^ expected i32, found ()
|
||||
| |_____^ expected `i32`, found `()`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
fn main() {
|
||||
let x = if true { 10i32 } else { 10u32 };
|
||||
//~^ ERROR if and else have incompatible types
|
||||
//~| expected i32, found u32
|
||||
//~| expected `i32`, found `u32`
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: if and else have incompatible types
|
||||
--> $DIR/if-branch-types.rs:2:38
|
||||
|
|
||||
LL | let x = if true { 10i32 } else { 10u32 };
|
||||
| ----- ^^^^^ expected i32, found u32
|
||||
| ----- ^^^^^ expected `i32`, found `u32`
|
||||
| |
|
||||
| expected because of this
|
||||
|
||||
|
@ -7,5 +7,5 @@ fn main() {
|
||||
1
|
||||
};
|
||||
//~^^ 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
Loading…
Reference in New Issue
Block a user