mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 06:35:27 +00:00
Remove E0308 note when primary label has all info
This commit is contained in:
parent
b2e6aef073
commit
94c6425464
@ -1163,8 +1163,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
Some(values) => {
|
||||
let (is_simple_error, exp_found) = match values {
|
||||
ValuePairs::Types(exp_found) => {
|
||||
let is_simple_err =
|
||||
exp_found.expected.is_primitive() && exp_found.found.is_primitive();
|
||||
let is_simple_err = exp_found.expected.is_simple_text()
|
||||
&& exp_found.found.is_simple_text();
|
||||
|
||||
(is_simple_err, Some(exp_found))
|
||||
}
|
||||
@ -1201,8 +1201,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
.unwrap_or("type".into());
|
||||
let found_label = exp_found.map(|ef| ef.found.prefix_string())
|
||||
.unwrap_or("type".into());
|
||||
match (terr, is_simple_error, expected == found) {
|
||||
(&TypeError::Sorts(ref values), false, extra) => {
|
||||
match (&terr, expected == found) {
|
||||
(TypeError::Sorts(values), extra) => {
|
||||
let sort_string = |ty: Ty<'tcx>| match (extra, &ty.kind) {
|
||||
(true, ty::Opaque(def_id, _)) => format!(
|
||||
" (opaque type at {})",
|
||||
@ -1212,26 +1212,43 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
(true, _) => format!(" ({})", ty.sort_string(self.tcx)),
|
||||
(false, _) => "".to_string(),
|
||||
};
|
||||
diag.note_expected_found_extra(
|
||||
&expected_label,
|
||||
expected,
|
||||
&found_label,
|
||||
found,
|
||||
&sort_string(values.expected),
|
||||
&sort_string(values.found),
|
||||
);
|
||||
if !(values.expected.is_simple_text() && values.found.is_simple_text()) || (
|
||||
exp_found.map_or(false, |ef| {
|
||||
// This happens when the type error is a subset of the expectation,
|
||||
// like when you have two references but one is `usize` and the other
|
||||
// is `f32`. In those cases we still want to show the `note`. If the
|
||||
// value from `ef` is `Infer(_)`, then we ignore it.
|
||||
if !ef.expected.is_ty_infer() {
|
||||
ef.expected != values.expected
|
||||
} else if !ef.found.is_ty_infer() {
|
||||
ef.found != values.found
|
||||
} else {
|
||||
false
|
||||
}
|
||||
})
|
||||
) {
|
||||
diag.note_expected_found_extra(
|
||||
&expected_label,
|
||||
expected,
|
||||
&found_label,
|
||||
found,
|
||||
&sort_string(values.expected),
|
||||
&sort_string(values.found),
|
||||
);
|
||||
}
|
||||
}
|
||||
(TypeError::ObjectUnsafeCoercion(_), ..) => {
|
||||
(TypeError::ObjectUnsafeCoercion(_), _) => {
|
||||
diag.note_unsuccessfull_coercion(found, expected);
|
||||
}
|
||||
(_, false, _) => {
|
||||
(_, _) => {
|
||||
debug!(
|
||||
"note_type_err: exp_found={:?}, expected={:?} found={:?}",
|
||||
exp_found, expected, found
|
||||
);
|
||||
diag.note_expected_found(&expected_label, expected, &found_label, found);
|
||||
if !is_simple_error || terr.must_include_note() {
|
||||
diag.note_expected_found(&expected_label, expected, &found_label, found);
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
if let Some(exp_found) = exp_found {
|
||||
|
@ -64,8 +64,11 @@ pub enum UnconstrainedNumeric {
|
||||
impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use self::TypeError::*;
|
||||
fn report_maybe_different(f: &mut fmt::Formatter<'_>,
|
||||
expected: &str, found: &str) -> fmt::Result {
|
||||
fn report_maybe_different(
|
||||
f: &mut fmt::Formatter<'_>,
|
||||
expected: &str,
|
||||
found: &str,
|
||||
) -> fmt::Result {
|
||||
// A naive approach to making sure that we're not reporting silly errors such as:
|
||||
// (expected closure, found closure).
|
||||
if expected == found {
|
||||
@ -183,39 +186,70 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeError<'tcx> {
|
||||
pub fn must_include_note(&self) -> bool {
|
||||
use self::TypeError::*;
|
||||
match self {
|
||||
CyclicTy(_) |
|
||||
UnsafetyMismatch(_) |
|
||||
Mismatch |
|
||||
AbiMismatch(_) |
|
||||
FixedArraySize(_) |
|
||||
Sorts(_) |
|
||||
IntMismatch(_) |
|
||||
FloatMismatch(_) |
|
||||
VariadicMismatch(_) => false,
|
||||
|
||||
Mutability |
|
||||
TupleSize(_) |
|
||||
ArgCount |
|
||||
RegionsDoesNotOutlive(..) |
|
||||
RegionsInsufficientlyPolymorphic(..) |
|
||||
RegionsOverlyPolymorphic(..) |
|
||||
RegionsPlaceholderMismatch |
|
||||
Traits(_) |
|
||||
ProjectionMismatched(_) |
|
||||
ProjectionBoundsLength(_) |
|
||||
ExistentialMismatch(_) |
|
||||
ConstMismatch(_) |
|
||||
IntrinsicCast |
|
||||
ObjectUnsafeCoercion(_) => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 => self.to_string().into(),
|
||||
ty::Tuple(ref tys) if tys.is_empty() => self.to_string().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(),
|
||||
ty::Array(_, n) => {
|
||||
ty::Array(t, n) => {
|
||||
let n = tcx.lift(&n).unwrap();
|
||||
match n.try_eval_usize(tcx, ty::ParamEnv::empty()) {
|
||||
Some(n) => {
|
||||
format!("array of {} element{}", n, pluralize!(n)).into()
|
||||
}
|
||||
_ if t.is_simple_ty() => format!("array `{}`", self).into(),
|
||||
Some(n) => format!("array of {} element{} ", n, pluralize!(n)).into(),
|
||||
None => "array".into(),
|
||||
}
|
||||
}
|
||||
ty::Slice(ty) if ty.is_simple_ty() => format!("slice `{}`", self).into(),
|
||||
ty::Slice(_) => "slice".into(),
|
||||
ty::RawPtr(_) => "*-ptr".into(),
|
||||
ty::Ref(region, ty, mutbl) => {
|
||||
ty::Ref(_, ty, mutbl) => {
|
||||
let tymut = ty::TypeAndMut { ty, mutbl };
|
||||
let tymut_string = tymut.to_string();
|
||||
if tymut_string == "_" || //unknown type name,
|
||||
tymut_string.len() > 10 || //name longer than saying "reference",
|
||||
region.to_string() != "'_" //... or a complex type
|
||||
{
|
||||
format!("{}reference", match mutbl {
|
||||
hir::Mutability::Mutable => "mutable ",
|
||||
_ => ""
|
||||
}).into()
|
||||
} else {
|
||||
if tymut_string != "_" && (
|
||||
ty.is_simple_text() || tymut_string.len() < "mutable reference".len()
|
||||
) {
|
||||
format!("&{}", tymut_string).into()
|
||||
} else { // Unknown type name, it's long or has type arguments
|
||||
match mutbl {
|
||||
hir::Mutability::Mutable => "mutable reference",
|
||||
_ => "reference",
|
||||
}.into()
|
||||
}
|
||||
}
|
||||
ty::FnDef(..) => "fn item".into(),
|
||||
@ -248,7 +282,6 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
}
|
||||
|
||||
pub fn prefix_string(&self) -> Cow<'static, str> {
|
||||
debug!("prefix_string {:?} {} {:?}", self, self, self.kind);
|
||||
match self.kind {
|
||||
ty::Infer(_) | ty::Error | ty::Bool | ty::Char | ty::Int(_) |
|
||||
ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => "type".into(),
|
||||
|
@ -555,16 +555,29 @@ impl<'tcx> Hash for TyS<'tcx> {
|
||||
impl<'tcx> TyS<'tcx> {
|
||||
pub fn is_primitive_ty(&self) -> bool {
|
||||
match self.kind {
|
||||
Bool |
|
||||
Char |
|
||||
Int(_) |
|
||||
Uint(_) |
|
||||
Float(_) |
|
||||
Infer(InferTy::IntVar(_)) |
|
||||
Infer(InferTy::FloatVar(_)) |
|
||||
Infer(InferTy::FreshIntTy(_)) |
|
||||
Infer(InferTy::FreshFloatTy(_)) => true,
|
||||
Ref(_, x, _) => x.is_primitive_ty(),
|
||||
Bool | Char | Str | Int(_) | Uint(_) | Float(_) |
|
||||
Infer(InferTy::IntVar(_)) | Infer(InferTy::FloatVar(_)) |
|
||||
Infer(InferTy::FreshIntTy(_)) | Infer(InferTy::FreshFloatTy(_)) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_simple_ty(&self) -> bool {
|
||||
match self.kind {
|
||||
Bool | Char | Str | Int(_) | Uint(_) | Float(_) |
|
||||
Infer(InferTy::IntVar(_)) | Infer(InferTy::FloatVar(_)) |
|
||||
Infer(InferTy::FreshIntTy(_)) | Infer(InferTy::FreshFloatTy(_)) => true,
|
||||
Ref(_, x, _) | Array(x, _) | Slice(x) => x.peel_refs().is_simple_ty(),
|
||||
Tuple(tys) if tys.is_empty() => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_simple_text(&self) -> bool {
|
||||
match self.kind {
|
||||
Adt(_, substs) => substs.types().next().is_none(),
|
||||
Ref(_, ty, _) => ty.is_simple_text(),
|
||||
_ if self.is_simple_ty() => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let x: () = 5i32;
|
||||
| ^^^^ expected (), found i32
|
||||
|
|
||||
= note: expected type `()`
|
||||
found type `i32`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | fn main() { let i: (); i = f(()); }
|
||||
| ^^ expected isize, found ()
|
||||
|
|
||||
= note: expected type `isize`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
fn main() {
|
||||
let _x: i32 = [1, 2, 3];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected type `i32`
|
||||
//~| found array `[{integer}; 3]`
|
||||
//~| expected i32, found array of 3 elements
|
||||
//~| expected i32, found array
|
||||
|
||||
let x: &[i32] = &[1, 2, 3];
|
||||
let _y: &i32 = x;
|
||||
|
@ -2,16 +2,13 @@ error[E0308]: mismatched types
|
||||
--> $DIR/array-not-vector.rs:2:19
|
||||
|
|
||||
LL | let _x: i32 = [1, 2, 3];
|
||||
| ^^^^^^^^^ expected i32, found array of 3 elements
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found array `[{integer}; 3]`
|
||||
| ^^^^^^^^^ expected i32, found array `[{integer}; 3]`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/array-not-vector.rs:9:20
|
||||
--> $DIR/array-not-vector.rs:7:20
|
||||
|
|
||||
LL | let _y: &i32 = x;
|
||||
| ^ expected i32, found slice
|
||||
| ^ 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 reference
|
||||
| ^^^^^^^^^^^^ expected associated type, found &str
|
||||
|
|
||||
= note: expected associated type `<T as Foo>::Out`
|
||||
found reference `&'static str`
|
||||
|
@ -3,36 +3,24 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | fn b() { dent(ModelT, Blue); }
|
||||
| ^^^^ expected struct `Black`, found struct `Blue`
|
||||
|
|
||||
= note: expected struct `Black`
|
||||
found struct `Blue`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:28:23
|
||||
|
|
||||
LL | fn c() { dent(ModelU, Black); }
|
||||
| ^^^^^ expected struct `Blue`, found struct `Black`
|
||||
|
|
||||
= note: expected struct `Blue`
|
||||
found struct `Black`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:32:28
|
||||
|
|
||||
LL | fn f() { ModelT.chip_paint(Blue); }
|
||||
| ^^^^ expected struct `Black`, found struct `Blue`
|
||||
|
|
||||
= note: expected struct `Black`
|
||||
found struct `Blue`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:33:28
|
||||
|
|
||||
LL | fn g() { ModelU.chip_paint(Black); }
|
||||
| ^^^^^ expected struct `Blue`, found struct `Black`
|
||||
|
|
||||
= note: expected struct `Blue`
|
||||
found struct `Black`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -6,9 +6,6 @@ LL | fn blue_car<C:Car<Color=Blue>>(c: C) {
|
||||
...
|
||||
LL | fn b() { blue_car(ModelT); }
|
||||
| ^^^^^^^^ expected struct `Blue`, found struct `Black`
|
||||
|
|
||||
= note: expected struct `Blue`
|
||||
found struct `Black`
|
||||
|
||||
error[E0271]: type mismatch resolving `<ModelU as Vehicle>::Color == Black`
|
||||
--> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:32:10
|
||||
@ -18,9 +15,6 @@ LL | fn black_car<C:Car<Color=Black>>(c: C) {
|
||||
...
|
||||
LL | fn c() { black_car(ModelU); }
|
||||
| ^^^^^^^^^ expected struct `Black`, found struct `Blue`
|
||||
|
|
||||
= note: expected struct `Black`
|
||||
found struct `Blue`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -17,9 +17,6 @@ LL | fn foo1<I: Foo<A=Bar>>(x: I) {
|
||||
...
|
||||
LL | foo1(a);
|
||||
| ^^^^ expected struct `Bar`, found usize
|
||||
|
|
||||
= note: expected struct `Bar`
|
||||
found type `usize`
|
||||
|
||||
error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
|
||||
--> $DIR/associated-types-eq-3.rs:41:9
|
||||
@ -27,8 +24,6 @@ error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
|
||||
LL | baz(&a);
|
||||
| ^^ expected struct `Bar`, found usize
|
||||
|
|
||||
= note: expected struct `Bar`
|
||||
found type `usize`
|
||||
= note: required for the cast to the object type `dyn Foo<A = Bar>`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
@ -4,8 +4,6 @@ error[E0271]: type mismatch resolving `<std::vec::IntoIter<u32> as std::iter::It
|
||||
LL | let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected i32, found u32
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type `u32`
|
||||
= note: required for the cast to the object type `dyn std::iter::Iterator<Item = u32, Item = i32>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -7,8 +7,6 @@ LL | fn visit() {}
|
||||
LL | <() as Visit>::visit();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected (), found &()
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found reference `&()`
|
||||
= note: required because of the requirements on the impl of `Visit` for `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -8,9 +8,6 @@ LL | impl Bar for Foo {
|
||||
| ---------------- in this `impl` item
|
||||
LL | type Ok = ();
|
||||
| ^^^^^^^^^^^^^ expected u32, found ()
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -25,9 +25,6 @@ LL | fn return_targets_async_block_not_fn() -> u8 {
|
||||
| --------------------------------- ^^ expected u8, found ()
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
|
||||
= note: expected type `u8`
|
||||
found unit type `()`
|
||||
|
||||
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
|
||||
--> $DIR/async-block-control-flow-static-semantics.rs:18:39
|
||||
@ -35,8 +32,6 @@ error[E0271]: type mismatch resolving `<impl std::future::Future as std::future:
|
||||
LL | let _: &dyn Future<Output = ()> = █
|
||||
| ^^^^^^ expected (), found u8
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `u8`
|
||||
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -51,9 +46,6 @@ LL | | return 0u8;
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_^ expected u8, found ()
|
||||
|
|
||||
= note: expected type `u8`
|
||||
found unit type `()`
|
||||
|
||||
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
|
||||
--> $DIR/async-block-control-flow-static-semantics.rs:27:39
|
||||
@ -61,8 +53,6 @@ error[E0271]: type mismatch resolving `<impl std::future::Future as std::future:
|
||||
LL | let _: &dyn Future<Output = ()> = █
|
||||
| ^^^^^^ expected (), found u8
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `u8`
|
||||
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
|
@ -1,6 +1,4 @@
|
||||
static i: String = 10;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected struct `std::string::String`, found integer
|
||||
//~| expected struct `std::string::String`
|
||||
//~| found type `{integer}`
|
||||
fn main() { println!("{}", i); }
|
||||
|
@ -6,9 +6,6 @@ LL | static i: String = 10;
|
||||
| |
|
||||
| expected struct `std::string::String`, found integer
|
||||
| help: try using a conversion method: `10.to_string()`
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found type `{integer}`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,18 +3,12 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | fn main() { let x = 1 && 2; }
|
||||
| ^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/binop-logic-int.rs:1:26
|
||||
|
|
||||
LL | fn main() { let x = 1 && 2; }
|
||||
| ^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let bar = 5;
|
||||
| ^^^ expected integer, found struct `foo::bar`
|
||||
|
|
||||
= note: expected type `{integer}`
|
||||
found struct `foo::bar`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,9 +8,6 @@ LL | | foo();
|
||||
| | - help: consider removing this semicolon
|
||||
LL | | };
|
||||
| |_____^ expected i32, found ()
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | true
|
||||
| ^^^^ expected (), found bool
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `bool`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,9 +5,6 @@ LL | fn drop(&mut self) {
|
||||
| - expected `()` because of default return type
|
||||
LL | true
|
||||
| ^^^^ expected (), found bool
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `bool`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
fn main() {
|
||||
while true { //~ WARN denote infinite loops with
|
||||
true //~ ERROR mismatched types
|
||||
//~| expected unit type `()`
|
||||
//~| found type `bool`
|
||||
//~| expected (), found bool
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | true
|
||||
| ^^^^ expected (), found bool
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `bool`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,9 +8,6 @@ LL | fn f() -> String {
|
||||
LL | 0u8;
|
||||
LL | "bla".to_string();
|
||||
| - help: consider removing this semicolon
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found unit type `()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/consider-removing-last-semi.rs:6:11
|
||||
@ -22,9 +19,6 @@ LL | fn g() -> String {
|
||||
LL | "this won't work".to_string();
|
||||
LL | "removeme".to_string();
|
||||
| - help: consider removing this semicolon
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -8,9 +8,6 @@ LL | fn blah() -> i32 {
|
||||
...
|
||||
LL | ;
|
||||
| - help: consider removing this semicolon
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,9 +8,6 @@ LL | fn foo() -> String {
|
||||
...
|
||||
LL | ;
|
||||
| - help: consider removing this semicolon
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found unit type `()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-13428.rs:11:13
|
||||
@ -22,9 +19,6 @@ LL | fn bar() -> String {
|
||||
LL | "foobar".to_string()
|
||||
LL | ;
|
||||
| - help: consider removing this semicolon
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -7,8 +7,6 @@ mod a {
|
||||
Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected (), found enum `a::Enum`
|
||||
//~| expected unit type `()`
|
||||
//~| found enum `a::Enum`
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,8 +20,6 @@ mod b {
|
||||
a::Enum::EnumStructVariant { x, y, z } => {
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected (), found enum `a::Enum`
|
||||
//~| expected unit type `()`
|
||||
//~| found enum `a::Enum`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,20 +5,14 @@ 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`
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found enum `a::Enum`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-13624.rs:22:9
|
||||
--> $DIR/issue-13624.rs:20:9
|
||||
|
|
||||
LL | match enum_struct_variant {
|
||||
| ------------------- this match expression has type `()`
|
||||
LL | a::Enum::EnumStructVariant { x, y, z } => {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum`
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found enum `a::Enum`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -16,9 +16,6 @@ LL | fn main() {
|
||||
LL | let b = Bob + 3.5;
|
||||
LL | b + 3
|
||||
| ^^^^^ expected (), found struct `Bob`
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found struct `Bob`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -4,8 +4,6 @@ error[E0308]: mismatched types
|
||||
LL | foo()
|
||||
| ^^^^^ expected (), found usize
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `usize`
|
||||
help: try adding a semicolon
|
||||
|
|
||||
LL | foo();
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | only_foo(x);
|
||||
| ^ expected i32, found floating-point number
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type `{float}`
|
||||
|
||||
error[E0277]: the trait bound `{float}: Bar` is not satisfied
|
||||
--> $DIR/type_inference.rs:25:5
|
||||
|
@ -10,10 +10,7 @@ error[E0308]: mismatched types
|
||||
LL | fn foo() {
|
||||
| - help: try adding a return type: `-> &'static str`
|
||||
LL | "bar boo"
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected (), found reference
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found reference `&'static str`
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected (), found &str
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:9:13
|
||||
|
|
||||
LL | let _ = box { [1, 2, 3] }: Box<[i32]>;
|
||||
| ^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
||||
| ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
|
|
||||
= note: expected struct `std::boxed::Box<[i32]>`
|
||||
found struct `std::boxed::Box<[i32; 3]>`
|
||||
@ -11,7 +11,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:10:13
|
||||
|
|
||||
LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
|
|
||||
= note: expected struct `std::boxed::Box<[i32]>`
|
||||
found struct `std::boxed::Box<[i32; 3]>`
|
||||
@ -20,7 +20,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:11:13
|
||||
|
|
||||
LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
|
|
||||
= note: expected struct `std::boxed::Box<[i32]>`
|
||||
found struct `std::boxed::Box<[i32; 3]>`
|
||||
@ -56,7 +56,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:17:13
|
||||
|
|
||||
LL | let _ = &{ [1, 2, 3] }: &[i32];
|
||||
| ^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
||||
| ^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
|
|
||||
= note: expected reference `&[i32]`
|
||||
found reference `&[i32; 3]`
|
||||
@ -65,7 +65,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:18:13
|
||||
|
|
||||
LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
|
|
||||
= note: expected reference `&[i32]`
|
||||
found reference `&[i32; 3]`
|
||||
@ -74,7 +74,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:19:13
|
||||
|
|
||||
LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
|
|
||||
= note: expected reference `&[i32]`
|
||||
found reference `&[i32; 3]`
|
||||
@ -110,7 +110,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:25:13
|
||||
|
|
||||
LL | let _ = Box::new([1, 2, 3]): Box<[i32]>;
|
||||
| ^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
||||
| ^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
|
|
||||
= note: expected struct `std::boxed::Box<[i32]>`
|
||||
found struct `std::boxed::Box<[i32; 3]>`
|
||||
|
@ -7,9 +7,6 @@ LL | fn plus_one(x: i32) -> i32 {
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
LL | x + 1;
|
||||
| - help: consider removing this semicolon
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found unit type `()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coercion-missing-tail-expected-type.rs:7:13
|
||||
|
@ -3,6 +3,5 @@
|
||||
fn main() {
|
||||
let _: &[i32] = [0];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected reference `&[i32]`
|
||||
//~| expected &[i32], found array of 1 element
|
||||
//~| expected &[i32], found array `[{integer}; 1]`
|
||||
}
|
||||
|
@ -4,11 +4,8 @@ error[E0308]: mismatched types
|
||||
LL | let _: &[i32] = [0];
|
||||
| ^^^
|
||||
| |
|
||||
| expected &[i32], found array of 1 element
|
||||
| expected &[i32], found array `[{integer}; 1]`
|
||||
| help: consider borrowing here: `&[0]`
|
||||
|
|
||||
= note: expected reference `&[i32]`
|
||||
found array `[{integer}; 1]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,18 +3,12 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8]));
|
||||
| ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements
|
||||
|
|
||||
= note: expected array `[u8; 3]`
|
||||
found array `[u8; 2]`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-argument-cross-crate-mismatch.rs:8:65
|
||||
|
|
||||
LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]);
|
||||
| ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements
|
||||
|
|
||||
= note: expected array `[u8; 2]`
|
||||
found array `[u8; 3]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -3,18 +3,12 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5];
|
||||
| ^^^ expected an array with a fixed size of 2 elements, found one with 1 element
|
||||
|
|
||||
= note: expected array `[i32; 2]`
|
||||
found array `[i32; 1]`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-array-oob-arith.rs:10:44
|
||||
|
|
||||
LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99];
|
||||
| ^^^^^^^ expected an array with a fixed size of 1 element, found one with 2 elements
|
||||
|
|
||||
= note: expected array `[i32; 1]`
|
||||
found array `[i32; 2]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -9,7 +9,6 @@ enum E {
|
||||
V = CONSTANT,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected isize, found struct `S`
|
||||
//~| found struct `S`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | V = CONSTANT,
|
||||
| ^^^^^^^^ expected isize, found struct `S`
|
||||
|
|
||||
= note: expected type `isize`
|
||||
found struct `S`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,18 +3,12 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | const X: usize = 42 && 39;
|
||||
| ^^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:1:24
|
||||
|
|
||||
LL | const X: usize = 42 && 39;
|
||||
| ^^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:1:18
|
||||
@ -33,18 +27,12 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | const X1: usize = 42 || 39;
|
||||
| ^^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:11:25
|
||||
|
|
||||
LL | const X1: usize = 42 || 39;
|
||||
| ^^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:11:19
|
||||
@ -63,18 +51,12 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | const X2: usize = -42 || -39;
|
||||
| ^^^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:21:26
|
||||
|
|
||||
LL | const X2: usize = -42 || -39;
|
||||
| ^^^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:21:19
|
||||
@ -93,18 +75,12 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | const X3: usize = -42 && -39;
|
||||
| ^^^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:31:26
|
||||
|
|
||||
LL | const X3: usize = -42 && -39;
|
||||
| ^^^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-integer-bool-ops.rs:31:19
|
||||
|
@ -4,11 +4,8 @@ error[E0308]: mismatched types
|
||||
LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—";
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| expected struct `std::string::String`, found reference
|
||||
| expected struct `std::string::String`, found &str
|
||||
| help: try using a conversion method: `"'Tis a fond Ambush—".to_string()`
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found reference `&'static str`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/conversion-methods.rs:6:40
|
||||
@ -16,11 +13,8 @@ error[E0308]: mismatched types
|
||||
LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| expected struct `std::path::PathBuf`, found reference
|
||||
| expected struct `std::path::PathBuf`, found &std::path::Path
|
||||
| help: try using a conversion method: `Path::new("/ern/her/own/surprise").to_path_buf()`
|
||||
|
|
||||
= note: expected struct `std::path::PathBuf`
|
||||
found reference `&std::path::Path`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/conversion-methods.rs:9:40
|
||||
@ -30,9 +24,6 @@ LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we sugge
|
||||
| |
|
||||
| expected struct `std::string::String`, found integer
|
||||
| help: try using a conversion method: `2.to_string()`
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/conversion-methods.rs:12:47
|
||||
@ -40,7 +31,7 @@ error[E0308]: mismatched types
|
||||
LL | let _prove_piercing_earnest: Vec<usize> = &[1, 2, 3];
|
||||
| ^^^^^^^^^^
|
||||
| |
|
||||
| expected struct `std::vec::Vec`, found reference
|
||||
| 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,11 +4,8 @@ error[E0308]: mismatched types
|
||||
LL | foo(s);
|
||||
| ^
|
||||
| |
|
||||
| expected struct `std::string::String`, found reference
|
||||
| expected struct `std::string::String`, found &std::string::String
|
||||
| help: try using a conversion method: `s.to_string()`
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found reference `&std::string::String`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:14:10
|
||||
@ -18,9 +15,6 @@ LL | foo3(u);
|
||||
| |
|
||||
| expected u32, found &u32
|
||||
| help: consider dereferencing the borrow: `*u`
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found reference `&u32`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:30:9
|
||||
@ -28,11 +22,8 @@ error[E0308]: mismatched types
|
||||
LL | foo(&"aaa".to_owned());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| expected struct `std::string::String`, found reference
|
||||
| expected struct `std::string::String`, found &std::string::String
|
||||
| help: consider removing the borrow: `"aaa".to_owned()`
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found reference `&std::string::String`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:32:9
|
||||
@ -40,11 +31,8 @@ error[E0308]: mismatched types
|
||||
LL | foo(&mut "aaa".to_owned());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| expected struct `std::string::String`, found mutable reference
|
||||
| expected struct `std::string::String`, found &mut std::string::String
|
||||
| help: consider removing the borrow: `"aaa".to_owned()`
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found mutable reference `&mut std::string::String`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:2:20
|
||||
@ -54,9 +42,6 @@ LL | ($x:expr) => { &$x }
|
||||
...
|
||||
LL | foo3(borrow!(0));
|
||||
| ---------- in this macro invocation
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found reference `&{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:36:5
|
||||
@ -64,8 +49,6 @@ error[E0308]: mismatched types
|
||||
LL | assert_eq!(3i32, &3i32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found &i32
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found reference `&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)
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -76,9 +59,6 @@ LL | let s = S { u };
|
||||
| |
|
||||
| expected &u32, found integer
|
||||
| help: consider borrowing here: `u: &u`
|
||||
|
|
||||
= note: expected reference `&u32`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:41:20
|
||||
@ -88,9 +68,6 @@ LL | let s = S { u: u };
|
||||
| |
|
||||
| expected &u32, found integer
|
||||
| help: consider borrowing here: `&u`
|
||||
|
|
||||
= note: expected reference `&u32`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:44:17
|
||||
@ -100,9 +77,6 @@ LL | let r = R { i };
|
||||
| |
|
||||
| expected u32, found &{integer}
|
||||
| help: consider dereferencing the borrow: `i: *i`
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found reference `&{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deref-suggestion.rs:46:20
|
||||
@ -112,9 +86,6 @@ LL | let r = R { i: i };
|
||||
| |
|
||||
| expected u32, found &{integer}
|
||||
| help: consider dereferencing the borrow: `*i`
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found reference `&{integer}`
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
|
@ -18,9 +18,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let _c = Context { wrapper: Payload{} };
|
||||
| ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload`
|
||||
|
|
||||
= note: expected struct `Wrapper`
|
||||
found struct `Payload`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -6,9 +6,6 @@ LL | let sixteen: f32 = 16;
|
||||
| |
|
||||
| expected f32, found integer
|
||||
| help: use a float literal: `16.0`
|
||||
|
|
||||
= note: expected type `f32`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-53280-expected-float-found-integer-literal.rs:5:38
|
||||
@ -18,9 +15,6 @@ LL | let a_million_and_seventy: f64 = 1_000_070;
|
||||
| |
|
||||
| expected f64, found integer
|
||||
| help: use a float literal: `1_000_070.0`
|
||||
|
|
||||
= note: expected type `f64`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-53280-expected-float-found-integer-literal.rs:8:30
|
||||
@ -30,27 +24,18 @@ LL | let negative_nine: f32 = -9;
|
||||
| |
|
||||
| expected f32, found integer
|
||||
| help: use a float literal: `-9.0`
|
||||
|
|
||||
= note: expected type `f32`
|
||||
found type `{integer}`
|
||||
|
||||
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
|
||||
|
|
||||
= note: expected type `f64`
|
||||
found type `{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
|
||||
|
|
||||
= note: expected type `f32`
|
||||
found type `{integer}`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -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 of 8 elements
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected !, found array `[u8; 8]`
|
||||
|
|
||||
= note: expected type `!`
|
||||
found array `[u8; 8]`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-coerce1.rs:16:29
|
||||
|
|
||||
LL | let f3: &Fat<[usize]> = f2;
|
||||
| ^^ expected slice, found array of 3 elements
|
||||
| ^^ expected slice `[usize]`, found array `[isize; 3]`
|
||||
|
|
||||
= note: expected reference `&Fat<[usize]>`
|
||||
found reference `&Fat<[isize; 3]>`
|
||||
@ -19,7 +19,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-coerce1.rs:28:27
|
||||
|
|
||||
LL | let f3: &([usize],) = f2;
|
||||
| ^^ expected slice, found array of 3 elements
|
||||
| ^^ expected slice `[usize]`, found array `[isize; 3]`
|
||||
|
|
||||
= note: expected reference `&([usize],)`
|
||||
found reference `&([isize; 3],)`
|
||||
|
@ -11,15 +11,15 @@ pub fn main() {
|
||||
let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] };
|
||||
let f2: &Fat<[isize; 3]> = f1;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected array `[isize; 3]`, found slice `[isize]`
|
||||
//~| expected reference `&Fat<[isize; 3]>`
|
||||
//~| found reference `&Fat<[isize]>`
|
||||
//~| expected array of 3 elements, found slice
|
||||
|
||||
// Tuple with a vec of isizes.
|
||||
let f1: &([isize],) = &([1, 2, 3],);
|
||||
let f2: &([isize; 3],) = f1;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected array `[isize; 3]`, found slice `[isize]`
|
||||
//~| expected reference `&([isize; 3],)`
|
||||
//~| found reference `&([isize],)`
|
||||
//~| expected array of 3 elements, found slice
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-coerce4.rs:12:32
|
||||
|
|
||||
LL | let f2: &Fat<[isize; 3]> = f1;
|
||||
| ^^ expected array of 3 elements, found slice
|
||||
| ^^ expected array `[isize; 3]`, found slice `[isize]`
|
||||
|
|
||||
= note: expected reference `&Fat<[isize; 3]>`
|
||||
found reference `&Fat<[isize]>`
|
||||
@ -11,7 +11,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-coerce4.rs:20:30
|
||||
|
|
||||
LL | let f2: &([isize; 3],) = f1;
|
||||
| ^^ expected array of 3 elements, found slice
|
||||
| ^^ expected array `[isize; 3]`, found slice `[isize]`
|
||||
|
|
||||
= note: expected reference `&([isize; 3],)`
|
||||
found reference `&([isize],)`
|
||||
|
@ -15,9 +15,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | some_other_func() = 4;
|
||||
| ^ expected (), found integer
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0070]: invalid left-hand side expression
|
||||
--> $DIR/E0070.rs:8:5
|
||||
|
@ -5,10 +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 reference
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found reference `&'static str`
|
||||
| ^^^ expected u32, found &str
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -6,9 +6,6 @@ LL | wants_uniq(x);
|
||||
| |
|
||||
| expected struct `std::string::String`, found &str
|
||||
| help: try using a conversion method: `x.to_string()`
|
||||
|
|
||||
= note: expected struct `std::string::String`
|
||||
found reference `&str`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -6,9 +6,6 @@ LL | let x: f32 = 1;
|
||||
| |
|
||||
| expected f32, found integer
|
||||
| help: use a float literal: `1.0`
|
||||
|
|
||||
= note: expected type `f32`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/float-literal-inference-restrictions.rs:3:18
|
||||
|
@ -12,8 +12,6 @@ fn bar(x: x::Foo) -> y::Foo {
|
||||
return x;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected enum `y::Foo`, found enum `x::Foo`
|
||||
//~| expected enum `y::Foo`
|
||||
//~| found enum `x::Foo`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -5,9 +5,6 @@ LL | fn bar(x: x::Foo) -> y::Foo {
|
||||
| ------ expected `y::Foo` because of return type
|
||||
LL | return x;
|
||||
| ^ expected enum `y::Foo`, found enum `x::Foo`
|
||||
|
|
||||
= note: expected enum `y::Foo`
|
||||
found enum `x::Foo`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -15,8 +15,6 @@ error[E0271]: type mismatch resolving `<[closure@$DIR/issue-62203-hrtb-ice.rs:42
|
||||
LL | let v = Unit2.m(
|
||||
| ^ expected struct `Unit4`, found struct `Unit3`
|
||||
|
|
||||
= note: expected struct `Unit4`
|
||||
found struct `Unit3`
|
||||
= note: required because of the requirements on the impl of `for<'r> T0<'r, (<Unit2 as Ty<'r>>::V,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -10,9 +10,6 @@ LL | | 2u32
|
||||
| | ^^^^ expected i32, found u32
|
||||
LL | | };
|
||||
| |_____- if and else have incompatible types
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type `u32`
|
||||
|
||||
error[E0308]: if and else have incompatible types
|
||||
--> $DIR/if-else-type-mismatch.rs:8:38
|
||||
@ -21,9 +18,6 @@ LL | let _ = if true { 42i32 } else { 42u32 };
|
||||
| ----- ^^^^^ expected i32, found u32
|
||||
| |
|
||||
| expected because of this
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type `u32`
|
||||
|
||||
error[E0308]: if and else have incompatible types
|
||||
--> $DIR/if-else-type-mismatch.rs:13:9
|
||||
@ -40,9 +34,6 @@ LL | | 4u32
|
||||
| | ^^^^ expected (), found u32
|
||||
LL | | };
|
||||
| |_____- if and else have incompatible types
|
||||
|
|
||||
= note: expected type `()`
|
||||
found type `u32`
|
||||
|
||||
error[E0308]: if and else have incompatible types
|
||||
--> $DIR/if-else-type-mismatch.rs:19:9
|
||||
@ -59,9 +50,6 @@ LL | | 6u32;
|
||||
| | expected u32, found ()
|
||||
LL | | };
|
||||
| |_____- if and else have incompatible types
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found unit type `()`
|
||||
|
||||
error[E0308]: if and else have incompatible types
|
||||
--> $DIR/if-else-type-mismatch.rs:25:9
|
||||
@ -75,9 +63,6 @@ LL | | 8u32
|
||||
| | ^^^^ expected (), found u32
|
||||
LL | | };
|
||||
| |_____- if and else have incompatible types
|
||||
|
|
||||
= note: expected type `()`
|
||||
found type `u32`
|
||||
|
||||
error[E0308]: if and else have incompatible types
|
||||
--> $DIR/if-else-type-mismatch.rs:31:9
|
||||
@ -91,9 +76,6 @@ LL | | 10u32;
|
||||
| | ^^^^^^ expected i32, found ()
|
||||
LL | | };
|
||||
| |_____- if and else have incompatible types
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found unit type `()`
|
||||
|
||||
error[E0308]: if and else have incompatible types
|
||||
--> $DIR/if-else-type-mismatch.rs:37:9
|
||||
@ -105,9 +87,6 @@ LL | | } else {
|
||||
| |_____- expected because of this
|
||||
LL | 11u32
|
||||
| ^^^^^ expected (), found u32
|
||||
|
|
||||
= note: expected type `()`
|
||||
found type `u32`
|
||||
|
||||
error[E0308]: if and else have incompatible types
|
||||
--> $DIR/if-else-type-mismatch.rs:42:12
|
||||
@ -121,9 +100,6 @@ LL | } else {
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____^ expected i32, found ()
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
@ -5,9 +5,6 @@ LL | let x = if true { 10i32 } else { 10u32 };
|
||||
| ----- ^^^^^ expected i32, found u32
|
||||
| |
|
||||
| expected because of this
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type `u32`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,5 +8,4 @@ fn main() {
|
||||
};
|
||||
//~^^ ERROR: if and else have incompatible types
|
||||
//~| NOTE expected (), found integer
|
||||
//~| NOTE expected type `()`
|
||||
}
|
||||
|
@ -11,9 +11,6 @@ LL | | 1
|
||||
| | ^ expected (), found integer
|
||||
LL | | };
|
||||
| |_____- if and else have incompatible types
|
||||
|
|
||||
= note: expected type `()`
|
||||
found type `{integer}`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -6,9 +6,6 @@ LL | if b_ref() {}
|
||||
| |
|
||||
| expected bool, found &bool
|
||||
| help: consider dereferencing the borrow: `*b_ref()`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found reference `&bool`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/if-no-match-bindings.rs:19:8
|
||||
@ -18,9 +15,6 @@ LL | if b_mut_ref() {}
|
||||
| |
|
||||
| expected bool, found &mut bool
|
||||
| help: consider dereferencing the borrow: `*b_mut_ref()`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found mutable reference `&mut bool`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/if-no-match-bindings.rs:20:8
|
||||
@ -30,9 +24,6 @@ LL | if &true {}
|
||||
| |
|
||||
| expected bool, found &bool
|
||||
| help: consider removing the borrow: `true`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found reference `&bool`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/if-no-match-bindings.rs:21:8
|
||||
@ -42,9 +33,6 @@ LL | if &mut true {}
|
||||
| |
|
||||
| expected bool, found &mut bool
|
||||
| help: consider removing the borrow: `true`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found mutable reference `&mut bool`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/if-no-match-bindings.rs:24:11
|
||||
@ -54,9 +42,6 @@ LL | while b_ref() {}
|
||||
| |
|
||||
| expected bool, found &bool
|
||||
| help: consider dereferencing the borrow: `*b_ref()`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found reference `&bool`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/if-no-match-bindings.rs:25:11
|
||||
@ -66,9 +51,6 @@ LL | while b_mut_ref() {}
|
||||
| |
|
||||
| expected bool, found &mut bool
|
||||
| help: consider dereferencing the borrow: `*b_mut_ref()`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found mutable reference `&mut bool`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/if-no-match-bindings.rs:26:11
|
||||
@ -78,9 +60,6 @@ LL | while &true {}
|
||||
| |
|
||||
| expected bool, found &bool
|
||||
| help: consider removing the borrow: `true`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found reference `&bool`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/if-no-match-bindings.rs:27:11
|
||||
@ -90,9 +69,6 @@ LL | while &mut true {}
|
||||
| |
|
||||
| expected bool, found &mut bool
|
||||
| help: consider removing the borrow: `true`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found mutable reference `&mut bool`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
@ -8,8 +8,6 @@ LL | | return 3;
|
||||
LL | | }
|
||||
| |_____^ expected usize, found ()
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found unit type `()`
|
||||
= note: `if` expressions without `else` evaluate to `()`
|
||||
= help: consider adding an `else` block that evaluates to the expected type
|
||||
|
||||
@ -24,8 +22,6 @@ LL | | return 3;
|
||||
LL | | };
|
||||
| |_____^ expected usize, found ()
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found unit type `()`
|
||||
= note: `if` expressions without `else` evaluate to `()`
|
||||
= help: consider adding an `else` block that evaluates to the expected type
|
||||
|
||||
@ -39,8 +35,6 @@ LL | | 3
|
||||
LL | | }
|
||||
| |_____^ expected usize, found ()
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found unit type `()`
|
||||
= note: `if` expressions without `else` evaluate to `()`
|
||||
= help: consider adding an `else` block that evaluates to the expected type
|
||||
|
||||
@ -54,8 +48,6 @@ LL | | return 3;
|
||||
LL | | }
|
||||
| |_____^ expected usize, found ()
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found unit type `()`
|
||||
= note: `if` expressions without `else` evaluate to `()`
|
||||
= help: consider adding an `else` block that evaluates to the expected type
|
||||
|
||||
@ -70,8 +62,6 @@ LL | | return 3;
|
||||
LL | | };
|
||||
| |_____^ expected usize, found ()
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found unit type `()`
|
||||
= note: `if` expressions without `else` evaluate to `()`
|
||||
= help: consider adding an `else` block that evaluates to the expected type
|
||||
|
||||
@ -85,8 +75,6 @@ LL | | 3
|
||||
LL | | }
|
||||
| |_____^ expected usize, found ()
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found unit type `()`
|
||||
= note: `if` expressions without `else` evaluate to `()`
|
||||
= help: consider adding an `else` block that evaluates to the expected type
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
fn main() {
|
||||
let a = if true { true };
|
||||
//~^ ERROR if may be missing an else clause [E0317]
|
||||
//~| expected unit type `()`
|
||||
//~| found type `bool`
|
||||
//~| expected (), found bool
|
||||
println!("{}", a);
|
||||
}
|
||||
|
@ -7,8 +7,6 @@ LL | let a = if true { true };
|
||||
| | found here
|
||||
| expected (), found bool
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `bool`
|
||||
= note: `if` expressions without `else` evaluate to `()`
|
||||
= help: consider adding an `else` block that evaluates to the expected type
|
||||
|
||||
|
@ -9,9 +9,6 @@ LL | return 1_i32;
|
||||
LL | }
|
||||
LL | 0_u32
|
||||
| ^^^^^ expected i32, found u32
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type `u32`
|
||||
|
||||
error[E0277]: cannot add `impl Foo` to `u32`
|
||||
--> $DIR/equality.rs:24:11
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/mismatched-types.rs:2:20
|
||||
|
|
||||
LL | let b: &[u8] = include_str!("file.txt");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found str
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found str
|
||||
|
|
||||
= note: expected reference `&[u8]`
|
||||
found reference `&'static str`
|
||||
@ -11,7 +11,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/mismatched-types.rs:3:19
|
||||
|
|
||||
LL | let s: &str = include_bytes!("file.txt");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found array of 0 elements
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found array `[u8; 0]`
|
||||
|
|
||||
= note: expected reference `&str`
|
||||
found reference `&'static [u8; 0]`
|
||||
|
@ -2,7 +2,5 @@ fn main() {
|
||||
let mut x = 2;
|
||||
x = 5.0;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected type `{integer}`
|
||||
//~| found type `{float}`
|
||||
//~| expected integer, found floating-point number
|
||||
}
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | x = 5.0;
|
||||
| ^^^ expected integer, found floating-point number
|
||||
|
|
||||
= note: expected type `{integer}`
|
||||
found type `{float}`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,7 +8,6 @@ fn main() {
|
||||
None => (),
|
||||
//~^ ERROR match arms have incompatible types
|
||||
//~| NOTE expected bool, found ()
|
||||
//~| NOTE expected type `bool`
|
||||
_ => true
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,6 @@ LL | | None => (),
|
||||
LL | | _ => true
|
||||
LL | | }
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -2,10 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-12997-2.rs:8:1
|
||||
|
|
||||
LL | fn bar(x: isize) { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found mutable reference
|
||||
|
|
||||
= note: expected type `isize`
|
||||
found mutable reference `&mut test::Bencher`
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found &mut test::Bencher
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -9,9 +9,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | A::C = 1;
|
||||
| ^ expected struct `A::C`, found integer
|
||||
|
|
||||
= note: expected struct `A::C`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0070]: invalid left-hand side expression
|
||||
--> $DIR/issue-13407.rs:6:5
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-13446.rs:3:26
|
||||
|
|
||||
LL | static VEC: [u32; 256] = vec![];
|
||||
| ^^^^^^ expected array of 256 elements, found struct `std::vec::Vec`
|
||||
| ^^^^^^ expected array `[u32; 256]`, found struct `std::vec::Vec`
|
||||
|
|
||||
= note: expected array `[u32; 256]`
|
||||
found struct `std::vec::Vec<_>`
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | assert!(1,1);
|
||||
| ^^^^^^^^^^^^^ expected bool, found integer
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `{integer}`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,8 +5,6 @@ fn make(v: Vec2) {
|
||||
let Vec3 { y: _, z: _ } = v;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected struct `Vec2`, found struct `Vec3`
|
||||
//~| expected struct `Vec2`
|
||||
//~| found struct `Vec3`
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let Vec3 { y: _, z: _ } = v;
|
||||
| ^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found struct `Vec3`
|
||||
|
|
||||
= note: expected struct `Vec2`
|
||||
found struct `Vec3`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -9,6 +9,6 @@ fn main() {
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected enum `std::option::Option<&[&str]>`
|
||||
//~| found enum `std::option::Option<&[&str; 1]>`
|
||||
//~| expected slice, found array of 1 element
|
||||
//~| expected slice `[&str]`, found array `[&str; 1]`
|
||||
assert_eq!(msg, 3);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-15783.rs:8:19
|
||||
|
|
||||
LL | let msg = foo(x);
|
||||
| ^ expected slice, found array of 1 element
|
||||
| ^ expected slice `[&str]`, found array `[&str; 1]`
|
||||
|
|
||||
= note: expected enum `std::option::Option<&[&str]>`
|
||||
found enum `std::option::Option<&[&str; 1]>`
|
||||
|
@ -11,8 +11,6 @@ fn main() {
|
||||
Tau{t: x},
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected enum `main::R`, found struct `main::Tau`
|
||||
//~| expected enum `main::R`
|
||||
//~| found struct `main::Tau`
|
||||
_) => x,
|
||||
};
|
||||
}
|
||||
|
@ -6,9 +6,6 @@ LL | let u = match e {
|
||||
LL | E::B(
|
||||
LL | Tau{t: x},
|
||||
| ^^^^^^^^^ expected enum `main::R`, found struct `main::Tau`
|
||||
|
|
||||
= note: expected enum `main::R`
|
||||
found struct `main::Tau`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
fn f<'r>(p: &'r mut fn(p: &mut ())) {
|
||||
(*p)(()) //~ ERROR mismatched types
|
||||
//~| expected mutable reference `&mut ()`
|
||||
//~| found unit type `()`
|
||||
//~| expected &mut (), found ()
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,6 @@ LL | (*p)(())
|
||||
| |
|
||||
| expected &mut (), found ()
|
||||
| help: consider mutably borrowing here: `&mut ()`
|
||||
|
|
||||
= note: expected mutable reference `&mut ()`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
fn main() {
|
||||
if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause
|
||||
//~| expected unit type `()`
|
||||
//~| found type `{integer}`
|
||||
//~| expected (), found integer
|
||||
765
|
||||
};
|
||||
|
@ -3,15 +3,11 @@ error[E0317]: if may be missing an else clause
|
||||
|
|
||||
LL | / if let Some(homura) = Some("madoka") {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | 765
|
||||
| | --- found here
|
||||
LL | | };
|
||||
| |_____^ expected (), found integer
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `{integer}`
|
||||
= note: `if` expressions without `else` evaluate to `()`
|
||||
= help: consider adding an `else` block that evaluates to the expected type
|
||||
|
||||
|
@ -5,13 +5,11 @@ struct Foo;
|
||||
impl<'a, T> Fn<(&'a T,)> for Foo {
|
||||
extern "rust-call" fn call(&self, (_,): (T,)) {}
|
||||
//~^ ERROR: has an incompatible type for trait
|
||||
//~| expected reference
|
||||
}
|
||||
|
||||
impl<'a, T> FnMut<(&'a T,)> for Foo {
|
||||
extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
|
||||
//~^ ERROR: has an incompatible type for trait
|
||||
//~| expected reference
|
||||
}
|
||||
|
||||
impl<'a, T> FnOnce<(&'a T,)> for Foo {
|
||||
@ -19,7 +17,6 @@ impl<'a, T> FnOnce<(&'a T,)> for Foo {
|
||||
|
||||
extern "rust-call" fn call_once(self, (_,): (T,)) {}
|
||||
//~^ ERROR: has an incompatible type for trait
|
||||
//~| expected reference
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -4,7 +4,7 @@ error[E0053]: method `call` has an incompatible type for trait
|
||||
LL | impl<'a, T> Fn<(&'a T,)> for Foo {
|
||||
| - this type parameter
|
||||
LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter `T`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &T, found type parameter `T`
|
||||
|
|
||||
= note: expected fn pointer `extern "rust-call" fn(&Foo, (&'a T,))`
|
||||
found fn pointer `extern "rust-call" fn(&Foo, (T,))`
|
||||
@ -12,12 +12,12 @@ LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
|
||||
|
||||
error[E0053]: method `call_mut` has an incompatible type for trait
|
||||
--> $DIR/issue-20225.rs:12:3
|
||||
--> $DIR/issue-20225.rs:11:3
|
||||
|
|
||||
LL | impl<'a, T> FnMut<(&'a T,)> for Foo {
|
||||
| - this type parameter
|
||||
LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter `T`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &T, found type parameter `T`
|
||||
|
|
||||
= note: expected fn pointer `extern "rust-call" fn(&mut Foo, (&'a T,))`
|
||||
found fn pointer `extern "rust-call" fn(&mut Foo, (T,))`
|
||||
@ -25,13 +25,13 @@ LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
|
||||
|
||||
error[E0053]: method `call_once` has an incompatible type for trait
|
||||
--> $DIR/issue-20225.rs:20:3
|
||||
--> $DIR/issue-20225.rs:18:3
|
||||
|
|
||||
LL | impl<'a, T> FnOnce<(&'a T,)> for Foo {
|
||||
| - this type parameter
|
||||
...
|
||||
LL | extern "rust-call" fn call_once(self, (_,): (T,)) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter `T`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &T, found type parameter `T`
|
||||
|
|
||||
= note: expected fn pointer `extern "rust-call" fn(Foo, (&'a T,))`
|
||||
found fn pointer `extern "rust-call" fn(Foo, (T,))`
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let _: () = foo::Foo.bar();
|
||||
| ^^^^^^^^^^^^^^ expected (), found bool
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `bool`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -12,9 +12,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let v: Vec(&str) = vec!['1', '2'];
|
||||
| ^^^ expected &str, found char
|
||||
|
|
||||
= note: expected reference `&str`
|
||||
found type `char`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -4,6 +4,4 @@ fn main() {
|
||||
let b = [0; S];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected usize, found struct `S`
|
||||
//~| expected type `usize`
|
||||
//~| found struct `S`
|
||||
}
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let b = [0; S];
|
||||
| ^ expected usize, found struct `S`
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found struct `S`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -16,9 +16,6 @@ LL | loop { break };
|
||||
| |
|
||||
| expected i32, found ()
|
||||
| help: give it a value of the expected type: `break 42`
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found unit type `()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-27042.rs:8:9
|
||||
@ -27,9 +24,6 @@ LL | / 'b:
|
||||
LL | |
|
||||
LL | | while true { break }; // but here we cite the whole loop
|
||||
| |____________________________^ expected i32, found ()
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found unit type `()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-27042.rs:12:9
|
||||
@ -37,9 +31,6 @@ error[E0308]: mismatched types
|
||||
LL | / 'c:
|
||||
LL | | for _ in None { break }; // but here we cite the whole loop
|
||||
| |_______________________________^ expected i32, found ()
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found unit type `()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-27042.rs:15:9
|
||||
@ -47,9 +38,6 @@ error[E0308]: mismatched types
|
||||
LL | / 'd:
|
||||
LL | | while let Some(_) = None { break };
|
||||
| |__________________________________________^ expected i32, found ()
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -4,8 +4,6 @@ macro_rules! foo {
|
||||
bar(&mut $d);
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected u8, found &mut u8
|
||||
//~| expected type `u8`
|
||||
//~| found mutable reference `&mut u8`
|
||||
}}
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,6 @@ LL | bar(&mut $d);
|
||||
...
|
||||
LL | foo!(0u8);
|
||||
| ---------- in this macro invocation
|
||||
|
|
||||
= note: expected type `u8`
|
||||
found mutable reference `&mut u8`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | u = v; // mark $0 and $1 in a subtype relationship
|
||||
| ^ expected struct `A`, found struct `B`
|
||||
|
|
||||
= note: expected struct `A`
|
||||
found struct `B`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let Test = 1;
|
||||
| ^^^^ expected integer, found struct `Test`
|
||||
|
|
||||
= note: expected type `{integer}`
|
||||
found struct `Test`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,18 +3,12 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let empty_struct::XEmpty2 = ();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `empty_struct::XEmpty2`
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found struct `empty_struct::XEmpty2`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-37026.rs:7:9
|
||||
|
|
||||
LL | let empty_struct::XEmpty6(..) = ();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `empty_struct::XEmpty6`
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found struct `empty_struct::XEmpty6`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -3,9 +3,6 @@ error[E0308]: mismatched types
|
||||
|
|
||||
LL | let x: () = 0;
|
||||
| ^ expected (), found integer
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found type `{integer}`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -7,8 +7,6 @@ LL | fn visit() {}
|
||||
LL | <() as Visit>::visit();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected &(), found ()
|
||||
|
|
||||
= note: expected reference `&()`
|
||||
found unit type `()`
|
||||
= note: required because of the requirements on the impl of `Visit` for `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -3,9 +3,6 @@ error[E0326]: implemented const `CONST` has an incompatible type for trait
|
||||
|
|
||||
LL | const CONST: () = ();
|
||||
| ^^ expected u32, found ()
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user