The previous output was unintuitive to users.
Err(ty_err) => {
tcx.sess.delay_span_bug(
span,
- &format!("could not unify `{hidden_ty}` with revealed type:\n{ty_err}"),
+ &format!(
+ "could not unify `{hidden_ty}` with revealed type:\n{}",
+ ty_err.to_string(tcx)
+ ),
);
}
}
use rustc_hir::lang_items::LangItem;
use rustc_hir::Node;
use rustc_middle::dep_graph::DepContext;
+use rustc_middle::ty::print::with_forced_trimmed_paths;
use rustc_middle::ty::relate::{self, RelateResult, TypeRelation};
use rustc_middle::ty::{
self, error::TypeError, List, Region, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable,
{
format!("expected this to be `{}`", expected)
} else {
- terr.to_string()
+ terr.to_string(self.tcx)
};
label_or_note(sp, &terr);
label_or_note(span, &msg);
} else {
- label_or_note(span, &terr.to_string());
+ label_or_note(span, &terr.to_string(self.tcx));
label_or_note(sp, &msg);
}
} else {
- label_or_note(span, &terr.to_string());
+ if let Some(values) = values
+ && let Some((e, f)) = values.ty()
+ && let TypeError::ArgumentSorts(..) | TypeError::Sorts(_) = terr
+ {
+ let e = self.tcx.erase_regions(e);
+ let f = self.tcx.erase_regions(f);
+ let expected = with_forced_trimmed_paths!(e.sort_string(self.tcx));
+ let found = with_forced_trimmed_paths!(f.sort_string(self.tcx));
+ if expected == found {
+ label_or_note(span, &terr.to_string(self.tcx));
+ } else {
+ label_or_note(span, &format!("expected {expected}, found {found}"));
+ }
+ } else {
+ label_or_note(span, &terr.to_string(self.tcx));
+ }
}
if let Some((expected, found, exp_p, found_p)) = expected_found {
diag.help(
"given a type parameter `T` and a method `foo`:
```
-trait Trait<T> { fn foo(&tcx) -> T; }
+trait Trait<T> { fn foo(&self) -> T; }
```
the only ways to implement method `foo` are:
- constrain `T` with an explicit type:
```
impl Trait<String> for X {
- fn foo(&tcx) -> String { String::new() }
+ fn foo(&self) -> String { String::new() }
}
```
- add a trait bound to `T` and call a method on that trait that returns `Self`:
```
impl<T: std::default::Default> Trait<T> for X {
- fn foo(&tcx) -> T { <T as std::default::Default>::default() }
+ fn foo(&self) -> T { <T as std::default::Default>::default() }
}
```
- change `foo` to return an argument of type `T`:
```
impl<T> Trait<T> for X {
- fn foo(&tcx, x: T) -> T { x }
+ fn foo(&self, x: T) -> T { x }
}
```",
);
```
trait Trait {
type T;
-fn foo(&tcx) -> Self::T;
+fn foo(&self) -> Self::T;
}
```
the only way of implementing method `foo` is to constrain `T` with an explicit associated type:
```
impl Trait for X {
type T = String;
-fn foo(&tcx) -> Self::T { String::new() }
+fn foo(&self) -> Self::T { String::new() }
}
```",
);
use rustc_target::spec::abi;
use std::borrow::Cow;
use std::collections::hash_map::DefaultHasher;
-use std::fmt;
-use std::hash::Hash;
-use std::hash::Hasher;
+use std::hash::{Hash, Hasher};
use std::path::PathBuf;
#[derive(Clone, Copy, Debug, PartialEq, Eq, TypeFoldable, TypeVisitable, Lift)]
/// in parentheses after some larger message. You should also invoke `note_and_explain_type_err()`
/// afterwards to present additional details, particularly when it comes to lifetime-related
/// errors.
-impl<'tcx> fmt::Display for TypeError<'tcx> {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+impl<'tcx> TypeError<'tcx> {
+ pub fn to_string(self, tcx: TyCtxt<'tcx>) -> String {
use self::TypeError::*;
- fn report_maybe_different(
- f: &mut fmt::Formatter<'_>,
- expected: &str,
- found: &str,
- ) -> fmt::Result {
+ fn report_maybe_different(expected: &str, found: &str) -> String {
// A naive approach to making sure that we're not reporting silly errors such as:
// (expected closure, found closure).
if expected == found {
- write!(f, "expected {}, found a different {}", expected, found)
+ format!("expected {}, found a different {}", expected, found)
} else {
- write!(f, "expected {}, found {}", expected, found)
+ format!("expected {}, found {}", expected, found)
}
}
_ => String::new(),
};
- match *self {
- CyclicTy(_) => write!(f, "cyclic type of infinite size"),
- CyclicConst(_) => write!(f, "encountered a self-referencing constant"),
- Mismatch => write!(f, "types differ"),
+ match self {
+ CyclicTy(_) => format!("cyclic type of infinite size"),
+ CyclicConst(_) => format!("encountered a self-referencing constant"),
+ Mismatch => format!("types differ"),
ConstnessMismatch(values) => {
- write!(f, "expected {} bound, found {} bound", values.expected, values.found)
+ format!("expected {} bound, found {} bound", values.expected, values.found)
}
PolarityMismatch(values) => {
- write!(f, "expected {} polarity, found {} polarity", values.expected, values.found)
+ format!("expected {} polarity, found {} polarity", values.expected, values.found)
}
UnsafetyMismatch(values) => {
- write!(f, "expected {} fn, found {} fn", values.expected, values.found)
+ format!("expected {} fn, found {} fn", values.expected, values.found)
}
AbiMismatch(values) => {
- write!(f, "expected {} fn, found {} fn", values.expected, values.found)
+ format!("expected {} fn, found {} fn", values.expected, values.found)
}
- ArgumentMutability(_) | Mutability => write!(f, "types differ in mutability"),
- TupleSize(values) => write!(
- f,
+ ArgumentMutability(_) | Mutability => format!("types differ in mutability"),
+ TupleSize(values) => format!(
"expected a tuple with {} element{}, found one with {} element{}",
values.expected,
pluralize!(values.expected),
values.found,
pluralize!(values.found)
),
- FixedArraySize(values) => write!(
- f,
+ FixedArraySize(values) => format!(
"expected an array with a fixed size of {} element{}, found one with {} element{}",
values.expected,
pluralize!(values.expected),
values.found,
pluralize!(values.found)
),
- ArgCount => write!(f, "incorrect number of function parameters"),
- FieldMisMatch(adt, field) => write!(f, "field type mismatch: {}.{}", adt, field),
- RegionsDoesNotOutlive(..) => write!(f, "lifetime mismatch"),
+ ArgCount => format!("incorrect number of function parameters"),
+ FieldMisMatch(adt, field) => format!("field type mismatch: {}.{}", adt, field),
+ RegionsDoesNotOutlive(..) => format!("lifetime mismatch"),
// Actually naming the region here is a bit confusing because context is lacking
RegionsInsufficientlyPolymorphic(..) => {
- write!(f, "one type is more general than the other")
+ format!("one type is more general than the other")
}
- RegionsOverlyPolymorphic(br, _) => write!(
- f,
+ RegionsOverlyPolymorphic(br, _) => format!(
"expected concrete lifetime, found bound lifetime parameter{}",
br_string(br)
),
- RegionsPlaceholderMismatch => write!(f, "one type is more general than the other"),
- ArgumentSorts(values, _) | Sorts(values) => ty::tls::with(|tcx| {
- let (mut expected, mut found) = with_forced_trimmed_paths!((
- values.expected.sort_string(tcx),
- values.found.sort_string(tcx),
- ));
+ RegionsPlaceholderMismatch => format!("one type is more general than the other"),
+ ArgumentSorts(values, _) | Sorts(values) => {
+ let mut expected = values.expected.sort_string(tcx);
+ let mut found = values.found.sort_string(tcx);
if expected == found {
expected = values.expected.sort_string(tcx);
found = values.found.sort_string(tcx);
}
- report_maybe_different(f, &expected, &found)
- }),
- Traits(values) => ty::tls::with(|tcx| {
+ report_maybe_different(&expected, &found)
+ }
+ Traits(values) => {
let (mut expected, mut found) = with_forced_trimmed_paths!((
tcx.def_path_str(values.expected),
tcx.def_path_str(values.found),
expected = tcx.def_path_str(values.expected);
found = tcx.def_path_str(values.found);
}
- report_maybe_different(
- f,
- &format!("trait `{expected}`"),
- &format!("trait `{found}`"),
- )
- }),
+ report_maybe_different(&format!("trait `{expected}`"), &format!("trait `{found}`"))
+ }
IntMismatch(ref values) => {
let expected = match values.expected {
ty::IntVarValue::IntType(ty) => ty.name_str(),
ty::IntVarValue::IntType(ty) => ty.name_str(),
ty::IntVarValue::UintType(ty) => ty.name_str(),
};
- write!(f, "expected `{}`, found `{}`", expected, found)
+ format!("expected `{}`, found `{}`", expected, found)
}
FloatMismatch(ref values) => {
- write!(
- f,
+ format!(
"expected `{}`, found `{}`",
values.expected.name_str(),
values.found.name_str()
)
}
- VariadicMismatch(ref values) => write!(
- f,
+ VariadicMismatch(ref values) => format!(
"expected {} fn, found {} function",
if values.expected { "variadic" } else { "non-variadic" },
if values.found { "variadic" } else { "non-variadic" }
),
- ProjectionMismatched(ref values) => ty::tls::with(|tcx| {
- write!(
- f,
- "expected {}, found {}",
- tcx.def_path_str(values.expected),
- tcx.def_path_str(values.found)
- )
- }),
+ ProjectionMismatched(ref values) => format!(
+ "expected {}, found {}",
+ tcx.def_path_str(values.expected),
+ tcx.def_path_str(values.found)
+ ),
ExistentialMismatch(ref values) => report_maybe_different(
- f,
&format!("trait `{}`", values.expected),
&format!("trait `{}`", values.found),
),
ConstMismatch(ref values) => {
- write!(f, "expected `{}`, found `{}`", values.expected, values.found)
+ format!("expected `{}`, found `{}`", values.expected, values.found)
}
- IntrinsicCast => write!(f, "cannot coerce intrinsics to function pointers"),
- TargetFeatureCast(_) => write!(
- f,
+ IntrinsicCast => format!("cannot coerce intrinsics to function pointers"),
+ TargetFeatureCast(_) => format!(
"cannot coerce functions with `#[target_feature]` to safe function pointers"
),
}
}
impl<'tcx> Ty<'tcx> {
- pub fn sort_string(self, tcx: TyCtxt<'_>) -> Cow<'static, str> {
+ pub fn sort_string(self, tcx: TyCtxt<'tcx>) -> String {
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::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(t, n) => {
- if t.is_simple_ty() {
- return format!("array `{}`", self).into();
- }
-
- let n = tcx.lift(n).unwrap();
- if let ty::ConstKind::Value(v) = n.kind() {
- if let Some(n) = v.try_to_machine_usize(tcx) {
- return format!("array of {} element{}", n, pluralize!(n)).into();
- }
- }
- "array".into()
- }
- ty::Slice(ty) if ty.is_simple_ty() => format!("slice `{}`", self).into(),
- ty::Slice(_) => "slice".into(),
- ty::RawPtr(tymut) => {
- let tymut_string = match tymut.mutbl {
- hir::Mutability::Mut => tymut.to_string(),
- hir::Mutability::Not => format!("const {}", tymut.ty),
- };
-
- if tymut_string != "_" && (tymut.ty.is_simple_text() || tymut_string.len() < "const raw pointer".len()) {
- format!("`*{}`", tymut_string).into()
- } else {
- // Unknown type name, it's long or has type arguments
- "raw pointer".into()
- }
- },
- ty::Ref(_, ty, mutbl) => {
- let tymut = ty::TypeAndMut { ty, mutbl };
- let tymut_string = tymut.to_string();
-
- 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::Mut => "mutable reference",
- _ => "reference",
- }
- .into()
- }
- }
ty::FnDef(def_id, ..) => match tcx.def_kind(def_id) {
DefKind::Ctor(CtorOf::Struct, _) => "struct constructor".into(),
DefKind::Ctor(CtorOf::Variant, _) => "enum constructor".into(),
},
ty::FnPtr(_) => "fn pointer".into(),
ty::Dynamic(ref inner, ..) if let Some(principal) = inner.principal() => {
- format!("trait object `dyn {}`", tcx.def_path_str(principal.def_id())).into()
+ format!("`dyn {}`", tcx.def_path_str(principal.def_id()))
}
ty::Dynamic(..) => "trait object".into(),
ty::Closure(..) => "closure".into(),
ty::Generator(def_id, ..) => tcx.generator_kind(def_id).unwrap().descr().into(),
ty::GeneratorWitness(..) |
ty::GeneratorWitnessMIR(..) => "generator witness".into(),
- ty::Tuple(..) => "tuple".into(),
ty::Infer(ty::TyVar(_)) => "inferred type".into(),
ty::Infer(ty::IntVar(_)) => "integer".into(),
ty::Infer(ty::FloatVar(_)) => "floating-point number".into(),
ty::Infer(ty::FreshIntTy(_)) => "fresh integral type".into(),
ty::Infer(ty::FreshFloatTy(_)) => "fresh floating-point type".into(),
ty::Alias(ty::Projection, _) => "associated type".into(),
- ty::Param(p) => format!("type parameter `{}`", p).into(),
+ ty::Param(p) => format!("type parameter `{p}`").into(),
ty::Alias(ty::Opaque, ..) => "opaque type".into(),
ty::Error(_) => "type error".into(),
+ _ => {
+ let width = tcx.sess.diagnostic_width();
+ let length_limit = std::cmp::max(width / 4, 15);
+ format!("`{}`", tcx.ty_string_with_limit(self, length_limit))
+ }
}
}
}
impl<'tcx> TyCtxt<'tcx> {
- pub fn short_ty_string(self, ty: Ty<'tcx>) -> (String, Option<PathBuf>) {
- let width = self.sess.diagnostic_width();
- let length_limit = width.saturating_sub(30);
+ pub fn ty_string_with_limit(self, ty: Ty<'tcx>, length_limit: usize) -> String {
let mut type_limit = 50;
let regular = FmtPrinter::new(self, hir::def::Namespace::TypeNS)
.pretty_print_type(ty)
.expect("could not write to `String`")
.into_buffer();
- if regular.len() <= width {
- return (regular, None);
+ if regular.len() <= length_limit {
+ return regular;
}
let mut short;
loop {
}
type_limit -= 1;
}
+ short
+ }
+
+ pub fn short_ty_string(self, ty: Ty<'tcx>) -> (String, Option<PathBuf>) {
+ let width = self.sess.diagnostic_width();
+ let length_limit = width.saturating_sub(30);
+ let regular = FmtPrinter::new(self, hir::def::Namespace::TypeNS)
+ .pretty_print_type(ty)
+ .expect("could not write to `String`")
+ .into_buffer();
+ if regular.len() <= width {
+ return (regular, None);
+ }
+ let short = self.ty_string_with_limit(ty, length_limit);
if regular == short {
return (regular, None);
}
.at(&cause, obligation.param_env)
.define_opaque_types(false)
.eq(placeholder_obligation_trait_ref, impl_trait_ref)
- .map_err(|e| debug!("match_impl: failed eq_trait_refs due to `{e}`"))?;
+ .map_err(|e| {
+ debug!("match_impl: failed eq_trait_refs due to `{}`", e.to_string(self.tcx()))
+ })?;
nested_obligations.extend(obligations);
if !self.is_intercrate()
--> $DIR/track-diagnostics.rs:LL:CC
|
LL | const S: A = B;
- | ^ expected struct `A`, found struct `B`
+ | ^ expected `A`, found `B`
-Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:LL:CC
error: aborting due to previous error
tr -d '\r\n' | $(CGREP) -e \
"mismatched types.*\
crateB::try_foo\(foo2\);.*\
- expected struct \`crateA::foo::Foo\`, found struct \`Foo\`.*\
+ expected \`crateA::foo::Foo\`, found \`Foo\`.*\
different versions of crate \`crateA\`.*\
mismatched types.*\
crateB::try_bar\(bar2\);.*\
--> $DIR/track-diagnostics.rs:LL:CC
|
LL | const S: A = B;
- | ^ expected struct `A`, found struct `B`
+ | ^ expected `A`, found `B`
-Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:LL:CC
error: aborting due to previous error
LL | | {
LL | | loop {}
LL | | }
- | |__^ expected `&Layout`, found struct `Layout`
+ | |__^ expected `&Layout`, found `Layout`
|
note: function defined here
--> $DIR/alloc-error-handler-bad-signature-1.rs:10:4
| ||_- arguments to this function are incorrect
LL | | loop {}
LL | | }
- | |__^ expected struct `Layout`, found struct `core::alloc::Layout`
+ | |__^ expected `Layout`, found `core::alloc::Layout`
|
- = note: struct `core::alloc::Layout` and struct `Layout` have similar names, but are actually distinct types
-note: struct `core::alloc::Layout` is defined in crate `core`
+ = note: `core::alloc::Layout` and `Layout` have similar names, but are actually distinct types
+note: `core::alloc::Layout` is defined in crate `core`
--> $SRC_DIR/core/src/alloc/layout.rs:LL:COL
-note: struct `Layout` is defined in the current crate
+note: `Layout` is defined in the current crate
--> $DIR/alloc-error-handler-bad-signature-2.rs:7:1
|
LL | struct Layout;
--> $DIR/formal-and-expected-differ.rs:22:29
|
LL | let _: U<_, u32> = U(1, S(3u32));
- | - ^^^^^^^ expected `f32`, found `u32`
+ | - ^^^^^^^ expected `S<f32>`, found `S<u32>`
| |
| arguments to this struct are incorrect
|
--> $DIR/formal-and-expected-differ.rs:22:24
|
LL | let _: U<_, u32> = U(1, S(3u32));
- | --------- ^^^^^^^^^^^^^ expected `u32`, found `f32`
+ | --------- ^^^^^^^^^^^^^ expected `U<_, u32>`, found `U<i32, f32>`
| |
| expected due to this
|
--> $DIR/invalid_arguments.rs:24:18
|
LL | three_arg_diff(X{}, 1.0, "");
- | -------------- ^^^ expected `i32`, found struct `X`
+ | -------------- ^^^ expected `i32`, found `X`
| |
| arguments to this function are incorrect
|
--> $DIR/invalid_arguments.rs:25:21
|
LL | three_arg_diff(1, X {}, "");
- | -------------- ^^^^ expected `f32`, found struct `X`
+ | -------------- ^^^^ expected `f32`, found `X`
| |
| arguments to this function are incorrect
|
--> $DIR/invalid_arguments.rs:26:26
|
LL | three_arg_diff(1, 1.0, X {});
- | -------------- ^^^^ expected `&str`, found struct `X`
+ | -------------- ^^^^ expected `&str`, found `X`
| |
| arguments to this function are incorrect
|
--> $DIR/invalid_arguments.rs:28:3
|
LL | three_arg_diff(X {}, X {}, "");
- | ^^^^^^^^^^^^^^ ---- ---- expected `f32`, found struct `X`
+ | ^^^^^^^^^^^^^^ ---- ---- expected `f32`, found `X`
| |
- | expected `i32`, found struct `X`
+ | expected `i32`, found `X`
|
note: function defined here
--> $DIR/invalid_arguments.rs:8:4
--> $DIR/invalid_arguments.rs:29:3
|
LL | three_arg_diff(X {}, 1.0, X {});
- | ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found struct `X`
+ | ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found `X`
| |
- | expected `i32`, found struct `X`
+ | expected `i32`, found `X`
|
note: function defined here
--> $DIR/invalid_arguments.rs:8:4
--> $DIR/invalid_arguments.rs:30:3
|
LL | three_arg_diff(1, X {}, X {});
- | ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found struct `X`
+ | ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found `X`
| |
- | expected `f32`, found struct `X`
+ | expected `f32`, found `X`
|
note: function defined here
--> $DIR/invalid_arguments.rs:8:4
--> $DIR/invalid_arguments.rs:32:3
|
LL | three_arg_diff(X {}, X {}, X {});
- | ^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found struct `X`
+ | ^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found `X`
| | |
- | | expected `f32`, found struct `X`
- | expected `i32`, found struct `X`
+ | | expected `f32`, found `X`
+ | expected `i32`, found `X`
|
note: function defined here
--> $DIR/invalid_arguments.rs:8:4
--> $DIR/invalid_arguments.rs:34:20
|
LL | three_arg_repeat(X {}, 1, "");
- | ---------------- ^^^^ expected `i32`, found struct `X`
+ | ---------------- ^^^^ expected `i32`, found `X`
| |
| arguments to this function are incorrect
|
--> $DIR/invalid_arguments.rs:35:23
|
LL | three_arg_repeat(1, X {}, "");
- | ---------------- ^^^^ expected `i32`, found struct `X`
+ | ---------------- ^^^^ expected `i32`, found `X`
| |
| arguments to this function are incorrect
|
--> $DIR/invalid_arguments.rs:36:26
|
LL | three_arg_repeat(1, 1, X {});
- | ---------------- ^^^^ expected `&str`, found struct `X`
+ | ---------------- ^^^^ expected `&str`, found `X`
| |
| arguments to this function are incorrect
|
--> $DIR/invalid_arguments.rs:38:3
|
LL | three_arg_repeat(X {}, X {}, "");
- | ^^^^^^^^^^^^^^^^ ---- ---- expected `i32`, found struct `X`
+ | ^^^^^^^^^^^^^^^^ ---- ---- expected `i32`, found `X`
| |
- | expected `i32`, found struct `X`
+ | expected `i32`, found `X`
|
note: function defined here
--> $DIR/invalid_arguments.rs:9:4
--> $DIR/invalid_arguments.rs:39:3
|
LL | three_arg_repeat(X {}, 1, X {});
- | ^^^^^^^^^^^^^^^^ ---- ---- expected `&str`, found struct `X`
+ | ^^^^^^^^^^^^^^^^ ---- ---- expected `&str`, found `X`
| |
- | expected `i32`, found struct `X`
+ | expected `i32`, found `X`
|
note: function defined here
--> $DIR/invalid_arguments.rs:9:4
--> $DIR/invalid_arguments.rs:40:3
|
LL | three_arg_repeat(1, X {}, X{});
- | ^^^^^^^^^^^^^^^^ ---- --- expected `&str`, found struct `X`
+ | ^^^^^^^^^^^^^^^^ ---- --- expected `&str`, found `X`
| |
- | expected `i32`, found struct `X`
+ | expected `i32`, found `X`
|
note: function defined here
--> $DIR/invalid_arguments.rs:9:4
--> $DIR/invalid_arguments.rs:42:3
|
LL | three_arg_repeat(X {}, X {}, X {});
- | ^^^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found struct `X`
+ | ^^^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found `X`
| | |
- | | expected `i32`, found struct `X`
- | expected `i32`, found struct `X`
+ | | expected `i32`, found `X`
+ | expected `i32`, found `X`
|
note: function defined here
--> $DIR/invalid_arguments.rs:9:4
--> $DIR/issue-100478.rs:36:5
|
LL | four_shuffle(T3::default(), T2::default(), T1::default(), T3::default());
- | ^^^^^^^^^^^^ ------------- ------------- ------------- expected struct `T4`, found struct `T3`
+ | ^^^^^^^^^^^^ ------------- ------------- ------------- expected `T4`, found `T3`
| | |
| | expected `T3`, found `T1`
| expected `T1`, found `T3`
| ^ - - - - - expected `C`, found `A`
| | | | |
| | | | expected `C`, found `A`
- | | | expected struct `B`, found struct `A`
+ | | | expected `B`, found `A`
| | expected `A`, found `C`
| expected `A`, found `C`
|
LL | foo(&&A, B, C, D, E, F, G);
| ^^^ - - - - argument of type `F` unexpected
| | | |
- | | | expected `&E`, found struct `E`
+ | | | expected `&E`, found `E`
| | argument of type `C` unexpected
| argument of type `B` unexpected
|
LL | three_args(1, X {});
| ^^^^^^^^^^---------
| | |
- | | expected `f32`, found struct `X`
+ | | expected `f32`, found `X`
| an argument of type `&str` is missing
|
note: function defined here
LL | three_args("", X {}, 1);
| ^^^^^^^^^^ -- ---- - expected `&str`, found `{integer}`
| | |
- | | expected `f32`, found struct `X`
+ | | expected `f32`, found `X`
| expected `i32`, found `&'static str`
|
note: function defined here
LL | foo(f, w);
| ^^^
|
-note: expected `i32`, found `u32`
+note: expected fn pointer, found fn item
--> $DIR/two-mismatch-notes.rs:10:9
|
LL | foo(f, w);
| ^
= note: expected fn pointer `fn(i32)`
found fn item `fn(u32) {f}`
-note: expected `i32`, found `isize`
+note: expected `Wrapper<i32>`, found `Wrapper<isize>`
--> $DIR/two-mismatch-notes.rs:10:12
|
LL | foo(f, w);
fn main() {
let _x: i32 = [1, 2, 3];
//~^ ERROR mismatched types
- //~| expected `i32`, found array
+ //~| expected `i32`, found `[{integer}; 3]`
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 `&[i32]`
}
--> $DIR/array-not-vector.rs:2:19
|
LL | let _x: i32 = [1, 2, 3];
- | --- ^^^^^^^^^ expected `i32`, found array `[{integer}; 3]`
+ | --- ^^^^^^^^^ expected `i32`, found `[{integer}; 3]`
| |
| expected due to this
--> $DIR/array-not-vector.rs:7:20
|
LL | let _y: &i32 = x;
- | ---- ^ expected `i32`, found slice `[i32]`
+ | ---- ^ expected `&i32`, found `&[i32]`
| |
| expected due to this
|
--> $DIR/slice-to-vec-comparison.rs:4:9
|
LL | a > b;
- | ^ expected array of 0 elements, found struct `Vec`
+ | ^ expected `&[_; 0]`, found `&Vec<u8>`
|
= note: expected reference `&[_; 0]`
found reference `&Vec<u8>`
--> $DIR/associated-const-generic-obligations.rs:14:17
|
LL | const FROM: &'static str = "foo";
- | ^^^^^^^^^^^^ expected associated type, found `&str`
+ | ^^^^^^^^^^^^ expected associated type, found `&'static str`
|
note: type in trait
--> $DIR/associated-const-generic-obligations.rs:10:17
--> $DIR/elision.rs:5:79
|
LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()> { x.next() }
- | ----------------------------- -------------- ^^^^^^^^ expected `&()`, found type parameter `impl Iterator<Item = &'_ ()>`
+ | ----------------------------- -------------- ^^^^^^^^ expected `Option<&()>`, found `Option<impl Iterator<Item = &'_ ()>>`
| | |
| | expected `Option<&'static ()>` because of return type
| this type parameter
LL | fn hello<F: for<'a> Iterator<Item: 'a>>() {
| - help: try adding a return type: `-> Incorrect`
LL | Incorrect
- | ^^^^^^^^^ expected `()`, found struct `Incorrect`
+ | ^^^^^^^^^ expected `()`, found `Incorrect`
error: aborting due to previous error
--> $DIR/associated-type-projection-from-supertrait.rs:27:23
|
LL | fn b() { dent(ModelT, Blue); }
- | ---- ^^^^ expected struct `Black`, found struct `Blue`
+ | ---- ^^^^ expected `Black`, found `Blue`
| |
| arguments to this function are incorrect
|
--> $DIR/associated-type-projection-from-supertrait.rs:28:23
|
LL | fn c() { dent(ModelU, Black); }
- | ---- ^^^^^ expected struct `Blue`, found struct `Black`
+ | ---- ^^^^^ expected `Blue`, found `Black`
| |
| arguments to this function are incorrect
|
--> $DIR/associated-type-projection-from-supertrait.rs:32:28
|
LL | fn f() { ModelT.chip_paint(Blue); }
- | ---------- ^^^^ expected struct `Black`, found struct `Blue`
+ | ---------- ^^^^ expected `Black`, found `Blue`
| |
| arguments to this method are incorrect
|
--> $DIR/associated-type-projection-from-supertrait.rs:33:28
|
LL | fn g() { ModelU.chip_paint(Black); }
- | ---------- ^^^^^ expected struct `Blue`, found struct `Black`
+ | ---------- ^^^^^ expected `Blue`, found `Black`
| |
| arguments to this method are incorrect
|
let _: Bar = x.boo();
//~^ ERROR mismatched types
//~| found associated type `<I as Foo>::A`
- //~| expected struct `Bar`, found associated type
+ //~| expected `Bar`, found
//~| expected struct `Bar`
}
--> $DIR/associated-types-eq-3.rs:23:18
|
LL | let _: Bar = x.boo();
- | --- ^^^^^^^ expected struct `Bar`, found associated type
+ | --- ^^^^^^^ expected `Bar`, found associated type
| |
| expected due to this
|
--> $DIR/async-block-control-flow-static-semantics.rs:49:44
|
LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
- | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
+ | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected `Result<u8, MyErr>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
--> $DIR/async-block-control-flow-static-semantics.rs:58:50
|
LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> {
- | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
+ | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected `Result<u8, MyErr>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
--> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
|
LL | async fn foo(&self) -> i32 {
- | ^^^ expected struct `Pin`, found opaque type
+ | ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found opaque type
|
note: type in trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
LL | Ok(())
| ^^^^^^- help: consider using a semicolon here: `;`
| |
- | expected `()`, found enum `Result`
+ | expected `()`, found `Result<(), _>`
|
= note: expected unit type `()`
found enum `Result<(), _>`
match tuple() { //~ HELP consider `await`ing on the `Future`
//~^ NOTE this expression has type `impl Future<Output = Tuple>`
Tuple(_) => {} //~ ERROR mismatched types
- //~^ NOTE expected opaque type, found struct `Tuple`
+ //~^ NOTE expected opaque type, found `Tuple`
//~| NOTE expected opaque type `impl Future<Output = Tuple>`
}
}
| ------- this expression has type `impl Future<Output = Tuple>`
LL |
LL | Tuple(_) => {}
- | ^^^^^^^^ expected opaque type, found struct `Tuple`
+ | ^^^^^^^^ expected opaque type, found `Tuple`
|
note: while checking the return type of the `async fn`
--> $DIR/issue-61076.rs:56:21
--> $DIR/issue-98634.rs:45:23
|
LL | StructAsync { callback }.await;
- | ^^^^^^^^ expected struct `Pin`, found opaque type
+ | ^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
|
note: while checking the return type of the `async fn`
--> $DIR/issue-98634.rs:24:21
--> $DIR/issue-98634.rs:45:9
|
LL | StructAsync { callback }.await;
- | ^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
|
note: while checking the return type of the `async fn`
--> $DIR/issue-98634.rs:24:21
--> $DIR/issue-98634.rs:45:33
|
LL | StructAsync { callback }.await;
- | ^^^^^^ expected struct `Pin`, found opaque type
+ | ^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
|
note: while checking the return type of the `async fn`
--> $DIR/issue-98634.rs:24:21
LL | std::mem::size_of_val(foo());
| --------------------- ^^^^^
| | |
- | | expected reference, found opaque type
+ | | expected `&_`, found opaque type
| | help: consider borrowing here: `&foo()`
| arguments to this function are incorrect
|
--> $DIR/proper-span-for-type-error.rs:8:5
|
LL | a().await
- | ^^^^^^^^^ expected enum `Result`, found `()`
+ | ^^^^^^^^^ expected `Result<(), i32>`, found `()`
|
= note: expected enum `Result<(), i32>`
found unit type `()`
| -------------- this expression has type `impl Future<Output = Result<(), ()>>`
...
LL | Ok(_) => {}
- | ^^^^^ expected opaque type, found enum `Result`
+ | ^^^^^ expected opaque type, found `Result<_, _>`
|
note: while checking the return type of the `async fn`
--> $DIR/suggest-missing-await.rs:57:28
| -------------- this expression has type `impl Future<Output = Result<(), ()>>`
...
LL | Err(_) => {}
- | ^^^^^^ expected opaque type, found enum `Result`
+ | ^^^^^^ expected opaque type, found `Result<_, _>`
|
note: while checking the return type of the `async fn`
--> $DIR/suggest-missing-await.rs:57:28
--> $DIR/issue-38940.rs:49:22
|
LL | let x: &Bottom = &t;
- | ------- ^^ expected struct `Bottom`, found struct `Top`
+ | ------- ^^ expected `&Bottom`, found `&Top`
| |
| expected due to this
|
LL | let bar = 5;
| ^^^ - this expression has type `{integer}`
| |
- | expected integer, found struct `bar`
+ | expected integer, found `bar`
| `bar` is interpreted as a unit struct, not a new binding
| help: introduce a new binding instead: `other_bar`
--> $DIR/consider-removing-last-semi.rs:3:15
|
LL | pub fn f() -> String {
- | - ^^^^^^ expected struct `String`, found `()`
+ | - ^^^^^^ expected `String`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
LL | 0u8;
--> $DIR/consider-removing-last-semi.rs:8:15
|
LL | pub fn g() -> String {
- | - ^^^^^^ expected struct `String`, found `()`
+ | - ^^^^^^ expected `String`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
LL | "this won't work".to_string();
--> $DIR/issue-13428.rs:3:13
|
LL | fn foo() -> String {
- | --- ^^^^^^ expected struct `String`, found `()`
+ | --- ^^^^^^ expected `String`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
--> $DIR/issue-13428.rs:11:13
|
LL | fn bar() -> String {
- | --- ^^^^^^ expected struct `String`, found `()`
+ | --- ^^^^^^ expected `String`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
LL | "foobar".to_string()
pub fn get_enum_struct_variant() -> () {
Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
//~^ ERROR mismatched types
- //~| expected `()`, found enum `Enum`
+ //~| expected `()`, found `Enum`
}
}
match enum_struct_variant {
a::Enum::EnumStructVariant { x, y, z } => {
//~^ ERROR mismatched types
- //~| expected `()`, found enum `Enum`
+ //~| expected `()`, found `Enum`
}
}
}
LL | pub fn get_enum_struct_variant() -> () {
| -- expected `()` because of return type
LL | Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Enum`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Enum`
error[E0308]: mismatched types
--> $DIR/issue-13624.rs:20:9
LL | match enum_struct_variant {
| ------------------- this expression has type `()`
LL | a::Enum::EnumStructVariant { x, y, z } => {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Enum`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Enum`
error: aborting due to 2 previous errors
| - expected `()` because of default return type
LL | let b = Bob + 3.5;
LL | b + 3
- | ^^^^^ expected `()`, found struct `Bob`
+ | ^^^^^ expected `()`, found `Bob`
error: aborting due to 2 previous errors
//~^ ERROR mismatched types
//~| expected unit type `()`
//~| found reference `&_`
- //~| expected `()`, found reference
+ //~| expected `()`, found `&_`
}
LL | fn main() {
| - expected `()` because of default return type
LL | &panic!()
- | ^^^^^^^^^ expected `()`, found reference
+ | ^^^^^^^^^ expected `()`, found `&_`
|
= note: expected unit type `()`
found reference `&_`
--> $DIR/issue-82446.rs:11:9
|
LL | val
- | ^^^ expected struct `Box`, found reference
+ | ^^^ expected `Box<dyn MyTrait>`, found `&Box<dyn MyTrait>`
|
= note: expected struct `Box<(dyn MyTrait + 'static)>`
found reference `&Box<(dyn MyTrait + 'static)>`
--> $DIR/issue-78720.rs:7:39
|
LL | fn map2<F>(self, f: F) -> Map2<F> {}
- | ^^ expected struct `Map2`, found `()`
+ | ^^ expected `Map2<F>`, found `()`
|
= note: expected struct `Map2<F>`
found unit type `()`
--> $DIR/coerce-block-tail-26978.rs:9:9
|
LL | f(&{x});
- | ^ expected `i32`, found struct `Box`
+ | ^ expected `i32`, found `Box<i32>`
|
= note: expected type `i32`
found struct `Box<i32>`
--> $DIR/coerce-block-tail-57749.rs:33:14
|
LL | reset(&{ Homura });
- | ^^^^^^ expected `u32`, found struct `Homura`
+ | ^^^^^^ expected `u32`, found `Homura`
|
help: consider dereferencing the type
|
--> $DIR/coerce-block-tail-83783.rs:7:32
|
LL | _consume_reference::<i32>(&async { Box::new(7_i32) }.await);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `Box`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `Box<i32>`
|
= note: expected type `i32`
found struct `Box<i32>`
--> $DIR/coerce-block-tail-83850.rs:5:7
|
LL | f(&Box::new([1, 2]));
- | - ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found struct `Box`
+ | - ^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&Box<[{integer}; 2]>`
| |
| arguments to this function are incorrect
|
--> $DIR/coerce-block-tail.rs:4:23
|
LL | let _: &i32 = & { Box::new(1i32) };
- | ^^^^^^^^^^^^^^ expected `i32`, found struct `Box`
+ | ^^^^^^^^^^^^^^ expected `i32`, found `Box<i32>`
|
= note: expected type `i32`
found struct `Box<i32>`
--> $DIR/coerce-expect-unsized-ascribed.rs:9:27
|
LL | let _ = type_ascribe!(box { [1, 2, 3] }, Box<[i32]>);
- | ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
+ | ^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
= note: expected struct `Box<[i32]>`
found struct `Box<[i32; 3]>`
--> $DIR/coerce-expect-unsized-ascribed.rs:10:27
|
LL | let _ = type_ascribe!(box if true { [1, 2, 3] } else { [1, 3, 4] }, Box<[i32]>);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
= note: expected struct `Box<[i32]>`
found struct `Box<[i32; 3]>`
--> $DIR/coerce-expect-unsized-ascribed.rs:11:27
|
LL | let _ = type_ascribe!(box match true { true => [1, 2, 3], false => [1, 3, 4] }, Box<[i32]>);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
= note: expected struct `Box<[i32]>`
found struct `Box<[i32; 3]>`
--> $DIR/coerce-expect-unsized-ascribed.rs:13:27
|
LL | let _ = type_ascribe!(box { |x| (x as u8) }, Box<dyn Fn(i32) -> _>);
- | ^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure
+ | ^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:13:33]>`
|
= note: expected struct `Box<dyn Fn(i32) -> u8>`
found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:33: 13:36]>`
--> $DIR/coerce-expect-unsized-ascribed.rs:14:27
|
LL | let _ = type_ascribe!(box if true { false } else { true }, Box<dyn Debug>);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Debug>`, found `Box<bool>`
|
= note: expected struct `Box<dyn Debug>`
found struct `Box<bool>`
--> $DIR/coerce-expect-unsized-ascribed.rs:15:27
|
LL | let _ = type_ascribe!(box match true { true => 'a', false => 'b' }, Box<dyn Debug>);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Debug>`, found `Box<char>`
|
= note: expected struct `Box<dyn Debug>`
found struct `Box<char>`
--> $DIR/coerce-expect-unsized-ascribed.rs:17:27
|
LL | let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]);
- | ^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
+ | ^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]`
|
= note: expected reference `&[i32]`
found reference `&[i32; 3]`
--> $DIR/coerce-expect-unsized-ascribed.rs:18:27
|
LL | let _ = type_ascribe!(&if true { [1, 2, 3] } else { [1, 3, 4] }, &[i32]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]`
|
= note: expected reference `&[i32]`
found reference `&[i32; 3]`
--> $DIR/coerce-expect-unsized-ascribed.rs:19:27
|
LL | let _ = type_ascribe!(&match true { true => [1, 2, 3], false => [1, 3, 4] }, &[i32]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]`
|
= note: expected reference `&[i32]`
found reference `&[i32; 3]`
--> $DIR/coerce-expect-unsized-ascribed.rs:21:27
|
LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _);
- | ^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure
+ | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&[closure@coerce-expect-unsized-ascribed.rs:21:30]`
|
= note: expected reference `&dyn Fn(i32) -> u8`
found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:30: 21:33]`
--> $DIR/coerce-expect-unsized-ascribed.rs:22:27
|
LL | let _ = type_ascribe!(&if true { false } else { true }, &dyn Debug);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Debug`, found `&bool`
|
= note: expected reference `&dyn Debug`
found reference `&bool`
--> $DIR/coerce-expect-unsized-ascribed.rs:23:27
|
LL | let _ = type_ascribe!(&match true { true => 'a', false => 'b' }, &dyn Debug);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Debug`, found `&char`
|
= note: expected reference `&dyn Debug`
found reference `&char`
--> $DIR/coerce-expect-unsized-ascribed.rs:25:27
|
LL | let _ = type_ascribe!(Box::new([1, 2, 3]), Box<[i32]>);
- | ^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
+ | ^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
= note: expected struct `Box<[i32]>`
found struct `Box<[i32; 3]>`
--> $DIR/coerce-expect-unsized-ascribed.rs:26:27
|
LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box<dyn Fn(i32) -> _>);
- | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure
+ | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:26:36]>`
|
= note: expected struct `Box<dyn Fn(i32) -> u8>`
found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:36: 26:39]>`
--> $DIR/coerce-to-bang.rs:50:21
|
LL | let x: [!; 2] = [return, 22];
- | ------ ^^^^^^^^^^^^ expected `!`, found integer
+ | ------ ^^^^^^^^^^^^ expected `[!; 2]`, found `[{integer}; 2]`
| |
| expected due to this
|
--> $DIR/coercion-missing-tail-expected-type.rs:8:13
|
LL | fn foo() -> Result<u8, u64> {
- | --- ^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
+ | --- ^^^^^^^^^^^^^^^ expected `Result<u8, u64>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
LL | Ok(1);
fn main() {
let _: &[i32] = [0];
//~^ ERROR mismatched types
- //~| expected `&[i32]`, found array `[{integer}; 1]`
+ //~| expected `&[i32]`, found `[{integer}; 1]`
}
LL | let _: &[i32] = [0];
| ------ ^^^
| | |
- | | expected `&[i32]`, found array `[{integer}; 1]`
+ | | expected `&[i32]`, found `[{integer}; 1]`
| | help: consider borrowing here: `&[0]`
| expected due to this
LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> {
| ^^^^
| |
- | expected struct `Pin`, found struct `MyFuture`
+ | expected `Pin<&mut MyFuture>`, found `MyFuture`
| help: change the self-receiver type to match the trait: `self: Pin<&mut MyFuture>`
|
= note: expected signature `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>`
LL | fn foo(self: Box<Self>) {}
| ------^^^^^^^^^
| | |
- | | expected struct `MyFuture`, found struct `Box`
+ | | expected `MyFuture`, found `Box<MyFuture>`
| help: change the self-receiver type to match the trait: `self`
|
note: type in trait
--> $DIR/bad-self-type.rs:24:18
|
LL | fn bar(self) {}
- | ^ expected enum `Option`, found `()`
+ | ^ expected `Option<()>`, found `()`
|
note: type in trait
--> $DIR/bad-self-type.rs:18:21
--> $DIR/mismatch.rs:7:26
|
LL | let e: Example<13> = ();
- | ----------- ^^ expected struct `Example`, found `()`
+ | ----------- ^^ expected `Example`, found `()`
| |
| expected due to this
|
--> $DIR/mismatch.rs:10:32
|
LL | let e: Example2<u32, 13> = ();
- | ----------------- ^^ expected struct `Example2`, found `()`
+ | ----------------- ^^ expected `Example2`, found `()`
| |
| expected due to this
|
--> $DIR/mismatch.rs:13:32
|
LL | let e: Example3<13, u32> = ();
- | ----------------- ^^ expected struct `Example3`, found `()`
+ | ----------------- ^^ expected `Example3`, found `()`
| |
| expected due to this
|
--> $DIR/mismatch.rs:16:26
|
LL | let e: Example3<7> = ();
- | ----------- ^^ expected struct `Example3`, found `()`
+ | ----------- ^^ expected `Example3<7>`, found `()`
| |
| expected due to this
|
--> $DIR/mismatch.rs:19:26
|
LL | let e: Example4<7> = ();
- | ----------- ^^ expected struct `Example4`, found `()`
+ | ----------- ^^ expected `Example4<7>`, found `()`
| |
| expected due to this
|
--> $DIR/issue-79518-default_trait_method_normalization.rs:16:32
|
LL | Self::AssocInstance == [(); std::mem::size_of::<Self::Assoc>()];
- | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found array `[(); std::mem::size_of::<Self::Assoc>()]`
+ | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `[(); std::mem::size_of::<Self::Assoc>()]`
| |
| expected because this is `<Self as Foo>::Assoc`
|
| - this type parameter
...
LL | let x: S = MaybeUninit::uninit();
- | - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found union `MaybeUninit`
+ | - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found `MaybeUninit<_>`
| |
| expected due to this
|
--> $DIR/type_mismatch.rs:5:26
|
LL | fn bar<const N: u8>() -> [u8; N] {}
- | --- ^^^^^^^ expected array `[u8; N]`, found `()`
+ | --- ^^^^^^^ expected `[u8; N]`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
--> $DIR/type_not_in_scope.rs:7:33
|
LL | fn getn<const N: cfg_attr>() -> [u8; N] {}
- | ---- ^^^^^^^ expected array `[u8; N]`, found `()`
+ | ---- ^^^^^^^ expected `[u8; N]`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
--> $DIR/types-mismatch-const-args.rs:16:41
|
LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
- | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
+ | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 2, 3>`, found `A<'_, u32, 2, 3>`
| |
| expected due to this
|
--> $DIR/types-mismatch-const-args.rs:18:41
|
LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
- | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
+ | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 4, 3>`, found `A<'_, u32, 2, 3>`
| |
| expected due to this
|
--> $DIR/types-mismatch-const-args.rs:16:41
|
LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
- | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
+ | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 2, 3>`, found `A<'_, u32, 2, 3>`
| |
| expected due to this
|
--> $DIR/types-mismatch-const-args.rs:18:41
|
LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
- | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
+ | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 4, 3>`, found `A<'_, u32, 2, 3>`
| |
| expected due to this
|
enum E {
V = CONSTANT,
//~^ ERROR mismatched types
- //~| expected `isize`, found struct `S`
+ //~| expected `isize`, found `S`
}
fn main() {}
--> $DIR/const-eval-span.rs:9:9
|
LL | V = CONSTANT,
- | ^^^^^^^^ expected `isize`, found struct `S`
+ | ^^^^^^^^ expected `isize`, found `S`
error: aborting due to previous error
const TUP: (usize,) = 5usize << 64;
//~^ ERROR mismatched types
-//~| expected tuple, found `usize`
+//~| expected `(usize,)`, found `usize`
const ARR: [i32; TUP.0] = [];
//~^ constant
--> $DIR/const-tup-index-span.rs:3:23
|
LL | const TUP: (usize,) = 5usize << 64;
- | ^^^^^^^^^^^^ expected tuple, found `usize`
+ | ^^^^^^^^^^^^ expected `(usize,)`, found `usize`
|
= note: expected tuple `(usize,)`
found type `usize`
--> $DIR/nested_erroneous_ctfe.rs:2:16
|
LL | [9; || [9; []]];
- | ^^ expected `usize`, found array of 0 elements
+ | ^^ expected `usize`, found `[_; 0]`
|
= note: expected type `usize`
found array `[_; 0]`
--> $DIR/cross-borrow-trait.rs:10:26
|
LL | let _y: &dyn Trait = x;
- | ---------- ^ expected `&dyn Trait`, found struct `Box`
+ | ---------- ^ expected `&dyn Trait`, found `Box<dyn Trait>`
| |
| expected due to this
|
LL | match String::new() {
| ------------- this expression has type `String`
LL | "" | _ => {}
- | ^^ expected struct `String`, found `&str`
+ | ^^ expected `String`, found `&str`
error: aborting due to previous error
LL | let &&x = &1isize as &dyn T;
| ^^ ----------------- this expression has type `&dyn T`
| |
- | expected trait object `dyn T`, found reference
+ | expected `dyn T`, found `&_`
|
= note: expected trait object `dyn T`
found reference `&_`
LL | let &&&x = &(&1isize as &dyn T);
| ^^ -------------------- this expression has type `&&dyn T`
| |
- | expected trait object `dyn T`, found reference
+ | expected `dyn T`, found `&_`
|
= note: expected trait object `dyn T`
found reference `&_`
LL | let box box x = Box::new(1isize) as Box<dyn T>;
| ^^^^^ ------------------------------ this expression has type `Box<dyn T>`
| |
- | expected trait object `dyn T`, found struct `Box`
+ | expected `dyn T`, found `Box<_>`
|
= note: expected trait object `dyn T`
found struct `Box<_>`
LL | (x, y) = &(1, 2);
| ^^^^^^ ------- this expression has type `&({integer}, {integer})`
| |
- | expected reference, found tuple
+ | expected `&({integer}, {integer})`, found `(_, _)`
|
= note: expected reference `&({integer}, {integer})`
found tuple `(_, _)`
LL | | Ok("")
LL | | ))))))))))))))))))))))))))))))
LL | | ))))))))))))))))))))))))))))));
- | |__________________________________^ expected struct `Atype`, found enum `Result`
+ | |__________________________________^ expected `Atype<Btype<..., ...>, ...>`, found `Result<Result<..., ...>, ...>`
|
= note: expected struct `Atype<Btype<..., ...>, ...>`
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
LL | | ))))))))))))))))))))))))))))))
LL | | ))))))))))))))))))))))));
- | |____________________________^ expected enum `Option`, found enum `Result`
+ | |____________________________^ expected `Option<Result<..., ...>>`, found `Result<Result<..., ...>, ...>`
|
= note: expected enum `Option<Result<..., ...>>`
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
... |
LL | | i32
LL | | > = ();
- | | - ^^ expected struct `Atype`, found `()`
+ | | - ^^ expected `Atype<Btype<..., ...>, ...>`, found `()`
| |_____|
| expected due to this
|
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
LL | | ))))))))))))))))))))))))))))))
LL | | ))))))))))))))))))))))));
- | |____________________________^ expected `()`, found enum `Result`
+ | |____________________________^ expected `()`, found `Result<Result<..., ...>, ...>`
|
= note: expected unit type `()`
found enum `Result<Result<..., ...>, ...>`
--> $DIR/brackets-to-braces-single-element.rs:1:24
|
LL | const A: [&str; 1] = { "hello" };
- | ^^^^^^^ expected array `[&'static str; 1]`, found `&str`
+ | ^^^^^^^ expected `[&str; 1]`, found `&str`
|
help: to create an array, use square brackets instead of curly braces
|
--> $DIR/brackets-to-braces-single-element.rs:4:19
|
LL | const B: &[u32] = &{ 1 };
- | ^^^^^^ expected slice `[u32]`, found integer
+ | ^^^^^^ expected `&[u32]`, found `&{integer}`
|
= note: expected reference `&'static [u32]`
found reference `&{integer}`
--> $DIR/brackets-to-braces-single-element.rs:7:27
|
LL | const C: &&[u32; 1] = &&{ 1 };
- | ^ expected array `[u32; 1]`, found integer
+ | ^ expected `[u32; 1]`, found integer
|
help: to create an array, use square brackets instead of curly braces
|
LL | match f {
| - this expression has type `Foo`
LL | Bar { x } => {
- | ^^^^^^^^^ expected enum `Foo`, found struct `Bar`
+ | ^^^^^^^^^ expected `Foo`, found `Bar`
|
help: try wrapping the pattern in `Foo::Bar`
|
LL | S => {
| ^
| |
- | expected enum `Option`, found struct `S`
+ | expected `Option<S>`, found `S`
| `S` is interpreted as a unit struct, not a new binding
|
= note: expected enum `Option<S>`
LL | S => {
| ^
| |
- | expected enum `Result`, found struct `S`
+ | expected `Result<S, S>`, found `S`
| `S` is interpreted as a unit struct, not a new binding
|
= note: expected enum `Result<S, S>`
LL | |
LL | | f();
LL | | }
- | |_____^ expected enum `Option`, found `()`
+ | |_____^ expected `Option<()>`, found `()`
|
= note: expected enum `Option<()>`
found unit type `()`
LL | fn b() -> Result<(), ()> {
| -------------- expected `Result<(), ()>` because of return type
LL | f()
- | ^^^ expected enum `Result`, found `()`
+ | ^^^ expected `Result<(), ()>`, found `()`
|
= note: expected enum `Result<(), ()>`
found unit type `()`
LL | |
LL | | f();
LL | | }
- | |_____^ expected enum `Option`, found `()`
+ | |_____^ expected `Option<()>`, found `()`
|
= note: expected enum `Option<()>`
found unit type `()`
--> $DIR/compatible-variants.rs:35:5
|
LL | c()?
- | ^^^^ expected enum `Option`, found `()`
+ | ^^^^ expected `Option<()>`, found `()`
|
= note: `?` operator cannot convert from `()` to `Option<()>`
= note: expected enum `Option<()>`
--> $DIR/compatible-variants.rs:42:25
|
LL | let _: Option<()> = while false {};
- | ---------- ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
+ | ---------- ^^^^^^^^^^^^^^ expected `Option<()>`, found `()`
| |
| expected due to this
|
--> $DIR/compatible-variants.rs:46:9
|
LL | while false {}
- | ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
+ | ^^^^^^^^^^^^^^ expected `Option<()>`, found `()`
|
= note: expected enum `Option<()>`
found unit type `()`
--> $DIR/compatible-variants.rs:50:31
|
LL | let _: Result<i32, i32> = 1;
- | ---------------- ^ expected enum `Result`, found integer
+ | ---------------- ^ expected `Result<i32, i32>`, found integer
| |
| expected due to this
|
--> $DIR/compatible-variants.rs:53:26
|
LL | let _: Option<i32> = 1;
- | ----------- ^ expected enum `Option`, found integer
+ | ----------- ^ expected `Option<i32>`, found integer
| |
| expected due to this
|
--> $DIR/compatible-variants.rs:56:28
|
LL | let _: Hey<i32, i32> = 1;
- | ------------- ^ expected enum `Hey`, found integer
+ | ------------- ^ expected `Hey<i32, i32>`, found integer
| |
| expected due to this
|
--> $DIR/compatible-variants.rs:59:29
|
LL | let _: Hey<i32, bool> = false;
- | -------------- ^^^^^ expected enum `Hey`, found `bool`
+ | -------------- ^^^^^ expected `Hey<i32, bool>`, found `bool`
| |
| expected due to this
|
--> $DIR/compatible-variants.rs:63:19
|
LL | let _ = Foo { bar };
- | ^^^ expected enum `Option`, found `i32`
+ | ^^^ expected `Option<i32>`, found `i32`
|
= note: expected enum `Option<i32>`
found type `i32`
--> $DIR/compatible-variants.rs:80:16
|
LL | let a: A = B::Fst;
- | - ^^^^^^ expected enum `A`, found enum `B`
+ | - ^^^^^^ expected `A`, found `B`
| |
| expected due to this
|
--> $DIR/compatible-variants.rs:86:17
|
LL | let a: A2 = B::Fst;
- | -- ^^^^^^ expected struct `A2`, found enum `B`
+ | -- ^^^^^^ expected `A2`, found `B`
| |
| expected due to this
|
--> $DIR/issue-42764.rs:11:43
|
LL | this_function_expects_a_double_option(n);
- | ------------------------------------- ^ expected enum `DoubleOption`, found `usize`
+ | ------------------------------------- ^ expected `DoubleOption<_>`, found `usize`
| |
| arguments to this function are incorrect
|
--> $DIR/issue-42764.rs:27:33
|
LL | let _c = Context { wrapper: Payload{} };
- | ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload`
+ | ^^^^^^^^^ expected `Wrapper`, found `Payload`
|
help: try wrapping the expression in `Wrapper`
|
--> $DIR/recursion_limit_deref.rs:51:22
|
LL | let x: &Bottom = &t;
- | ------- ^^ expected struct `Bottom`, found struct `Top`
+ | ------- ^^ expected `&Bottom`, found `&Top`
| |
| expected due to this
|
--> $DIR/disambiguate-identical-names.rs:13:10
|
LL | test(&v);
- | ---- ^^ expected struct `Vec`, found struct `HashMap`
+ | ---- ^^ expected `&Vec<Vec<u32>>`, found `&HashMap<u8, u8>`
| |
| arguments to this function are incorrect
|
| - expected `!` because of return type
LL | unsafe {
LL | ::std::mem::transmute::<f64, [u8; 8]>(panic!())
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found array `[u8; 8]`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found `[u8; 8]`
|
= note: expected type `!`
found array `[u8; 8]`
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
f5.2 = Bar1 {f: 36};
//~^ ERROR mismatched types
- //~| expected trait object `dyn ToBar`, found struct `Bar1`
+ //~| expected `dyn ToBar`, found `Bar1`
//~| expected trait object `dyn ToBar`
//~| found struct `Bar1`
//~| ERROR the size for values of type
--> $DIR/dst-bad-assign-3.rs:33:12
|
LL | f5.2 = Bar1 {f: 36};
- | ---- ^^^^^^^^^^^^ expected trait object `dyn ToBar`, found struct `Bar1`
+ | ---- ^^^^^^^^^^^^ expected `dyn ToBar`, found `Bar1`
| |
| expected due to the type of this binding
|
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
f5.ptr = Bar1 {f: 36};
//~^ ERROR mismatched types
- //~| expected trait object `dyn ToBar`, found struct `Bar1`
+ //~| expected `dyn ToBar`, found `Bar1`
//~| expected trait object `dyn ToBar`
//~| found struct `Bar1`
//~| ERROR the size for values of type
--> $DIR/dst-bad-assign.rs:35:14
|
LL | f5.ptr = Bar1 {f: 36};
- | ------ ^^^^^^^^^^^^ expected trait object `dyn ToBar`, found struct `Bar1`
+ | ------ ^^^^^^^^^^^^ expected `dyn ToBar`, found `Bar1`
| |
| expected due to the type of this binding
|
--> $DIR/dst-bad-coerce1.rs:16:29
|
LL | let f3: &Fat<[usize]> = f2;
- | ------------- ^^ expected slice `[usize]`, found array `[isize; 3]`
+ | ------------- ^^ expected `&Fat<[usize]>`, found `&Fat<[isize; 3]>`
| |
| expected due to this
|
--> $DIR/dst-bad-coerce1.rs:28:27
|
LL | let f3: &([usize],) = f2;
- | ----------- ^^ expected slice `[usize]`, found array `[isize; 3]`
+ | ----------- ^^ expected `&([usize],)`, found `&([isize; 3],)`
| |
| expected due to this
|
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 `&Fat<[isize; 3]>`, found `&Fat<[isize]>`
//~| expected reference `&Fat<[isize; 3]>`
//~| found reference `&Fat<[isize]>`
let f1: &([isize],) = &([1, 2, 3],);
let f2: &([isize; 3],) = f1;
//~^ ERROR mismatched types
- //~| expected array `[isize; 3]`, found slice `[isize]`
+ //~| expected `&([isize; 3],)`, found `&([isize],)`
//~| expected reference `&([isize; 3],)`
//~| found reference `&([isize],)`
}
--> $DIR/dst-bad-coerce4.rs:12:32
|
LL | let f2: &Fat<[isize; 3]> = f1;
- | ---------------- ^^ expected array `[isize; 3]`, found slice `[isize]`
+ | ---------------- ^^ expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>`
| |
| expected due to this
|
--> $DIR/dst-bad-coerce4.rs:20:30
|
LL | let f2: &([isize; 3],) = f1;
- | -------------- ^^ expected array `[isize; 3]`, found slice `[isize]`
+ | -------------- ^^ expected `&([isize; 3],)`, found `&([isize],)`
| |
| expected due to this
|
--> $DIR/no-implicit-dyn-star.rs:6:48
|
LL | dyn_star_foreign::require_dyn_star_display(1usize);
- | ------------------------------------------ ^^^^^^ expected trait object `dyn Display`, found `usize`
+ | ------------------------------------------ ^^^^^^ expected `dyn Display`, found `usize`
| |
| arguments to this function are incorrect
|
LL | let empty_struct::XEmpty2 = ();
| ^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()`
| |
- | expected `()`, found struct `XEmpty2`
+ | expected `()`, found `XEmpty2`
error[E0308]: mismatched types
--> $DIR/issue-37026.rs:7:9
LL | let empty_struct::XEmpty6(..) = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()`
| |
- | expected `()`, found struct `XEmpty6`
+ | expected `()`, found `XEmpty6`
error: aborting due to 2 previous errors
fn main() {
let u = FooAlias { value: 0 };
- //~^ ERROR expected struct, variant or union type, found enum `Foo` [E0071]
+ //~^ ERROR expected struct, variant or union type, found `Foo` [E0071]
}
-error[E0071]: expected struct, variant or union type, found enum `Foo`
+error[E0071]: expected struct, variant or union type, found `Foo`
--> $DIR/E0071.rs:5:13
|
LL | let u = FooAlias { value: 0 };
LL | fn foo(r: &A) -> &B {
| -- expected `&B` because of return type
LL | r
- | ^ expected extern type `B`, found extern type `A`
+ | ^ expected `&B`, found `&A`
|
= note: expected reference `&B`
found reference `&A`
LL | println!("{} {:.*} {}", 1, 3.2, 4);
| ^^^
| |
- | expected `usize`, found floating-point number
+ | expected `&usize`, found `&{float}`
| arguments to this function are incorrect
|
= note: expected reference `&usize`
LL | println!("{} {:07$.*} {}", 1, 3.2, 4);
| ^^^
| |
- | expected `usize`, found floating-point number
+ | expected `&usize`, found `&{float}`
| arguments to this function are incorrect
|
= note: expected reference `&usize`
eq(bar::<String>, bar::<Vec<u8>>);
//~^ ERROR mismatched types
//~| found fn item `fn(_) -> _ {bar::<Vec<u8>>}`
- //~| expected struct `String`, found struct `Vec`
- //~| different fn items have unique types, even if their signatures are the same
+ //~| expected `String`, found `Vec<u8>`
// Make sure we distinguish between trait methods correctly.
eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
--> $DIR/fn-item-type.rs:34:23
|
LL | eq(bar::<String>, bar::<Vec<u8>>);
- | -- ^^^^^^^^^^^^^^ expected struct `String`, found struct `Vec`
+ | -- ^^^^^^^^^^^^^^ expected `String`, found `Vec<u8>`
| |
| arguments to this function are incorrect
|
= help: consider casting both fn items to fn pointers using `as fn(isize) -> isize`
error[E0308]: mismatched types
- --> $DIR/fn-item-type.rs:41:26
+ --> $DIR/fn-item-type.rs:40:26
|
LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
| -- ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
= help: consider casting both fn items to fn pointers using `as fn()`
error[E0308]: mismatched types
- --> $DIR/fn-item-type.rs:46:19
+ --> $DIR/fn-item-type.rs:45:19
|
LL | eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found fn pointer
--> $DIR/fn-pointer-mismatch.rs:11:43
|
LL | let g = if n % 2 == 0 { &foo } else { &bar };
- | ---- ^^^^ expected fn item, found a different fn item
+ | ---- ^^^^ expected `&fn(u32) -> u32 {foo}`, found `&fn(u32) -> u32 {bar}`
| |
| expected because of this
|
LL | let c: fn(u32) -> u32 = &foo;
| -------------- ^^^^
| | |
- | | expected fn pointer, found reference
+ | | expected fn pointer, found `&fn(u32) -> u32 {foo}`
| | help: consider removing the reference: `foo`
| expected due to this
|
LL | let e: &fn(u32) -> u32 = &foo;
| --------------- ^^^^
| | |
- | | expected fn pointer, found fn item
+ | | expected `&fn(u32) -> u32`, found `&fn(u32) -> u32 {foo}`
| | help: consider casting to a fn pointer: `&(foo as fn(u32) -> u32)`
| expected due to this
|
--> $DIR/fn-trait-formatting.rs:6:17
|
LL | let _: () = Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>;
- | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
+ | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box<dyn FnOnce(isize)>`
| |
| expected due to this
|
--> $DIR/fn-trait-formatting.rs:10:17
|
LL | let _: () = Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
- | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
+ | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box<dyn Fn(isize, isize)>`
| |
| expected due to this
|
--> $DIR/fn-trait-formatting.rs:14:17
|
LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
- | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
+ | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box<dyn FnMut() -> isize>`
| |
| expected due to this
|
fn main() {
needs_ptr(foo);
//~^ ERROR mismatched types
- //~| NOTE expected `u32`, found `i32`
+ //~| NOTE expected fn pointer, found fn item
//~| NOTE expected fn pointer `fn(i32, u32)`
//~| NOTE arguments to this function are incorrect
}
--> $DIR/signature-error-reporting-under-verbose.rs:10:15
|
LL | needs_ptr(foo);
- | --------- ^^^ expected `u32`, found `i32`
+ | --------- ^^^ expected fn pointer, found fn item
| |
| arguments to this function are incorrect
|
x = 5;
//~^ ERROR mismatched types
//~| NOTE expected enum `Option<usize>`
- //~| NOTE expected enum `Option`, found integer
+ //~| NOTE expected `Option<usize>`, found integer
}
LL | Option<usize>;
| ------------- expected due to this type
LL | x = 5;
- | ^ expected enum `Option`, found integer
+ | ^ expected `Option<usize>`, found integer
|
= note: expected enum `Option<usize>`
found type `{integer}`
fn bar(x: x::Foo) -> y::Foo {
return x;
//~^ ERROR mismatched types
- //~| expected enum `y::Foo`, found enum `x::Foo`
+ //~| expected `y::Foo`, found `x::Foo`
}
fn main() {
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`
+ | ^ expected `y::Foo`, found `x::Foo`
|
- = note: enum `x::Foo` and enum `y::Foo` have similar names, but are actually distinct types
-note: enum `x::Foo` is defined in module `crate::x` of the current crate
+ = note: `x::Foo` and `y::Foo` have similar names, but are actually distinct types
+note: `x::Foo` is defined in module `crate::x` of the current crate
--> $DIR/fully-qualified-type-name2.rs:4:5
|
LL | pub enum Foo { }
| ^^^^^^^^^^^^
-note: enum `y::Foo` is defined in module `crate::y` of the current crate
+note: `y::Foo` is defined in module `crate::y` of the current crate
--> $DIR/fully-qualified-type-name2.rs:8:5
|
LL | pub enum Foo { }
//~^ ERROR mismatched types
//~| expected enum `Option<usize>`
//~| found type `usize`
- //~| expected enum `Option`, found `usize`
+ //~| expected `Option<usize>`, found `usize`
}
fn main() {
LL | fn bar(x: usize) -> Option<usize> {
| ------------- expected `Option<usize>` because of return type
LL | return x;
- | ^ expected enum `Option`, found `usize`
+ | ^ expected `Option<usize>`, found `usize`
|
= note: expected enum `Option<usize>`
found type `usize`
--> $DIR/type-mismatch-signature-deduction.rs:14:9
|
LL | 5
- | ^ expected enum `Result`, found integer
+ | ^ expected `Result<{integer}, _>`, found integer
|
= note: expected enum `Result<{integer}, _>`
found type `{integer}`
--> $DIR/type-mismatch-signature-deduction.rs:5:13
|
LL | fn foo() -> impl Generator<Return = i32> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result<{integer}, _>`, found `i32`
|
= note: expected enum `Result<{integer}, _>`
found type `i32`
--> $DIR/constraint-assoc-type-suggestion.rs:10:23
|
LL | let b: Vec<i32> = a;
- | -------- ^ expected struct `Vec`, found associated type
+ | -------- ^ expected `Vec<i32>`, found associated type
| |
| expected due to this
|
// Ensure that the printed type doesn't include the default type params...
let _: Foo<isize> = ();
//~^ ERROR mismatched types
- //~| expected struct `Foo`, found `()`
+ //~| expected `Foo<isize>`, 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 `Foo<isize>`, 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 `HashMap<String, isize>`, found `()`
//~| expected struct `HashMap<String, isize>`
//~| found unit type `()`
let _: HashMap<String, isize, Hash<String>> = ();
//~^ ERROR mismatched types
- //~| expected struct `HashMap`, found `()`
+ //~| expected `HashMap<String, isize>`, found `()`
//~| expected struct `HashMap<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 `Foo<A, isize>`, 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 `Foo`, found `()`
//~| expected struct `Foo`
//~| found unit type `()`
}
--> $DIR/generic-type-params-name-repr.rs:13:25
|
LL | let _: Foo<isize> = ();
- | ---------- ^^ expected struct `Foo`, found `()`
+ | ---------- ^^ expected `Foo<isize>`, found `()`
| |
| expected due to this
|
--> $DIR/generic-type-params-name-repr.rs:20:31
|
LL | let _: Foo<isize, B, C> = ();
- | ---------------- ^^ expected struct `Foo`, found `()`
+ | ---------------- ^^ expected `Foo<isize>`, found `()`
| |
| expected due to this
|
--> $DIR/generic-type-params-name-repr.rs:27:37
|
LL | let _: HashMap<String, isize> = ();
- | ---------------------- ^^ expected struct `HashMap`, found `()`
+ | ---------------------- ^^ expected `HashMap<String, isize>`, found `()`
| |
| expected due to this
|
--> $DIR/generic-type-params-name-repr.rs:32:51
|
LL | let _: HashMap<String, isize, Hash<String>> = ();
- | ------------------------------------ ^^ expected struct `HashMap`, found `()`
+ | ------------------------------------ ^^ expected `HashMap<String, isize>`, found `()`
| |
| expected due to this
|
--> $DIR/generic-type-params-name-repr.rs:39:31
|
LL | let _: Foo<A, isize, C> = ();
- | ---------------- ^^ expected struct `Foo`, found `()`
+ | ---------------- ^^ expected `Foo<A, isize>`, found `()`
| |
| expected due to this
|
--> $DIR/generic-type-params-name-repr.rs:46:27
|
LL | let _: Foo<A, B, C> = ();
- | ------------ ^^ expected struct `Foo`, found `()`
+ | ------------ ^^ expected `Foo`, found `()`
| |
| expected due to this
|
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [_, 99.., _] => {},
- | ^^ expected struct `Range`, found integer
+ | ^^ expected `Range<{integer}>`, found integer
|
= note: expected struct `std::ops::Range<{integer}>`
found type `{integer}`
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [_, 99..] => {},
- | ^^ expected struct `Range`, found integer
+ | ^^ expected `Range<{integer}>`, found integer
|
= note: expected struct `std::ops::Range<{integer}>`
found type `{integer}`
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [..9, 99..100, _] => {},
- | ^ expected struct `Range`, found integer
+ | ^ expected `Range<{integer}>`, found integer
|
= note: expected struct `std::ops::Range<{integer}>`
found type `{integer}`
LL | [..9, 99..100, _] => {},
| ^^ --- this is of type `{integer}`
| |
- | expected struct `Range`, found integer
+ | expected `Range<{integer}>`, found integer
|
= note: expected struct `std::ops::Range<{integer}>`
found type `{integer}`
LL | match [5..4, 99..105, 43..44] {
| ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]`
LL | [..9, 99..100, _] => {},
- | -- ^^^ expected struct `Range`, found integer
+ | -- ^^^ expected `Range<{integer}>`, found integer
| |
| this is of type `{integer}`
|
LL | match (0, 1) {
| ------ this expression has type `({integer}, {integer})`
LL | (PAT ..) => {}
- | ^^^ expected tuple, found `u8`
+ | ^^^ expected `({integer}, {integer})`, found `u8`
|
= note: expected tuple `({integer}, {integer})`
found type `u8`
LL | | ) {
| |_- expected `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn Fn(u32) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))` because of return type
LL | f
- | ^ expected reference, found `u32`
+ | ^ expected `&dyn for<'a> Fn(&'a ...)`, found `&dyn Fn(u32)`
|
= note: expected reference `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a ...) + 'a)) + 'a)) + 'a))`
the full type name has been written to '$TEST_BUILD_DIR/higher-rank-trait-bounds/hang-on-deeply-nested-dyn/hang-on-deeply-nested-dyn.long-type-hash.txt'
... |
LL | | },
LL | | },
- | |_________^ expected struct `Unit3`, found struct `Unit4`
+ | |_________^ expected `Unit3`, found `Unit4`
|
note: required for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]>` to implement `for<'r> T0<'r, (&'r u8,)>`
--> $DIR/issue-62203-hrtb-ice.rs:17:16
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:7:35
|
LL | fn fuz() -> (usize, Trait) { (42, Struct) }
- | ^^^^^^ expected trait object `dyn Trait`, found struct `Struct`
+ | ^^^^^^ expected `dyn Trait`, found `Struct`
|
= note: expected trait object `(dyn Trait + 'static)`
found struct `Struct`
--> $DIR/dyn-trait-return-should-be-impl-trait.rs:10:39
|
LL | fn bar() -> (usize, dyn Trait) { (42, Struct) }
- | ^^^^^^ expected trait object `dyn Trait`, found struct `Struct`
+ | ^^^^^^ expected `dyn Trait`, found `Struct`
|
= note: expected trait object `(dyn Trait + 'static)`
found struct `Struct`
| | ------ expected because of this
LL | | } else {
LL | | 42
- | | ^^ expected struct `Struct`, found integer
+ | | ^^ expected `Struct`, found integer
LL | | }
| |_____- `if` and `else` have incompatible types
| -------------- expected `Box<(dyn Trait + 'static)>` because of return type
LL | if true {
LL | return Struct;
- | ^^^^^^ expected struct `Box`, found struct `Struct`
+ | ^^^^^^ expected `Box<dyn Trait>`, found `Struct`
|
= note: expected struct `Box<(dyn Trait + 'static)>`
found struct `Struct`
| -------------- expected `Box<(dyn Trait + 'static)>` because of return type
...
LL | 42
- | ^^ expected struct `Box`, found integer
+ | ^^ expected `Box<dyn Trait>`, found integer
|
= note: expected struct `Box<(dyn Trait + 'static)>`
found type `{integer}`
| -------------- expected `Box<(dyn Trait + 'static)>` because of return type
LL | if true {
LL | return 0;
- | ^ expected struct `Box`, found integer
+ | ^ expected `Box<dyn Trait>`, found integer
|
= note: expected struct `Box<(dyn Trait + 'static)>`
found type `{integer}`
| -------------- expected `Box<(dyn Trait + 'static)>` because of return type
...
LL | 42
- | ^^ expected struct `Box`, found integer
+ | ^^ expected `Box<dyn Trait>`, found integer
|
= note: expected struct `Box<(dyn Trait + 'static)>`
found type `{integer}`
| -------------- expected `Box<(dyn Trait + 'static)>` because of return type
LL | if true {
LL | Struct
- | ^^^^^^ expected struct `Box`, found struct `Struct`
+ | ^^^^^^ expected `Box<dyn Trait>`, found `Struct`
|
= note: expected struct `Box<(dyn Trait + 'static)>`
found struct `Struct`
| -------------- expected `Box<(dyn Trait + 'static)>` because of return type
...
LL | 42
- | ^^ expected struct `Box`, found integer
+ | ^^ expected `Box<dyn Trait>`, found integer
|
= note: expected struct `Box<(dyn Trait + 'static)>`
found type `{integer}`
| -------------- expected `Box<(dyn Trait + 'static)>` because of return type
LL | if true {
LL | 0
- | ^ expected struct `Box`, found integer
+ | ^ expected `Box<dyn Trait>`, found integer
|
= note: expected struct `Box<(dyn Trait + 'static)>`
found type `{integer}`
| -------------- expected `Box<(dyn Trait + 'static)>` because of return type
...
LL | 42
- | ^^ expected struct `Box`, found integer
+ | ^^ expected `Box<dyn Trait>`, found integer
|
= note: expected struct `Box<(dyn Trait + 'static)>`
found type `{integer}`
LL | fn bar() -> i32 { 0 }
| ^^^
| |
- | expected struct `Wrapper`, found `i32`
+ | expected `Wrapper<_>`, found `i32`
| return type in trait
|
= note: expected struct `Wrapper<_>`
LL | 42
| ^^- help: try using a conversion method: `.to_string()`
| |
- | expected struct `String`, found integer
+ | expected `String`, found integer
error: aborting due to previous error
--> $DIR/default-body-type-err.rs:7:22
|
LL | fn lol(&self) -> impl Deref<Target = String> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String`
LL |
LL | &1i32
| ----- return type was inferred to be `&i32` here
--> $DIR/issue-102605.rs:13:20
|
LL | convert_result(foo())
- | -------------- ^^^^^ expected enum `Result`, found opaque type
+ | -------------- ^^^^^ expected `Result<(), _>`, found opaque type
| |
| arguments to this function are incorrect
|
--> $DIR/issue-99914.rs:9:27
|
LL | t.and_then(|t| -> _ { bar(t) });
- | ^^^^^^ expected enum `Result`, found opaque type
+ | ^^^^^^ expected `Result<_, Error>`, found opaque type
|
note: while checking the return type of the `async fn`
--> $DIR/issue-99914.rs:13:23
| | arguments to this struct are incorrect
LL | | 3
LL | | })
- | |_____^ expected closure, found a different closure
+ | |_____^ expected opaque type, found closure
|
= note: expected opaque type `Closure`
found closure `[closure@$DIR/issue-74282.rs:8:15: 8:17]`
LL | | })
| | ^- help: consider using a semicolon here: `;`
| |______|
- | expected `()`, found struct `Anonymous`
+ | expected `()`, found `Anonymous`
error: aborting due to 2 previous errors
| ------------------ expected `A` because of return type
...
LL | B
- | ^ expected struct `A`, found struct `B`
+ | ^ expected `A`, found `B`
error[E0308]: mismatched types
--> $DIR/object-unsafe-trait-in-return-position-impl-trait.rs:43:5
| --------------- expected `A` because of return type
...
LL | B
- | ^ expected struct `A`, found struct `B`
+ | ^ expected `A`, found `B`
error: aborting due to 2 previous errors
LL | fn eq(&self, _other: &(Foo, i32)) -> bool {
| ^^^^^^^^^^^
| |
- | expected struct `Bar`, found opaque type
+ | expected `a::Bar`, found opaque type
| help: change the parameter type to match the trait: `&(a::Bar, i32)`
|
= note: expected signature `fn(&a::Bar, &(a::Bar, i32)) -> _`
LL | fn eq(&self, _other: &(Bar, i32)) -> bool {
| ^^^^^^^^^^^
| |
- | expected opaque type, found struct `Bar`
+ | expected opaque type, found `b::Bar`
| help: change the parameter type to match the trait: `&(b::Foo, i32)`
|
= note: expected signature `fn(&b::Bar, &(b::Foo, i32)) -> _`
| |
| this type parameter
LL | x
- | ^ expected struct `String`, found type parameter `impl Debug`
+ | ^ expected `String`, found type parameter `impl Debug`
|
= note: expected struct `String`
found type parameter `impl Debug`
--> $DIR/mismatched-types.rs:2:20
|
LL | let b: &[u8] = include_str!("file.txt");
- | ----- ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found `str`
+ | ----- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[u8]`, found `&str`
| |
| expected due to this
|
--> $DIR/mismatched-types.rs:3:19
|
LL | let s: &str = include_bytes!("file.txt");
- | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `str`, found array `[u8; 0]`
+ | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&str`, found `&[u8; 0]`
| |
| expected due to this
|
LL | foo(s);
| --- ^- help: try using a conversion method: `.to_string()`
| | |
- | | expected struct `String`, found `&String`
+ | | expected `String`, found `&String`
| arguments to this function are incorrect
|
note: function defined here
--> $DIR/deref-suggestion.rs:30:9
|
LL | foo(&"aaa".to_owned());
- | --- ^^^^^^^^^^^^^^^^^ expected struct `String`, found `&String`
+ | --- ^^^^^^^^^^^^^^^^^ expected `String`, found `&String`
| |
| arguments to this function are incorrect
|
--> $DIR/deref-suggestion.rs:32:9
|
LL | foo(&mut "aaa".to_owned());
- | --- ^^^^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&mut String`
+ | --- ^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `&mut String`
| |
| arguments to this function are incorrect
|
--> $DIR/issue-100605.rs:4:18
|
LL | takes_option(&None);
- | ------------ ^^^^^ expected enum `Option`, found `&Option<_>`
+ | ------------ ^^^^^ expected `Option<&String>`, found `&Option<_>`
| |
| arguments to this function are incorrect
|
LL | takes_option(&res);
| ------------ ^^^^
| | |
- | | expected enum `Option`, found `&Option<String>`
+ | | expected `Option<&String>`, found `&Option<String>`
| | help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `res.as_ref()`
| arguments to this function are incorrect
|
--> $DIR/issue-102964.rs:5:41
|
LL | fn bar_function<T>(function: Foo<T>) -> RcFoo<T> {
- | ------------ ^^^^^^^^ expected struct `Rc`, found `()`
+ | ------------ ^^^^^^^^ expected `Rc<&dyn for<'a> Fn(&'a T)>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
LL | c.read_to(v);
| ------- ^
| | |
- | | expected `&mut [u8]`, found struct `Vec`
+ | | expected `&mut [u8]`, found `Vec<_>`
| | help: consider mutably borrowing here: `&mut v`
| arguments to this method are incorrect
|
LL | match a {
| - this expression has type `Option<Box<{integer}>>`
LL | Ok(a) =>
- | ^^^^^ expected enum `Option`, found enum `Result`
+ | ^^^^^ expected `Option<Box<{integer}>>`, found `Result<_, _>`
|
= note: expected enum `Option<Box<{integer}>>`
found enum `Result<_, _>`
--> $DIR/issue-13446.rs:3:26
|
LL | static VEC: [u32; 256] = vec![];
- | ^^^^^^ expected array `[u32; 256]`, found struct `Vec`
+ | ^^^^^^ expected `[u32; 256]`, found `Vec<_>`
|
= note: expected array `[u32; 256]`
found struct `Vec<_>`
//~^ ERROR mismatched types
//~| expected enum `Option<{integer}>`
//~| found enum `Result<_, _>`
- //~| expected enum `Option`, found enum `Result`
+ //~| expected `Option<{integer}>`, found `Result<_, _>`
Err(e) => panic!(e)
//~^ ERROR mismatched types
//~| expected enum `Option<{integer}>`
//~| found enum `Result<_, _>`
- //~| expected enum `Option`, found enum `Result`
+ //~| expected `Option<{integer}>`, found `Result<_, _>`
};
}
LL | let _x: usize = match Some(1) {
| ------- this expression has type `Option<{integer}>`
LL | Ok(u) => u,
- | ^^^^^ expected enum `Option`, found enum `Result`
+ | ^^^^^ expected `Option<{integer}>`, found `Result<_, _>`
|
= note: expected enum `Option<{integer}>`
found enum `Result<_, _>`
| ------- this expression has type `Option<{integer}>`
...
LL | Err(e) => panic!(e)
- | ^^^^^^ expected enum `Option`, found enum `Result`
+ | ^^^^^^ expected `Option<{integer}>`, found `Result<_, _>`
|
= note: expected enum `Option<{integer}>`
found enum `Result<_, _>`
fn make(v: Vec2) {
let Vec3 { y: _, z: _ } = v;
//~^ ERROR mismatched types
- //~| expected struct `Vec2`, found struct `Vec3`
+ //~| expected `Vec2`, found `Vec3`
}
fn main() { }
LL | let Vec3 { y: _, z: _ } = v;
| ^^^^^^^^^^^^^^^^^^^ - this expression has type `Vec2`
| |
- | expected struct `Vec2`, found struct `Vec3`
+ | expected `Vec2`, found `Vec3`
error: aborting due to previous error
//~^ ERROR mismatched types
//~| expected enum `Option<&[&str]>`
//~| found enum `Option<&[&str; 1]>`
- //~| expected slice `[&str]`, found array `[&str; 1]`
+ //~| expected `Option<&[&str]>`, found `Option<&[&str; 1]>`
assert_eq!(msg, 3);
}
--> $DIR/issue-15783.rs:8:19
|
LL | let msg = foo(x);
- | --- ^ expected slice `[&str]`, found array `[&str; 1]`
+ | --- ^ expected `Option<&[&str]>`, found `Option<&[&str; 1]>`
| |
| arguments to this function are incorrect
|
| - this expression has type `E`
LL | E::B(
LL | Tau{t: x},
- | ^^^^^^^^^ expected enum `R`, found struct `Tau`
+ | ^^^^^^^^^ expected `R`, found `Tau`
error: aborting due to previous error
LL | let Slice { data: data, len: len } = "foo";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ----- this expression has type `&str`
| |
- | expected `str`, found struct `Slice`
+ | expected `str`, found `Slice<_>`
|
= note: expected type `str`
found struct `Slice<_>`
//~^ ERROR mismatched types
//~| expected unit type `()`
//~| found struct `Slice<_>`
- //~| expected `()`, found struct `Slice`
+ //~| expected `()`, found `Slice<_>`
_ => unreachable!()
}
}
LL | match () {
| -- this expression has type `()`
LL | Slice { data: data, len: len } => (),
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Slice`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Slice<_>`
|
= note: expected unit type `()`
found struct `Slice<_>`
LL | print_x(X);
| ^^^^^^^--- an argument of type `&str` is missing
|
-note: expected reference, found struct `X`
+note: expected `&dyn Foo<Item = bool>`, found `X`
--> $DIR/issue-18819.rs:16:13
|
LL | print_x(X);
LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
| ^^^^
| |
- | expected `&T`, found type parameter `T`
+ | expected `&'a T`, found type parameter `T`
| help: change the parameter type to match the trait: `(&'a T,)`
|
= note: expected signature `extern "rust-call" fn(&Foo, (&'a T,))`
LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
| ^^^^
| |
- | expected `&T`, found type parameter `T`
+ | expected `&'a T`, found type parameter `T`
| help: change the parameter type to match the trait: `(&'a T,)`
|
= note: expected signature `extern "rust-call" fn(&mut Foo, (&'a T,))`
LL | extern "rust-call" fn call_once(self, (_,): (T,)) {}
| ^^^^
| |
- | expected `&T`, found type parameter `T`
+ | expected `&'a T`, found type parameter `T`
| help: change the parameter type to match the trait: `(&'a T,)`
|
= note: expected signature `extern "rust-call" fn(Foo, (&'a T,))`
type Item = i32;
fn next(&mut self) -> Result<i32, i32> { Ok(7) }
//~^ ERROR method `next` has an incompatible type for trait
- //~| expected enum `Option`, found enum `Result`
+ //~| expected `Option<i32>`, found `Result<i32, i32>`
}
fn main() {}
LL | fn next(&mut self) -> Result<i32, i32> { Ok(7) }
| ^^^^^^^^^^^^^^^^
| |
- | expected enum `Option`, found enum `Result`
+ | expected `Option<i32>`, found `Result<i32, i32>`
| help: change the output type to match the trait: `Option<i32>`
|
= note: expected signature `fn(&mut S) -> Option<i32>`
--> $DIR/issue-24322.rs:8:29
|
LL | let x: &fn(&B) -> u32 = &B::func;
- | -------------- ^^^^^^^^ expected fn pointer, found fn item
+ | -------------- ^^^^^^^^ expected `&for<'a> fn(&'a B) -> u32`, found `&for<'a> fn(&'a B) -> u32 {B::func}`
| |
| expected due to this
|
let mut v = Vec::new();
foo(&mut v);
//~^ ERROR mismatched types
- //~| expected struct `HashSet`, found struct `Vec`
+ //~| expected `&mut HashSet<u32>`, found `&mut Vec<_>`
}
fn foo(h: &mut HashSet<u32>) {
--> $DIR/issue-24819.rs:5:9
|
LL | foo(&mut v);
- | --- ^^^^^^ expected struct `HashSet`, found struct `Vec`
+ | --- ^^^^^^ expected `&mut HashSet<u32>`, found `&mut Vec<_>`
| |
| arguments to this function are incorrect
|
fn main() {
let b = [0; S];
//~^ ERROR mismatched types
- //~| expected `usize`, found struct `S`
+ //~| expected `usize`, found `S`
}
--> $DIR/issue-27008.rs:4:17
|
LL | let b = [0; S];
- | ^ expected `usize`, found struct `S`
+ | ^ expected `usize`, found `S`
error: aborting due to previous error
--> $DIR/issue-32122-1.rs:16:24
|
LL | let _: *const u8 = &a;
- | --------- ^^ expected `u8`, found struct `Foo`
+ | --------- ^^ expected `*const u8`, found `&Foo`
| |
| expected due to this
|
--> $DIR/issue-32122-2.rs:27:24
|
LL | let _: *const u8 = &a;
- | --------- ^^ expected `u8`, found struct `Emm`
+ | --------- ^^ expected `*const u8`, found `&Emm`
| |
| expected due to this
|
LL | let Test = 1;
| ^^^^ - this expression has type `{integer}`
| |
- | expected integer, found struct `Test`
+ | expected integer, found `Test`
| `Test` is interpreted as a unit struct, not a new binding
| help: introduce a new binding instead: `other_test`
--> $DIR/issue-33941.rs:6:36
|
LL | for _ in HashMap::new().iter().cloned() {}
- | ^^^^^^ expected reference, found tuple
+ | ^^^^^^ expected `&_`, found `(&_, &_)`
|
= note: expected reference `&_`
found tuple `(&_, &_)`
--> $DIR/issue-33941.rs:6:14
|
LL | for _ in HashMap::new().iter().cloned() {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(&_, &_)`, found `&_`
|
= note: expected tuple `(&_, &_)`
found reference `&_`
--> $DIR/issue-33941.rs:6:14
|
LL | for _ in HashMap::new().iter().cloned() {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(&_, &_)`, found `&_`
|
= note: expected tuple `(&_, &_)`
found reference `&_`
| ---------- `Foo` defines a struct constructor here, which should be called
LL |
LL | fn test() -> Foo { Foo }
- | --- ^^^ expected struct `Foo`, found struct constructor
+ | --- ^^^ expected `Foo`, found struct constructor
| |
| expected `Foo` because of return type
|
//~^ ERROR mismatched types
//~| expected enum `Option<_>`
//~| found enum `Result<_, _>`
- //~| expected enum `Option`, found enum `Result`
+ //~| expected `Option<_>`, found `Result<_, _>`
}
}
LL | match None {
| ---- this expression has type `Option<_>`
LL | Err(_) => ()
- | ^^^^^^ expected enum `Option`, found enum `Result`
+ | ^^^^^^ expected `Option<_>`, found `Result<_, _>`
|
= note: expected enum `Option<_>`
found enum `Result<_, _>`
--> $DIR/issue-40749.rs:2:9
|
LL | [0; ..10];
- | ^^^^ expected `usize`, found struct `RangeTo`
+ | ^^^^ expected `usize`, found `RangeTo<{integer}>`
|
= note: expected type `usize`
found struct `RangeTo<{integer}>`
--> $DIR/issue-43420-no-over-suggest.rs:8:9
|
LL | foo(&a);
- | --- ^^ expected slice `[u16]`, found struct `Vec`
+ | --- ^^ expected `&[u16]`, found `&Vec<u8>`
| |
| arguments to this function are incorrect
|
let foo: [u8; 4] = [1; 4];
bar(foo);
//~^ ERROR mismatched types
- //~| expected `usize`, found array `[u8; 4]`
+ //~| expected `usize`, found `[u8; 4]`
}
--> $DIR/issue-4517.rs:5:9
|
LL | bar(foo);
- | --- ^^^ expected `usize`, found array `[u8; 4]`
+ | --- ^^^ expected `usize`, found `[u8; 4]`
| |
| arguments to this function are incorrect
|
--> $DIR/issue-48364.rs:2:21
|
LL | b"".starts_with(stringify!(foo))
- | ----------- ^^^^^^^^^^^^^^^ expected slice `[u8]`, found `str`
+ | ----------- ^^^^^^^^^^^^^^^ expected `&[u8]`, found `&str`
| |
| arguments to this method are incorrect
|
//~^ ERROR mismatched types
//~| expected type `{integer}`
//~| found tuple `(isize, isize)`
- //~| expected integer, found tuple
+ //~| expected integer, found `(isize, isize)`
}
LL | match 42 { A => () }
| -- ^
| | |
- | | expected integer, found tuple
+ | | expected integer, found `(isize, isize)`
| | `A` is interpreted as a constant, not a new binding
| | help: introduce a new binding instead: `other_a`
| this expression has type `{integer}`
match (true, false) {
A::B => (),
//~^ ERROR mismatched types
-//~| expected tuple, found enum `A`
+//~| expected `(bool, bool)`, found `A`
//~| expected tuple `(bool, bool)`
//~| found enum `A`
_ => ()
match (true, false) {
&(true, false) => ()
//~^ ERROR mismatched types
-//~| expected tuple, found reference
+//~| expected `(bool, bool)`, found `&_`
//~| expected tuple `(bool, bool)`
//~| found reference `&_`
}
LL | match (true, false) {
| ------------- this expression has type `(bool, bool)`
LL | A::B => (),
- | ^^^^ expected tuple, found enum `A`
+ | ^^^^ expected `(bool, bool)`, found `A`
|
= note: expected tuple `(bool, bool)`
found enum `A`
LL | match (true, false) {
| ------------- this expression has type `(bool, bool)`
LL | box (true, false) => ()
- | ^^^^^^^^^^^^^^^^^ expected tuple, found struct `Box`
+ | ^^^^^^^^^^^^^^^^^ expected `(bool, bool)`, found `Box<_>`
|
= note: expected tuple `(bool, bool)`
found struct `Box<_>`
LL | match (true, false) {
| ------------- this expression has type `(bool, bool)`
LL | &(true, false) => ()
- | ^^^^^^^^^^^^^^ expected tuple, found reference
+ | ^^^^^^^^^^^^^^ expected `(bool, bool)`, found `&_`
|
= note: expected tuple `(bool, bool)`
found reference `&_`
--> $DIR/issue-51632-try-desugar-incompatible-types.rs:8:5
|
LL | missing_discourses()?
- | ^^^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `isize`
+ | ^^^^^^^^^^^^^^^^^^^^^ expected `Result<isize, ()>`, found `isize`
|
= note: `?` operator cannot convert from `isize` to `Result<isize, ()>`
= note: expected enum `Result<isize, ()>`
for i in v {
a = *i.to_string();
//~^ ERROR mismatched types
- //~| NOTE expected struct `String`, found `str`
+ //~| NOTE expected `String`, found `str`
v2.push(a);
}
}
| ------------- expected due to this value
LL | for i in v {
LL | a = *i.to_string();
- | ^^^^^^^^^^^^^^ expected struct `String`, found `str`
+ | ^^^^^^^^^^^^^^ expected `String`, found `str`
error: aborting due to previous error
match S(Either::Left(5)) {
Either::Right(_) => {}
//~^ ERROR mismatched types
- //~| expected struct `S`, found enum `Either`
+ //~| expected `S`, found `Either<_, _>`
//~| expected struct `S`
//~| found enum `Either<_, _>`
_ => {}
LL | match S(Either::Left(5)) {
| ------------------ this expression has type `S`
LL | Either::Right(_) => {}
- | ^^^^^^^^^^^^^^^^ expected struct `S`, found enum `Either`
+ | ^^^^^^^^^^^^^^^^ expected `S`, found `Either<_, _>`
|
= note: expected struct `S`
found enum `Either<_, _>`
--> $DIR/issue-56943.rs:6:29
|
LL | let _: issue_56943::S = issue_56943::S2;
- | -------------- ^^^^^^^^^^^^^^^ expected struct `S`, found struct `S2`
+ | -------------- ^^^^^^^^^^^^^^^ expected `S`, found `S2`
| |
| expected due to this
LL | let y = match x {
| - this expression has type `Box<u32>`
LL | S::A { a } | S::B { b: a } => a,
- | ^^^^^^^^^^ expected struct `Box`, found enum `S`
+ | ^^^^^^^^^^ expected `Box<u32>`, found `S`
|
= note: expected struct `Box<u32>`
found enum `S`
LL | let y = match x {
| - this expression has type `Box<u32>`
LL | S::A { a } | S::B { b: a } => a,
- | ^^^^^^^^^^^^^ expected struct `Box`, found enum `S`
+ | ^^^^^^^^^^^^^ expected `Box<u32>`, found `S`
|
= note: expected struct `Box<u32>`
found enum `S`
| this expression has type `Box<T>`
| help: consider dereferencing the boxed value: `*x`
LL | T::A(a) | T::B(a) => a,
- | ^^^^^^^ expected struct `Box`, found enum `T`
+ | ^^^^^^^ expected `Box<T>`, found `T`
|
= note: expected struct `Box<T>`
found enum `T`
| this expression has type `Box<T>`
| help: consider dereferencing the boxed value: `*x`
LL | T::A(a) | T::B(a) => a,
- | ^^^^^^^ expected struct `Box`, found enum `T`
+ | ^^^^^^^ expected `Box<T>`, found `T`
|
= note: expected struct `Box<T>`
found enum `T`
| this expression has type `Box<S>`
| help: consider dereferencing the boxed value: `*x`
LL | S::A { a } | S::B { b: a } => a,
- | ^^^^^^^^^^ expected struct `Box`, found enum `S`
+ | ^^^^^^^^^^ expected `Box<S>`, found `S`
|
= note: expected struct `Box<S>`
found enum `S`
| this expression has type `Box<S>`
| help: consider dereferencing the boxed value: `*x`
LL | S::A { a } | S::B { b: a } => a,
- | ^^^^^^^^^^^^^ expected struct `Box`, found enum `S`
+ | ^^^^^^^^^^^^^ expected `Box<S>`, found `S`
|
= note: expected struct `Box<S>`
found enum `S`
--> $DIR/issue-59488.rs:14:11
|
LL | foo > 12;
- | ^^ expected fn item, found integer
+ | ^^ expected fn item, found `i32`
|
= note: expected fn item `fn() -> i32 {foo}`
found type `i32`
--> $DIR/issue-59488.rs:18:11
|
LL | bar > 13;
- | ^^ expected fn item, found integer
+ | ^^ expected fn item, found `i64`
|
= note: expected fn item `fn(i64) -> i64 {bar}`
found type `i64`
LL | foo(x.clone());
| --- ^^^^^^^^^
| | |
- | | expected `&str`, found struct `String`
+ | | expected `&str`, found `String`
| | help: consider borrowing here: `&x`
| arguments to this function are incorrect
|
--> $DIR/issue-6458-4.rs:1:20
|
LL | fn foo(b: bool) -> Result<bool,String> {
- | --- ^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
+ | --- ^^^^^^^^^^^^^^^^^^^ expected `Result<bool, String>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
LL | Err("bar".to_string());
--> $DIR/issue-67039-unsound-pin-partialeq.rs:25:29
|
LL | let _ = Pin::new(Apple) == Rc::pin(Apple);
- | ^^ expected struct `Apple`, found struct `Rc`
+ | ^^ expected `Apple`, found `Rc<Apple>`
|
= note: expected struct `Apple`
found struct `Rc<Apple>`
LL | impl<T> S0<T> {
| - this type parameter
LL | const C: S0<u8> = Self(0);
- | ^^^^^^^ expected `u8`, found type parameter `T`
+ | ^^^^^^^ expected `S0<u8>`, found `S0<T>`
|
= note: expected struct `S0<u8>`
found struct `S0<T>`
LL | impl<T> S1<T, u8> {
| - this type parameter
LL | const C: S1<u8, u8> = Self(0, 1);
- | ^^^^^^^^^^ expected `u8`, found type parameter `T`
+ | ^^^^^^^^^^ expected `S1<u8, u8>`, found `S1<T, u8>`
|
= note: expected struct `S1<u8, _>`
found struct `S1<T, _>`
| |
| expected type parameter
LL | Self(x)
- | ^^^^^^^ expected type parameter `U`, found type parameter `T`
+ | ^^^^^^^ expected `S2<U>`, found `S2<T>`
|
= note: expected struct `S2<U>`
found struct `S2<T>`
--> $DIR/issue-7061.rs:4:46
|
LL | fn foo(&'a mut self) -> Box<BarStruct> { self }
- | -------------- ^^^^ expected struct `Box`, found `&mut BarStruct`
+ | -------------- ^^^^ expected `Box<BarStruct>`, found `&mut BarStruct`
| |
| expected `Box<BarStruct>` because of return type
|
match x {
Some(field) =>
//~^ ERROR mismatched types
-//~| expected enum `Whatever`, found enum `Option`
+//~| expected `Whatever`, found `Option<_>`
//~| expected enum `Whatever`
//~| found enum `Option<_>`
field.access(),
LL | match x {
| - this expression has type `Whatever`
LL | Some(field) =>
- | ^^^^^^^^^^^ expected enum `Whatever`, found enum `Option`
+ | ^^^^^^^^^^^ expected `Whatever`, found `Option<_>`
|
= note: expected enum `Whatever`
found enum `Option<_>`
--> $DIR/issue-71676-1.rs:43:24
|
LL | let _: *const u8 = &a;
- | --------- ^^ expected `u8`, found struct `Emm`
+ | --------- ^^ expected `*const u8`, found `&Emm`
| |
| expected due to this
|
--> $DIR/issue-71676-1.rs:49:24
|
LL | let _: *const u8 = &mut a;
- | --------- ^^^^^^ expected `u8`, found struct `Emm`
+ | --------- ^^^^^^ expected `*const u8`, found `&mut Emm`
| |
| expected due to this
|
--> $DIR/issue-71676-1.rs:52:22
|
LL | let _: *mut u8 = &mut a;
- | ------- ^^^^^^ expected `u8`, found struct `Emm`
+ | ------- ^^^^^^ expected `*mut u8`, found `&mut Emm`
| |
| expected due to this
|
LL | let () = dep::Renamed;
| ^^ ------------ this expression has type `Renamed`
| |
- | expected struct `Renamed`, found `()`
+ | expected `Renamed`, found `()`
error: aborting due to previous error
LL | RANGE => {}
| ^^^^^
| |
- | expected `i32`, found struct `RangeInclusive`
+ | expected `i32`, found `RangeInclusive<i32>`
| `RANGE` is interpreted as a constant, not a new binding
|
= note: expected type `i32`
LL | RANGE2 => {}
| ^^^^^^
| |
- | expected `i32`, found struct `RangeInclusive`
+ | expected `i32`, found `RangeInclusive<i32>`
| `RANGE2` is interpreted as a constant, not a new binding
|
= note: expected type `i32`
match (true, false) {
A::B => (),
//~^ ERROR mismatched types
- //~| expected tuple, found enum `A`
+ //~| expected `(bool, bool)`, found `A`
//~| expected tuple `(bool, bool)`
//~| found enum `A`
_ => ()
LL | match (true, false) {
| ------------- this expression has type `(bool, bool)`
LL | A::B => (),
- | ^^^^ expected tuple, found enum `A`
+ | ^^^^ expected `(bool, bool)`, found `A`
|
= note: expected tuple `(bool, bool)`
found enum `A`
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
-"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":612,"byte_end":618,"line_start":17,"line_end":17,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":622,"byte_end":622,"line_start":17,"line_end":17,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:17:22: error[E0308]: mismatched types
+"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":612,"byte_end":618,"line_start":17,"line_end":17,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":622,"byte_end":622,"line_start":17,"line_end":17,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:17:22: error[E0308]: mismatched types
"}
{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
-"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":672,"byte_end":678,"line_start":19,"line_end":19,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":682,"byte_end":682,"line_start":19,"line_end":19,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:19:22: error[E0308]: mismatched types
+"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":672,"byte_end":678,"line_start":19,"line_end":19,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":682,"byte_end":682,"line_start":19,"line_end":19,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:19:22: error[E0308]: mismatched types
"}
{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
-"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":735,"byte_end":741,"line_start":22,"line_end":22,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":746,"byte_end":746,"line_start":23,"line_end":23,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:23:1: error[E0308]: mismatched types
+"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":735,"byte_end":741,"line_start":22,"line_end":22,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":746,"byte_end":746,"line_start":23,"line_end":23,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:23:1: error[E0308]: mismatched types
"}
{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
-"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":792,"byte_end":798,"line_start":25,"line_end":25,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:25:22: error[E0308]: mismatched types
+"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":792,"byte_end":798,"line_start":25,"line_end":25,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:25:22: error[E0308]: mismatched types
"}
{"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors
"}
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
-"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":597,"byte_end":603,"line_start":16,"line_end":16,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":607,"byte_end":607,"line_start":16,"line_end":16,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:16:22: error[E0308]: mismatched types
+"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":597,"byte_end":603,"line_start":16,"line_end":16,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":607,"byte_end":607,"line_start":16,"line_end":16,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:16:22: error[E0308]: mismatched types
"}
{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
-"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":666,"byte_end":667,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":657,"byte_end":663,"line_start":18,"line_end":18,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":667,"byte_end":667,"line_start":18,"line_end":18,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:18:22: error[E0308]: mismatched types
+"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":666,"byte_end":667,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":657,"byte_end":663,"line_start":18,"line_end":18,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":667,"byte_end":667,"line_start":18,"line_end":18,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:18:22: error[E0308]: mismatched types
"}
{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
-"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":730,"byte_end":731,"line_start":22,"line_end":22,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":720,"byte_end":726,"line_start":21,"line_end":21,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":731,"byte_end":731,"line_start":22,"line_end":22,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:22:1: error[E0308]: mismatched types
+"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":730,"byte_end":731,"line_start":22,"line_end":22,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":720,"byte_end":726,"line_start":21,"line_end":21,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":731,"byte_end":731,"line_start":22,"line_end":22,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:22:1: error[E0308]: mismatched types
"}
{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
-"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":786,"byte_end":794,"line_start":24,"line_end":25,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":777,"byte_end":783,"line_start":24,"line_end":24,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:24:22: error[E0308]: mismatched types
+"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":786,"byte_end":794,"line_start":24,"line_end":25,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":777,"byte_end":783,"line_start":24,"line_end":24,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:24:22: error[E0308]: mismatched types
"}
{"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors
"}
--> $DIR/issue-94176.rs:5:32
|
LL | pub fn test(a: Option<u32>) -> Option<u32> {
- | ---- ^^^^^^^^^^^ expected enum `Option`, found `()`
+ | ---- ^^^^^^^^^^^ expected `Option<u32>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
LL | let Bar::Present(z) = self else {
| ^^^^^^^^^^^^^^^ ---- this expression has type `&mut Foo`
| |
- | expected struct `Foo`, found enum `Bar`
+ | expected `Foo`, found `Bar`
error[E0308]: mismatched types
--> $DIR/let-else-deref-coercion.rs:68:13
LL | let Bar(z) = x;
| ^^^^^^ - this expression has type `&mut irrefutable::Foo`
| |
- | expected struct `Foo`, found struct `Bar`
+ | expected `Foo`, found `Bar`
error: aborting due to 2 previous errors
| ________________________________^
LL | | Some(2)
LL | | };
- | |_____^ expected `!`, found enum `Option`
+ | |_____^ expected `!`, found `Option<{integer}>`
|
= note: expected type `!`
found enum `Option<{integer}>`
--> $DIR/let-else-non-diverging.rs:10:32
|
LL | let Some(x) = Some(1) else { Some(2) };
- | ^^^^^^^^^^^ expected `!`, found enum `Option`
+ | ^^^^^^^^^^^ expected `!`, found `Option<{integer}>`
|
= note: expected type `!`
found enum `Option<{integer}>`
--> $DIR/let-else-non-diverging.rs:15:32
|
LL | let Some(x) = Some(1) else { foo::<Uninhabited>() };
- | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found enum `Uninhabited`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found `Uninhabited`
|
= note: expected type `!`
found enum `Uninhabited`
--> $DIR/let-else-ref-bindings.rs:16:38
|
LL | let Some(ref a): Option<&[u8]> = some else { return };
- | ^^^^ expected `&[u8]`, found struct `Vec`
+ | ^^^^ expected `Option<&[u8]>`, found `Option<Vec<u8>>`
|
= note: expected enum `Option<&[u8]>`
found enum `Option<Vec<u8>>`
--> $DIR/let-else-ref-bindings.rs:20:38
|
LL | let Some(ref a): Option<&[u8]> = &some else { return };
- | ^^^^^ expected enum `Option`, found `&Option<Vec<u8>>`
+ | ^^^^^ expected `Option<&[u8]>`, found `&Option<Vec<u8>>`
|
= note: expected enum `Option<&[u8]>`
found reference `&Option<Vec<u8>>`
--> $DIR/let-else-ref-bindings.rs:24:34
|
LL | let Some(a): Option<&[u8]> = some else { return };
- | ------------- ^^^^ expected `&[u8]`, found struct `Vec`
+ | ------------- ^^^^ expected `Option<&[u8]>`, found `Option<Vec<u8>>`
| |
| expected due to this
|
--> $DIR/let-else-ref-bindings.rs:27:34
|
LL | let Some(a): Option<&[u8]> = &some else { return };
- | ------------- ^^^^^ expected enum `Option`, found `&Option<Vec<u8>>`
+ | ------------- ^^^^^ expected `Option<&[u8]>`, found `&Option<Vec<u8>>`
| |
| expected due to this
|
--> $DIR/let-else-ref-bindings.rs:44:46
|
LL | let Some(ref mut a): Option<&mut [u8]> = some else { return };
- | ^^^^ expected `&mut [u8]`, found struct `Vec`
+ | ^^^^ expected `Option<&mut [u8]>`, found `Option<Vec<u8>>`
|
= note: expected enum `Option<&mut [u8]>`
found enum `Option<Vec<u8>>`
--> $DIR/let-else-ref-bindings.rs:48:46
|
LL | let Some(ref mut a): Option<&mut [u8]> = &mut some else { return };
- | ^^^^^^^^^ expected enum `Option`, found mutable reference
+ | ^^^^^^^^^ expected `Option<&mut [u8]>`, found `&mut Option<Vec<u8>>`
|
= note: expected enum `Option<&mut [u8]>`
found mutable reference `&mut Option<Vec<u8>>`
--> $DIR/let-else-ref-bindings.rs:52:38
|
LL | let Some(a): Option<&mut [u8]> = some else { return };
- | ----------------- ^^^^ expected `&mut [u8]`, found struct `Vec`
+ | ----------------- ^^^^ expected `Option<&mut [u8]>`, found `Option<Vec<u8>>`
| |
| expected due to this
|
--> $DIR/let-else-ref-bindings.rs:55:38
|
LL | let Some(a): Option<&mut [u8]> = &mut some else { return };
- | ----------------- ^^^^^^^^^ expected enum `Option`, found mutable reference
+ | ----------------- ^^^^^^^^^ expected `Option<&mut [u8]>`, found `&mut Option<Vec<u8>>`
| |
| expected due to this
|
LL | | "down" => RoomDirection::Down,
| | ------------------- this and all prior arms are found to be of type `RoomDirection`
LL | | _ => None
- | | ^^^^ expected enum `RoomDirection`, found enum `Option`
+ | | ^^^^ expected `RoomDirection`, found `Option<_>`
LL | | }
| |_____- `match` arms have incompatible types
|
--> $DIR/issue-26638.rs:1:69
|
LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.next() }
- | ---- ^^^^^^^^^^^ expected `&str`, found enum `Option`
+ | ---- ^^^^^^^^^^^ expected `&str`, found `Option<&str>`
| |
| expected `&'static str` because of return type
|
--> $DIR/issue-26638.rs:5:47
|
LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
- | ---- ^^^^^^ expected `str`, found `u8`
+ | ---- ^^^^^^ expected `&str`, found `&u8`
| |
| expected `&'static str` because of return type
|
--> $DIR/tuple-mismatch.rs:6:20
|
LL | yield ((), ());
- | ^^ expected tuple, found `()`
+ | ^^ expected `((), ())`, found `()`
|
= note: expected tuple `((), ())`
found unit type `()`
--> $DIR/loop-break-value.rs:80:15
|
LL | break (break, break);
- | ^^^^^^^^^^^^^^ expected `()`, found tuple
+ | ^^^^^^^^^^^^^^ expected `()`, found `(!, !)`
|
= note: expected unit type `()`
found tuple `(!, !)`
LL | match t {
| - this expression has type `Result<_, {integer}>`
LL | Some(k) => match k {
- | ^^^^^^^ expected enum `Result`, found enum `Option`
+ | ^^^^^^^ expected `Result<_, {integer}>`, found `Option<_>`
|
= note: expected enum `Result<_, {integer}>`
found enum `Option<_>`
| - this expression has type `Result<_, {integer}>`
...
LL | None => ()
- | ^^^^ expected enum `Result`, found enum `Option`
+ | ^^^^ expected `Result<_, {integer}>`, found `Option<_>`
|
= note: expected enum `Result<_, {integer}>`
found enum `Option<_>`
LL | match array {
| ----- this expression has type `[S; 1]`
LL | [()] => {}
- | ^^ expected struct `S`, found `()`
+ | ^^ expected `S`, found `()`
error: aborting due to previous error
match (S { a: 1 }) {
E::C(_) => (),
//~^ ERROR mismatched types
- //~| expected struct `S`, found enum `E`
+ //~| expected `S`, found `E`
_ => ()
}
}
LL | match (S { a: 1 }) {
| ------------ this expression has type `S`
LL | E::C(_) => (),
- | ^^^^^^^ expected struct `S`, found enum `E`
+ | ^^^^^^^ expected `S`, found `E`
error: aborting due to previous error
| - unit variant defined here
LL |
LL | fn main() { let x: A = A::A; match x { B::B => { } } }
- | - ^^^^ expected enum `A`, found enum `B`
+ | - ^^^^ expected `A`, found `B`
| |
| this expression has type `A`
--> $DIR/match-tag-unary.rs:4:43
|
LL | fn main() { let x: A = A::A(0); match x { B::B(y) => { } } }
- | - ^^^^^^^ expected enum `A`, found enum `B`
+ | - ^^^^^^^ expected `A`, found `B`
| |
| this expression has type `A`
--> $DIR/issue-61525.rs:14:33
|
LL | 1.query::<dyn ToString>("")
- | --------------------- ^^ expected trait object `dyn ToString`, found `&str`
+ | --------------------- ^^ expected `dyn ToString`, found `&str`
| |
| arguments to this method are incorrect
|
--> $DIR/issue-90315.rs:28:8
|
LL | if 1..(end + 1).is_empty() {
- | ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<{integer}>`
|
= note: expected type `bool`
found struct `std::ops::Range<{integer}>`
--> $DIR/issue-90315.rs:34:8
|
LL | if 1..(end + 1).is_sorted() {
- | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<{integer}>`
|
= note: expected type `bool`
found struct `std::ops::Range<{integer}>`
--> $DIR/issue-90315.rs:40:21
|
LL | let _res: i32 = 3..6.take(2).sum();
- | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `Range`
+ | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found `Range<{integer}>`
| |
| expected due to this
|
--> $DIR/issue-90315.rs:45:21
|
LL | let _sum: i32 = 3..6.sum();
- | --- ^^^^^^^^^^ expected `i32`, found struct `Range`
+ | --- ^^^^^^^^^^ expected `i32`, found `Range<{integer}>`
| |
| expected due to this
|
--> $DIR/issue-90315.rs:62:8
|
LL | if 1..end.error_method() {
- | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<{integer}>`
|
= note: expected type `bool`
found struct `std::ops::Range<{integer}>`
fn main() {
let x = Foo;
Foo::bar(x); //~ ERROR mismatched types
- //~| expected `&Foo`, found struct `Foo`
+ //~| expected `&Foo`, found `Foo`
Foo::bar(&42); //~ ERROR mismatched types
- //~| expected struct `Foo`, found integer
+ //~| expected `&Foo`, found `&{integer}`
//~| expected reference `&Foo`
//~| found reference `&{integer}`
}
LL | Foo::bar(x);
| -------- ^
| | |
- | | expected `&Foo`, found struct `Foo`
+ | | expected `&Foo`, found `Foo`
| | help: consider borrowing here: `&x`
| arguments to this function are incorrect
|
--> $DIR/method-self-arg-1.rs:13:14
|
LL | Foo::bar(&42);
- | -------- ^^^ expected struct `Foo`, found integer
+ | -------- ^^^ expected `&Foo`, found `&{integer}`
| |
| arguments to this function are incorrect
|
LL | fn a() -> Foo {
| --- expected `Foo` because of return type
LL | Some(Foo { bar: 1 })
- | ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Option`
+ | ^^^^^^^^^^^^^^^^^^^^ expected `Foo`, found `Option<Foo>`
|
= note: expected struct `Foo`
found enum `Option<Foo>`
LL | fn a2() -> Foo {
| --- expected `Foo` because of return type
LL | Ok(Foo { bar: 1})
- | ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Result`
+ | ^^^^^^^^^^^^^^^^^ expected `Foo`, found `Result<Foo, _>`
|
= note: expected struct `Foo`
found enum `Result<Foo, _>`
LL | fn b() -> Option<Foo> {
| ----------- expected `Option<Foo>` because of return type
LL | Foo { bar: 1 }
- | ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo`
+ | ^^^^^^^^^^^^^^ expected `Option<Foo>`, found `Foo`
|
= note: expected enum `Option<Foo>`
found struct `Foo`
LL | fn c() -> Result<Foo, Bar> {
| ---------------- expected `Result<Foo, Bar>` because of return type
LL | Foo { bar: 1 }
- | ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo`
+ | ^^^^^^^^^^^^^^ expected `Result<Foo, Bar>`, found `Foo`
|
= note: expected enum `Result<Foo, Bar>`
found struct `Foo`
| ---------------------------- expected `X<X<String, String>, String>` because of return type
...
LL | x
- | ^ expected struct `String`, found integer
+ | ^ expected `X<X<String, String>, String>`, found `X<X<String, {integer}>, {integer}>`
|
= note: expected struct `X<X<_, String>, String>`
found struct `X<X<_, {integer}>, {integer}>`
| ---------------------------- expected `X<X<String, String>, String>` because of return type
...
LL | x
- | ^ expected struct `String`, found integer
+ | ^ expected `X<X<String, String>, String>`, found `X<X<String, {integer}>, String>`
|
= note: expected struct `X<X<_, String>, _>`
found struct `X<X<_, {integer}>, _>`
LL | fn f() -> String {
| ------ expected `String` because of return type
LL | 1+2
- | ^^^ expected struct `String`, found integer
+ | ^^^ expected `String`, found integer
|
help: try using a conversion method
|
LL | fn g() -> String {
| ------ expected `String` because of return type
LL | -2
- | ^^ expected struct `String`, found integer
+ | ^^ expected `String`, found integer
|
help: try using a conversion method
|
| | - expected because of this
LL | | } else {
LL | | Y
- | | ^ expected struct `S`, found struct `Y`
+ | | ^ expected `S`, found `Y`
LL | | }
| |_____- `if` and `else` have incompatible types
LL | | true => S,
| | - this is found to be of type `S`
LL | | false => Y,
- | | ^ expected struct `S`, found struct `Y`
+ | | ^ expected `S`, found `Y`
LL | | }
| |_____- `match` arms have incompatible types
LL | match x {
| - this expression has type `&_S`
LL | _S(& (mut _y), _v) => {
- | ^^^^^^^^^^ expected `u32`, found reference
+ | ^^^^^^^^^^ expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
LL | fn bgh(&&bar: u32) {}
| ^^^^^ --- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
LL | fn foo(&_a: Foo) {}
| ^^^ --- expected due to this
| |
- | expected struct `Foo`, found reference
+ | expected `Foo`, found `&_`
|
= note: expected struct `Foo`
found reference `&_`
LL | fn agh(&&_a: &u32) {}
| ^^^ ---- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
--> $DIR/non_zero_assigned_something.rs:2:35
|
LL | let _: std::num::NonZeroU64 = 1;
- | -------------------- ^ expected struct `NonZeroU64`, found integer
+ | -------------------- ^ expected `NonZeroU64`, found integer
| |
| expected due to this
|
--> $DIR/non_zero_assigned_something.rs:6:43
|
LL | let _: Option<std::num::NonZeroU64> = 1;
- | ---------------------------- ^ expected enum `Option`, found integer
+ | ---------------------------- ^ expected `Option<NonZeroU64>`, found integer
| |
| expected due to this
|
--> $DIR/normalize-fn-sig.rs:14:22
|
LL | needs_i32_ref_fn(foo::<()>);
- | ---------------- ^^^^^^^^^ expected `&i32`, found `i32`
+ | ---------------- ^^^^^^^^^ expected fn pointer, found fn item
| |
| arguments to this function are incorrect
|
LL | fn _f0(&_a: u32) {}
| ^^^ --- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
LL | fn _f2(&&_a: &u32) {}
| ^^^ ---- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
LL | fn _f3(&mut &_a: &mut u32) {}
| ^^^ -------- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
| ^--
| ||
| |expected due to this
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
| ^--
| ||
| |expected due to this
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
| ^--
| ||
| |expected due to this
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
LL | let _ = |&_a: u32| ();
| ^^^ --- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
LL | let _ = |&&_a: &u32| ();
| ^^^ ---- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
LL | let _ = |&mut &_a: &mut u32| ();
| ^^^ -------- expected due to this
| |
- | expected `u32`, found reference
+ | expected `u32`, found `&_`
|
= note: expected type `u32`
found reference `&_`
LL | fn foo() -> Foo {
| --- expected `baz::Foo` because of return type
LL | meh::Foo
- | ^^^^^^^^ expected struct `baz::Foo`, found struct `meh::Foo`
+ | ^^^^^^^^ expected `baz::Foo`, found `meh::Foo`
|
- = note: struct `meh::Foo` and struct `baz::Foo` have similar names, but are actually distinct types
-note: struct `meh::Foo` is defined in module `crate::meh` of the current crate
+ = note: `meh::Foo` and `baz::Foo` have similar names, but are actually distinct types
+note: `meh::Foo` is defined in module `crate::meh` of the current crate
--> $DIR/show_module.rs:8:5
|
LL | pub struct Foo;
| ^^^^^^^^^^^^^^
-note: struct `baz::Foo` is defined in module `crate::blah::baz` of the current crate
+note: `baz::Foo` is defined in module `crate::blah::baz` of the current crate
--> $DIR/show_module.rs:3:9
|
LL | pub struct Foo;
LL | pub fn foo() -> Option<u8> {
| ---------- expected `Option<u8>` because of return type
LL | Some(42_u8)
- | ^^^^^^^^^^^ expected enum `Option`, found enum `std::option::Option`
+ | ^^^^^^^^^^^ expected `Option<u8>`, found `std::option::Option<u8>`
|
- = note: enum `std::option::Option` and enum `Option` have similar names, but are actually distinct types
-note: enum `std::option::Option` is defined in crate `core`
+ = note: `std::option::Option<u8>` and `Option<u8>` have similar names, but are actually distinct types
+note: `std::option::Option<u8>` is defined in crate `core`
--> $SRC_DIR/core/src/option.rs:LL:COL
-note: enum `Option` is defined in the current crate
+note: `Option<u8>` is defined in the current crate
--> $DIR/similar_paths.rs:1:1
|
LL | enum Option<T> {
--> $DIR/similar_paths_primitive.rs:8:9
|
LL | foo(true);
- | --- ^^^^ expected struct `bool`, found `bool`
+ | --- ^^^^ expected `bool`, found a different `bool`
| |
| arguments to this function are incorrect
|
- = note: bool and struct `bool` have similar names, but are actually distinct types
+ = note: bool and `bool` have similar names, but are actually distinct types
= note: bool is a primitive defined by the language
-note: struct `bool` is defined in the current crate
+note: `bool` is defined in the current crate
--> $DIR/similar_paths_primitive.rs:3:1
|
LL | struct bool;
| | - expected because of this
LL | | } else {
LL | | Y
- | | ^ expected struct `S`, found struct `Y`
+ | | ^ expected `S`, found `Y`
LL | | }
| |_____- `if` and `else` have incompatible types
|
LL | | true => S,
| | - this is found to be of type `S`
LL | | false => Y,
- | | ^ expected struct `S`, found struct `Y`
+ | | ^ expected `S`, found `Y`
LL | | }
| |_____- `match` arms have incompatible types
|
--> $DIR/suggest-removing-tuple-struct-field.rs:11:13
|
LL | some_fn(value.0);
- | ------- ^^^^^^^ expected struct `MyWrapper`, found `u32`
+ | ------- ^^^^^^^ expected `MyWrapper`, found `u32`
| |
| arguments to this function are incorrect
|
--> $DIR/suggest-removing-tuple-struct-field.rs:12:13
|
LL | some_fn(my_wrapper!(123).0);
- | ------- ^^^^^^^^^^^^^^^^^^ expected struct `MyWrapper`, found `u32`
+ | ------- ^^^^^^^^^^^^^^^^^^ expected `MyWrapper`, found `u32`
| |
| arguments to this function are incorrect
|
--> $DIR/wrap-suggestion-privacy.rs:12:19
|
LL | needs_wrapper(0);
- | ------------- ^ expected struct `Wrapper`, found integer
+ | ------------- ^ expected `Wrapper<i32>`, found integer
| |
| arguments to this function are incorrect
|
--> $DIR/wrap-suggestion-privacy.rs:17:20
|
LL | needs_wrapping(0);
- | -------------- ^ expected struct `Wrapping`, found integer
+ | -------------- ^ expected `Wrapping<i32>`, found integer
| |
| arguments to this function are incorrect
|
--> $DIR/wrap-suggestion-privacy.rs:22:17
|
LL | needs_ready(Some(0));
- | ----------- ^^^^^^^ expected struct `Ready`, found enum `Option`
+ | ----------- ^^^^^^^ expected `Ready<i32>`, found `Option<{integer}>`
| |
| arguments to this function are incorrect
|
LL | f(x)
| - ^
| | |
- | | expected `&mut isize`, found struct `Box`
+ | | expected `&mut isize`, found `Box<{integer}>`
| | help: consider mutably borrowing here: `&mut x`
| arguments to this function are incorrect
|
--> $DIR/diverging-tuple-parts-39485.rs:8:5
|
LL | &panic!()
- | ^^^^^^^^^ expected `()`, found reference
+ | ^^^^^^^^^ expected `()`, found `&_`
|
= note: expected unit type `()`
found reference `&_`
LL | fn f() -> isize {
| ----- expected `isize` because of return type
LL | (return 1, return 2)
- | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found tuple
+ | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `(!, !)`
|
= note: expected type `isize`
found tuple `(!, !)`
//~^ ERROR mismatched types
//~| expected type `isize`
//~| found tuple `(!, !)`
-//~| expected `isize`, found tuple
+//~| expected `isize`, found `(!, !)`
}
fn main() {}
LL | fn f() -> isize {
| ----- expected `isize` because of return type
LL | (return 1, return 2)
- | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found tuple
+ | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `(!, !)`
|
= note: expected type `isize`
found tuple `(!, !)`
--> $DIR/issue-52443.rs:2:10
|
LL | [(); & { loop { continue } } ];
- | ^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found reference
+ | ^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_`
|
= note: expected type `usize`
found reference `&_`
LL | 0.....{loop{}1};
| ----^^^^^^^^^^^
| | |
- | | expected integer, found struct `RangeTo`
+ | | expected integer, found `RangeTo<{integer}>`
| arguments to this function are incorrect
|
= note: expected type `{integer}`
//~^ ERROR mismatched types
//~| expected type `isize`
//~| found enum `Option<isize>`
- //~| expected `isize`, found enum `Option`
+ //~| expected `isize`, found `Option<isize>`
}
--> $DIR/noexporttypeexe.rs:10:18
|
LL | let x: isize = noexporttypelib::foo();
- | ----- ^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found enum `Option`
+ | ----- ^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `Option<isize>`
| |
| expected due to this
|
LL | let (B(A(a, _) | B(a)) | A(a, A(a, _) | B(a))) = B(B(1));
| - ^ ------- this expression has type `E<E<{integer}>>`
| | |
- | | expected integer, found enum `E`
+ | | expected integer, found `E<{integer}>`
| first introduced with type `{integer}` here
|
= note: expected type `{integer}`
LL | let &A(_) | B(_): F = A(3);
| ^^^^^ - expected due to this
| |
- | expected enum `F`, found reference
+ | expected `F`, found `&_`
|
= note: expected enum `F`
found reference `&_`
LL | let &&A(_) | B(_): F = A(3);
| ^^^^^^ - expected due to this
| |
- | expected enum `F`, found reference
+ | expected `F`, found `&_`
|
= note: expected enum `F`
found reference `&_`
LL | let &mut A(_) | B(_): F = A(3);
| ^^^^^^^^^ - expected due to this
| |
- | expected enum `F`, found `&mut _`
+ | expected `F`, found `&mut _`
|
= note: expected enum `F`
found mutable reference `&mut _`
LL | let &&mut A(_) | B(_): F = A(3);
| ^^^^^^^^^^ - expected due to this
| |
- | expected enum `F`, found reference
+ | expected `F`, found `&_`
|
= note: expected enum `F`
found reference `&_`
--> $DIR/issue-87812-path.rs:3:24
|
LL | let _: usize = $f;
- | ----- ^^ expected `usize`, found struct `Baz`
+ | ----- ^^ expected `usize`, found `Baz`
| |
| expected due to this
...
LL | if let X.. .0 = 0 {}
| - ^^ - this expression has type `u8`
| | |
- | | expected integer, found floating-point number
+ | | expected `u8`, found floating-point number
| this is of type `u8`
|
= note: expected type `u8`
LL | if let X..=.0 = 0 {}
| - ^^ - this expression has type `u8`
| | |
- | | expected integer, found floating-point number
+ | | expected `u8`, found floating-point number
| this is of type `u8`
|
= note: expected type `u8`
LL | if let X... .0 = 0 {}
| - ^^ - this expression has type `u8`
| | |
- | | expected integer, found floating-point number
+ | | expected `u8`, found floating-point number
| this is of type `u8`
|
= note: expected type `u8`
--> $DIR/unclosed-delimiter-in-dep.rs:4:20
|
LL | let _: usize = unclosed_delim_mod::new();
- | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found enum `Result`
+ | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `Result<Value, ()>`
| |
| expected due to this
|
LL | for Some(Qux(_)) | None in [Some(""), None] {
| ^^^^^^ ---------------- this is an iterator with items of type `Option<&str>`
| |
- | expected `str`, found struct `Qux`
+ | expected `str`, found `Qux`
error: aborting due to 2 previous errors
LL | let P() = U {};
| ^^^ ---- this expression has type `U`
| |
- | expected struct `U`, found struct `P`
+ | expected `U`, found `P<_>`
|
= note: expected struct `U`
found struct `P<_>`
LL | match (S { f: 42 }) {
| ------------- this expression has type `S`
LL | S { f: Ok(_) } => {}
- | ^^^^^ expected `u8`, found enum `Result`
+ | ^^^^^ expected `u8`, found `Result<_, _>`
|
= note: expected type `u8`
found enum `Result<_, _>`
LL | fn foo(Tuple(_): String) {}
| ^^^^^^^^ ------ expected due to this
| |
- | expected struct `String`, found struct `Tuple`
+ | expected `String`, found `Tuple`
error: aborting due to previous error
--> $DIR/pat-type-err-let-stmt.rs:6:29
|
LL | let Ok(0): Option<u8> = 42u8;
- | ---------- ^^^^ expected enum `Option`, found `u8`
+ | ---------- ^^^^ expected `Option<u8>`, found `u8`
| |
| expected due to this
|
LL | let Ok(0): Option<u8> = 42u8;
| ^^^^^ ---------- expected due to this
| |
- | expected enum `Option`, found enum `Result`
+ | expected `Option<u8>`, found `Result<_, _>`
|
= note: expected enum `Option<u8>`
found enum `Result<_, _>`
LL | let Ok(0): Option<u8>;
| ^^^^^ ---------- expected due to this
| |
- | expected enum `Option`, found enum `Result`
+ | expected `Option<u8>`, found `Result<_, _>`
|
= note: expected enum `Option<u8>`
found enum `Result<_, _>`
LL | let Ok(0) = 42u8;
| ^^^^^ ---- this expression has type `u8`
| |
- | expected `u8`, found enum `Result`
+ | expected `u8`, found `Result<_, _>`
|
= note: expected type `u8`
found enum `Result<_, _>`
match 'c' {
S { .. } => (),
//~^ ERROR mismatched types
- //~| expected `char`, found struct `S`
+ //~| expected `char`, found `S`
_ => ()
}
LL | match 'c' {
| --- this expression has type `char`
LL | S { .. } => (),
- | ^^^^^^^^ expected `char`, found struct `S`
+ | ^^^^^^^^ expected `char`, found `S`
error[E0308]: mismatched types
--> $DIR/pattern-error-continue.rs:28:7
LL | match Some("foo") {
| ----------- this expression has type `Option<&str>`
LL | None::<isize> => {}
- | ^^^^^^^^^^^^^ expected `&str`, found `isize`
+ | ^^^^^^^^^^^^^ expected `Option<&str>`, found `Option<isize>`
|
= note: expected enum `Option<&str>`
found enum `Option<isize>`
LL | match t {
| - this expression has type `Bar`
LL | Bar::T1(_, Some::<isize>(x)) => {
- | ^^^^^^^^^^^^^^^^ expected struct `Vec`, found `isize`
+ | ^^^^^^^^^^^^^^^^ expected `Option<Vec<isize>>`, found `Option<isize>`
|
= note: expected enum `Option<Vec<isize>>`
found enum `Option<isize>`
--> $DIR/point-to-type-err-cause-on-impl-trait-return-2.rs:9:41
|
LL | let value: &bool = unsafe { &42 };
- | ^^^ expected `bool`, found integer
+ | ^^^ expected `&bool`, found `&{integer}`
|
= note: expected reference `&bool`
found reference `&{integer}`
--> $DIR/break-token-spans.rs:14:32
|
LL | let a: Option<Option<u8>>= true;
- | ------------------ ^^^^ expected enum `Option`, found `bool`
+ | ------------------ ^^^^ expected `Option<Option<u8>>`, found `bool`
| |
| expected due to this
|
LL | std::cell::Cell::new(0)
| ^^^^^^^^^^^^^^^^^^^^^^^- help: consider using a semicolon here: `;`
| |
- | expected `()`, found struct `Cell`
+ | expected `()`, found `Cell<{integer}>`
|
= note: expected unit type `()`
found struct `Cell<{integer}>`
LL | fn main() {
| - expected `()` because of default return type
LL | resolve_located_at!(a b)
- | ^ expected `()`, found struct `S`
+ | ^ expected `()`, found `S`
|
= note: this error originates in the macro `resolve_located_at` (in Nightly builds, run with -Z macro-backtrace for more info)
LL | take_range(std::ops::Range { start: 0, end: 1 });
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `Range`
+ | | expected `&_`, found `Range<{integer}>`
| | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }`
| arguments to this function are incorrect
|
LL | take_range(::std::ops::Range { start: 0, end: 1 });
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `Range`
+ | | expected `&_`, found `Range<{integer}>`
| | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }`
| arguments to this function are incorrect
|
LL | take_range(std::ops::RangeFrom { start: 1 });
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `RangeFrom`
+ | | expected `&_`, found `RangeFrom<{integer}>`
| | help: consider borrowing here: `&std::ops::RangeFrom { start: 1 }`
| arguments to this function are incorrect
|
LL | take_range(::std::ops::RangeFrom { start: 1 });
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `RangeFrom`
+ | | expected `&_`, found `RangeFrom<{integer}>`
| | help: consider borrowing here: `&::std::ops::RangeFrom { start: 1 }`
| arguments to this function are incorrect
|
LL | take_range(std::ops::RangeFull {});
| ---------- ^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `RangeFull`
+ | | expected `&_`, found `RangeFull`
| | help: consider borrowing here: `&std::ops::RangeFull {}`
| arguments to this function are incorrect
|
LL | take_range(::std::ops::RangeFull {});
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `RangeFull`
+ | | expected `&_`, found `RangeFull`
| | help: consider borrowing here: `&::std::ops::RangeFull {}`
| arguments to this function are incorrect
|
LL | take_range(std::ops::RangeInclusive::new(0, 1));
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `RangeInclusive`
+ | | expected `&_`, found `RangeInclusive<{integer}>`
| | help: consider borrowing here: `&std::ops::RangeInclusive::new(0, 1)`
| arguments to this function are incorrect
|
LL | take_range(::std::ops::RangeInclusive::new(0, 1));
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `RangeInclusive`
+ | | expected `&_`, found `RangeInclusive<{integer}>`
| | help: consider borrowing here: `&::std::ops::RangeInclusive::new(0, 1)`
| arguments to this function are incorrect
|
LL | take_range(std::ops::RangeTo { end: 5 });
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `RangeTo`
+ | | expected `&_`, found `RangeTo<{integer}>`
| | help: consider borrowing here: `&std::ops::RangeTo { end: 5 }`
| arguments to this function are incorrect
|
LL | take_range(::std::ops::RangeTo { end: 5 });
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `RangeTo`
+ | | expected `&_`, found `RangeTo<{integer}>`
| | help: consider borrowing here: `&::std::ops::RangeTo { end: 5 }`
| arguments to this function are incorrect
|
LL | take_range(std::ops::RangeToInclusive { end: 5 });
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `RangeToInclusive`
+ | | expected `&_`, found `RangeToInclusive<{integer}>`
| | help: consider borrowing here: `&std::ops::RangeToInclusive { end: 5 }`
| arguments to this function are incorrect
|
LL | take_range(::std::ops::RangeToInclusive { end: 5 });
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | |
- | | expected reference, found struct `RangeToInclusive`
+ | | expected `&_`, found `RangeToInclusive<{integer}>`
| | help: consider borrowing here: `&::std::ops::RangeToInclusive { end: 5 }`
| arguments to this function are incorrect
|
LL | take_range(0..1);
| ---------- ^^^^
| | |
- | | expected reference, found struct `Range`
+ | | expected `&_`, found `Range<{integer}>`
| | help: consider borrowing here: `&(0..1)`
| arguments to this function are incorrect
|
LL | take_range(1..);
| ---------- ^^^
| | |
- | | expected reference, found struct `RangeFrom`
+ | | expected `&_`, found `RangeFrom<{integer}>`
| | help: consider borrowing here: `&(1..)`
| arguments to this function are incorrect
|
LL | take_range(..);
| ---------- ^^
| | |
- | | expected reference, found struct `RangeFull`
+ | | expected `&_`, found `RangeFull`
| | help: consider borrowing here: `&(..)`
| arguments to this function are incorrect
|
LL | take_range(0..=1);
| ---------- ^^^^^
| | |
- | | expected reference, found struct `RangeInclusive`
+ | | expected `&_`, found `RangeInclusive<{integer}>`
| | help: consider borrowing here: `&(0..=1)`
| arguments to this function are incorrect
|
LL | take_range(..5);
| ---------- ^^^
| | |
- | | expected reference, found struct `RangeTo`
+ | | expected `&_`, found `RangeTo<{integer}>`
| | help: consider borrowing here: `&(..5)`
| arguments to this function are incorrect
|
LL | take_range(..=42);
| ---------- ^^^^^
| | |
- | | expected reference, found struct `RangeToInclusive`
+ | | expected `&_`, found `RangeToInclusive<{integer}>`
| | help: consider borrowing here: `&(..=42)`
| arguments to this function are incorrect
|
LL | take_range(0..1);
| ---------- ^^^^
| | |
- | | expected reference, found struct `Range`
+ | | expected `&_`, found `Range<{integer}>`
| | help: consider borrowing here: `&(0..1)`
| arguments to this function are incorrect
|
LL | take_range(1..);
| ---------- ^^^
| | |
- | | expected reference, found struct `RangeFrom`
+ | | expected `&_`, found `RangeFrom<{integer}>`
| | help: consider borrowing here: `&(1..)`
| arguments to this function are incorrect
|
LL | take_range(..);
| ---------- ^^
| | |
- | | expected reference, found struct `RangeFull`
+ | | expected `&_`, found `RangeFull`
| | help: consider borrowing here: `&(..)`
| arguments to this function are incorrect
|
LL | take_range(0..=1);
| ---------- ^^^^^
| | |
- | | expected reference, found struct `RangeInclusive`
+ | | expected `&_`, found `RangeInclusive<{integer}>`
| | help: consider borrowing here: `&(0..=1)`
| arguments to this function are incorrect
|
LL | take_range(..5);
| ---------- ^^^
| | |
- | | expected reference, found struct `RangeTo`
+ | | expected `&_`, found `RangeTo<{integer}>`
| | help: consider borrowing here: `&(..5)`
| arguments to this function are incorrect
|
LL | take_range(..=42);
| ---------- ^^^^^
| | |
- | | expected reference, found struct `RangeToInclusive`
+ | | expected `&_`, found `RangeToInclusive<{integer}>`
| | help: consider borrowing here: `&(..=42)`
| arguments to this function are incorrect
|
LL | demo(tell(1)..tell(10));
| ---- ^^^^^^^^^^^^^^^^^
| | |
- | | expected `&Range<usize>`, found struct `Range`
+ | | expected `&Range<usize>`, found `Range<usize>`
| | help: consider borrowing here: `&(tell(1)..tell(10))`
| arguments to this function are incorrect
|
LL | demo(1..10);
| ---- ^^^^^
| | |
- | | expected `&Range<usize>`, found struct `Range`
+ | | expected `&Range<usize>`, found `Range<{integer}>`
| | help: consider borrowing here: `&(1..10)`
| arguments to this function are incorrect
|
}
let g = [0; G { g: () }];
//~^ ERROR mismatched types
- //~| expected `usize`, found struct `G`
+ //~| expected `usize`, found `G`
}
--> $DIR/repeat_count.rs:31:17
|
LL | let g = [0; G { g: () }];
- | ^^^^^^^^^^^ expected `usize`, found struct `G`
+ | ^^^^^^^^^^^ expected `usize`, found `G`
error[E0308]: mismatched types
--> $DIR/repeat_count.rs:19:17
LL | let None: isize = 42;
| ^^^^ ----- expected due to this
| |
- | expected `isize`, found enum `Option`
+ | expected `isize`, found `Option<_>`
|
= note: expected type `isize`
found enum `Option<_>`
| -- `Fn` defines an enum variant constructor here, which should be called
...
LL | let _: Z = Z::Fn;
- | - ^^^^^ expected enum `Z`, found enum constructor
+ | - ^^^^^ expected `Z`, found enum constructor
| |
| expected due to this
|
| -- `Fn` defines an enum variant constructor here, which should be called
...
LL | let _: E = m::E::Fn;
- | - ^^^^^^^^ expected enum `E`, found enum constructor
+ | - ^^^^^^^^ expected `E`, found enum constructor
| |
| expected due to this
|
| -- `Fn` defines an enum variant constructor here, which should be called
...
LL | let _: E = E::Fn;
- | - ^^^^^ expected enum `E`, found enum constructor
+ | - ^^^^^ expected `E`, found enum constructor
| |
| expected due to this
|
LL | match x {
| - this expression has type `(E, E)`
LL | (A, B) | (ref B, c) | (c, A) => ()
- | - ^^^^^ expected enum `E`, found `&E`
+ | - ^^^^^ expected `E`, found `&E`
| |
| first introduced with type `E` here
|
--> $DIR/return-type.rs:10:5
|
LL | foo(4 as usize)
- | ^^^^^^^^^^^^^^^ expected `()`, found struct `S`
+ | ^^^^^^^^^^^^^^^ expected `()`, found `S<usize>`
|
= note: expected unit type `()`
found struct `S<usize>`
|
LL | / if x {
LL | | Err(42)
- | | ^^^^^^^ expected `()`, found enum `Result`
+ | | ^^^^^^^ expected `()`, found `Result<_, {integer}>`
LL | | //| HELP you might have meant to return this value
LL | | }
| |_____- expected this to be `()`
|
LL | / if x {
LL | | Err(42)
- | | ^^^^^^^ expected `()`, found enum `Result`
+ | | ^^^^^^^ expected `()`, found `Result<_, {integer}>`
LL | | //| HELP you might have meant to return this value
LL | | }
| |_____- expected this to be `()`
LL | FOO => {},
| ^^^
| |
- | expected `&Foo`, found struct `Foo`
+ | expected `&Foo`, found `Foo`
| `FOO` is interpreted as a constant, not a new binding
| help: introduce a new binding instead: `other_foo`
LL | match &s {
| -- this expression has type `&&str`
LL | "abc" => true,
- | ^^^^^ expected `&str`, found `str`
+ | ^^^^^ expected `&&str`, found `&str`
|
= note: expected reference `&&str`
found reference `&'static str`
LL | match &s {
| -- this expression has type `&&[u8]`
LL | b"abc" => true,
- | ^^^^^^ expected `&[u8]`, found array `[u8; 3]`
+ | ^^^^^^ expected `&&[u8]`, found `&[u8; 3]`
|
= note: expected reference `&&[u8]`
found reference `&'static [u8; 3]`
LL | fn cannot_coerce_empty_enum_to_anything(x: UninhabitedEnum) -> A {
| - expected `A` because of return type
LL | x
- | ^ expected struct `A`, found enum `UninhabitedEnum`
+ | ^ expected `A`, found `UninhabitedEnum`
error[E0308]: mismatched types
--> $DIR/coercions.rs:27:5
LL | fn cannot_coerce_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A {
| - expected `A` because of return type
LL | x
- | ^ expected struct `A`, found struct `UninhabitedTupleStruct`
+ | ^ expected `A`, found `UninhabitedTupleStruct`
error[E0308]: mismatched types
--> $DIR/coercions.rs:31:5
LL | fn cannot_coerce_empty_struct_to_anything(x: UninhabitedStruct) -> A {
| - expected `A` because of return type
LL | x
- | ^ expected struct `A`, found struct `UninhabitedStruct`
+ | ^ expected `A`, found `UninhabitedStruct`
error[E0308]: mismatched types
--> $DIR/coercions.rs:35:5
LL | fn cannot_coerce_enum_with_empty_variants_to_anything(x: UninhabitedVariants) -> A {
| - expected `A` because of return type
LL | x
- | ^ expected struct `A`, found enum `UninhabitedVariants`
+ | ^ expected `A`, found `UninhabitedVariants`
error: aborting due to 4 previous errors
LL | fn cannot_coerce_empty_enum_to_anything(x: UninhabitedEnum) -> A {
| - expected `A` because of return type
LL | x
- | ^ expected struct `A`, found enum `UninhabitedEnum`
+ | ^ expected `A`, found `UninhabitedEnum`
error[E0308]: mismatched types
--> $DIR/coercions_same_crate.rs:34:5
LL | fn cannot_coerce_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A {
| - expected `A` because of return type
LL | x
- | ^ expected struct `A`, found struct `UninhabitedTupleStruct`
+ | ^ expected `A`, found `UninhabitedTupleStruct`
error[E0308]: mismatched types
--> $DIR/coercions_same_crate.rs:38:5
LL | fn cannot_coerce_empty_struct_to_anything(x: UninhabitedStruct) -> A {
| - expected `A` because of return type
LL | x
- | ^ expected struct `A`, found struct `UninhabitedStruct`
+ | ^ expected `A`, found `UninhabitedStruct`
error[E0308]: mismatched types
--> $DIR/coercions_same_crate.rs:42:5
LL | fn cannot_coerce_enum_with_empty_variants_to_anything(x: UninhabitedVariants) -> A {
| - expected `A` because of return type
LL | x
- | ^ expected struct `A`, found enum `UninhabitedVariants`
+ | ^ expected `A`, found `UninhabitedVariants`
error: aborting due to 4 previous errors
LL | Ok(x) if let Err(_) = x => {},
| ^^^^^^ - this expression has type `Option<bool>`
| |
- | expected enum `Option`, found enum `Result`
+ | expected `Option<bool>`, found `Result<_, _>`
|
= note: expected enum `Option<bool>`
found enum `Result<_, _>`
LL | Ok(x) if let 0 = x => {},
| ^ - this expression has type `Option<bool>`
| |
- | expected enum `Option`, found integer
+ | expected `Option<bool>`, found integer
|
= note: expected enum `Option<bool>`
found type `{integer}`
--> $DIR/disallowed-positions.rs:157:8
|
LL | if true..(let 0 = 0) {}
- | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
= note: expected type `bool`
found struct `std::ops::Range<bool>`
--> $DIR/disallowed-positions.rs:161:8
|
LL | if ..(let 0 = 0) {}
- | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeTo`
+ | ^^^^^^^^^^^^^ expected `bool`, found `RangeTo<bool>`
|
= note: expected type `bool`
found struct `RangeTo<bool>`
--> $DIR/disallowed-positions.rs:165:8
|
LL | if (let 0 = 0).. {}
- | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeFrom`
+ | ^^^^^^^^^^^^^ expected `bool`, found `RangeFrom<bool>`
|
= note: expected type `bool`
found struct `RangeFrom<bool>`
LL | if let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
| |
- | expected `bool`, found struct `Range`
+ | expected `bool`, found `Range<_>`
|
= note: expected type `bool`
found struct `std::ops::Range<_>`
--> $DIR/disallowed-positions.rs:171:8
|
LL | if let Range { start: _, end: _ } = true..true && false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
= note: expected type `bool`
found struct `std::ops::Range<bool>`
LL | if let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
| |
- | expected `bool`, found struct `Range`
+ | expected `bool`, found `Range<_>`
|
= note: expected type `bool`
found struct `std::ops::Range<_>`
--> $DIR/disallowed-positions.rs:175:8
|
LL | if let Range { start: _, end: _ } = true..true || false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
= note: expected type `bool`
found struct `std::ops::Range<bool>`
LL | if let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
| |
- | expected fn pointer, found struct `Range`
+ | expected fn pointer, found `Range<_>`
|
= note: expected fn pointer `fn() -> bool`
found struct `std::ops::Range<_>`
--> $DIR/disallowed-positions.rs:182:8
|
LL | if let Range { start: F, end } = F..|| true {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
= note: expected type `bool`
found struct `std::ops::Range<bool>`
LL | if let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
| |
- | expected `bool`, found struct `Range`
+ | expected `bool`, found `Range<_>`
|
= note: expected type `bool`
found struct `std::ops::Range<_>`
--> $DIR/disallowed-positions.rs:190:8
|
LL | if let Range { start: true, end } = t..&&false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
= note: expected type `bool`
found struct `std::ops::Range<bool>`
--> $DIR/disallowed-positions.rs:249:11
|
LL | while true..(let 0 = 0) {}
- | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
= note: expected type `bool`
found struct `std::ops::Range<bool>`
--> $DIR/disallowed-positions.rs:253:11
|
LL | while ..(let 0 = 0) {}
- | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeTo`
+ | ^^^^^^^^^^^^^ expected `bool`, found `RangeTo<bool>`
|
= note: expected type `bool`
found struct `RangeTo<bool>`
--> $DIR/disallowed-positions.rs:257:11
|
LL | while (let 0 = 0).. {}
- | ^^^^^^^^^^^^^ expected `bool`, found struct `RangeFrom`
+ | ^^^^^^^^^^^^^ expected `bool`, found `RangeFrom<bool>`
|
= note: expected type `bool`
found struct `RangeFrom<bool>`
LL | while let Range { start: _, end: _ } = true..true && false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
| |
- | expected `bool`, found struct `Range`
+ | expected `bool`, found `Range<_>`
|
= note: expected type `bool`
found struct `std::ops::Range<_>`
--> $DIR/disallowed-positions.rs:263:11
|
LL | while let Range { start: _, end: _ } = true..true && false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
= note: expected type `bool`
found struct `std::ops::Range<bool>`
LL | while let Range { start: _, end: _ } = true..true || false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
| |
- | expected `bool`, found struct `Range`
+ | expected `bool`, found `Range<_>`
|
= note: expected type `bool`
found struct `std::ops::Range<_>`
--> $DIR/disallowed-positions.rs:267:11
|
LL | while let Range { start: _, end: _ } = true..true || false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
= note: expected type `bool`
found struct `std::ops::Range<bool>`
LL | while let Range { start: F, end } = F..|| true {}
| ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool`
| |
- | expected fn pointer, found struct `Range`
+ | expected fn pointer, found `Range<_>`
|
= note: expected fn pointer `fn() -> bool`
found struct `std::ops::Range<_>`
--> $DIR/disallowed-positions.rs:274:11
|
LL | while let Range { start: F, end } = F..|| true {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
= note: expected type `bool`
found struct `std::ops::Range<bool>`
LL | while let Range { start: true, end } = t..&&false {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool`
| |
- | expected `bool`, found struct `Range`
+ | expected `bool`, found `Range<_>`
|
= note: expected type `bool`
found struct `std::ops::Range<_>`
--> $DIR/disallowed-positions.rs:282:11
|
LL | while let Range { start: true, end } = t..&&false {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>`
|
= note: expected type `bool`
found struct `std::ops::Range<bool>`
LL | (let Range { start: _, end: _ } = true..true || false);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool`
| |
- | expected `bool`, found struct `Range`
+ | expected `bool`, found `Range<_>`
|
= note: expected type `bool`
found struct `std::ops::Range<_>`
--> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19
|
LL | let Some(n) = opt && n == 1 else {
- | ^^^ expected `bool`, found enum `Option`
+ | ^^^ expected `bool`, found `Option<i32>`
|
= note: expected type `bool`
found enum `Option<i32>`
LL | let Some(n) = opt && n == 1 else {
| ^^^^^^^ ------------- this expression has type `bool`
| |
- | expected `bool`, found enum `Option`
+ | expected `bool`, found `Option<_>`
|
= note: expected type `bool`
found enum `Option<_>`
--> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19
|
LL | let Some(n) = opt && let another = n else {
- | ^^^ expected `bool`, found enum `Option`
+ | ^^^ expected `bool`, found `Option<i32>`
|
= note: expected type `bool`
found enum `Option<i32>`
LL | let Some(n) = opt && let another = n else {
| ^^^^^^^ ---------------------- this expression has type `bool`
| |
- | expected `bool`, found enum `Option`
+ | expected `bool`, found `Option<_>`
|
= note: expected type `bool`
found enum `Option<_>`
--> $DIR/feature-gate.rs:22:11
|
LL | ..m1
- | ^^ expected struct `State2`, found struct `State1`
+ | ^^ expected `Machine<State2>`, found `Machine<State1>`
|
= note: expected struct `Machine<State2>`
found struct `Machine<State1>`
--> $DIR/issue-92010-trait-bound-not-satisfied.rs:8:43
|
LL | fn y(&self, y: f64) -> Self { P{y, .. self.clone() } }
- | ^^^^^^^^^^^^ expected struct `P`, found `&P<T>`
+ | ^^^^^^^^^^^^ expected `P<T>`, found `&P<T>`
|
= note: expected struct `P<T>`
found reference `&P<T>`
--> $DIR/type-generic-update.rs:46:11
|
LL | ..m1
- | ^^ expected `i32`, found `f64`
+ | ^^ expected `Machine<'_, i32, f64>`, found `Machine<'_, f64, f64>`
|
= note: expected struct `Machine<'_, i32, _>`
found struct `Machine<'_, f64, _>`
--> $DIR/type-generic-update.rs:51:11
|
LL | ..m1
- | ^^ expected `i32`, found `f64`
+ | ^^ expected `Machine<'_, i32, i32>`, found `Machine<'_, f64, f64>`
|
= note: expected struct `Machine<'_, i32, i32>`
found struct `Machine<'_, f64, f64>`
--> $DIR/issue-61882.rs:4:22
|
LL | const B: A<u8> = Self(0);
- | ^^^^^^^ expected `u8`, found `bool`
+ | ^^^^^^^ expected `A<u8>`, found `A<bool>`
|
= note: expected struct `A<u8>`
found struct `A<bool>`
//~^ ERROR mismatched types
//~| expected struct `Foo<{float}, _>`
//~| found type `{integer}`
- //~| expected struct `Foo`, found integer
+ //~| expected `Foo<{float}, _>`, found integer
}
}
LL | match Foo(1.1, marker::PhantomData) {
| ----------------------------- this expression has type `Foo<{float}, _>`
LL | 1 => {}
- | ^ expected struct `Foo`, found integer
+ | ^ expected `Foo<{float}, _>`, found integer
|
= note: expected struct `Foo<{float}, _>`
found type `{integer}`
--> $DIR/coerce-suggestions.rs:7:20
|
LL | let x: usize = String::new();
- | ----- ^^^^^^^^^^^^^ expected `usize`, found struct `String`
+ | ----- ^^^^^^^^^^^^^ expected `usize`, found `String`
| |
| expected due to this
LL | let x: &str = String::new();
| ---- ^^^^^^^^^^^^^
| | |
- | | expected `&str`, found struct `String`
+ | | expected `&str`, found `String`
| | help: consider borrowing here: `&String::new()`
| expected due to this
--> $DIR/coerce-suggestions.rs:21:9
|
LL | s = format!("foo");
- | ^^^^^^^^^^^^^^ expected `&mut String`, found struct `String`
+ | ^^^^^^^^^^^^^^ expected `&mut String`, found `String`
|
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
--> $DIR/issue-33884.rs:6:22
|
LL | stream.write_fmt(format!("message received"))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Arguments`, found struct `String`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Arguments<'_>`, found `String`
|
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
LL | let _ = a + b;
| ^
| |
- | expected `&str`, found struct `String`
+ | expected `&str`, found `String`
| help: consider borrowing here: `&b`
error[E0369]: cannot add `String` to `&String`
LL | default fn generate(self) -> Self::Output {
| ------------ expected `<T as Example>::Output` because of return type
LL | Box::new(self)
- | ^^^^^^^^^^^^^^ expected associated type, found struct `Box`
+ | ^^^^^^^^^^^^^^ expected associated type, found `Box<T>`
|
= note: expected associated type `<T as Example>::Output`
found struct `Box<T>`
LL | fn trouble<T>(t: T) -> Box<T> {
| ------ expected `Box<T>` because of return type
LL | Example::generate(t)
- | ^^^^^^^^^^^^^^^^^^^^ expected struct `Box`, found associated type
+ | ^^^^^^^^^^^^^^^^^^^^ expected `Box<T>`, found associated type
|
= note: expected struct `Box<T>`
found associated type `<T as Example>::Output`
static i: String = 10;
//~^ ERROR mismatched types
-//~| expected struct `String`, found integer
+//~| expected `String`, found integer
fn main() { println!("{}", i); }
LL | static i: String = 10;
| ^^- help: try using a conversion method: `.to_string()`
| |
- | expected struct `String`, found integer
+ | expected `String`, found integer
error: aborting due to previous error
--> $DIR/issue-5216.rs:3:21
|
LL | pub static C: S = S(f);
- | - ^ expected struct `Box`, found fn item
+ | - ^ expected `Box<dyn FnMut() + Sync>`, found fn item
| |
| arguments to this struct are incorrect
|
--> $DIR/issue-5216.rs:8:19
|
LL | pub static D: T = g;
- | ^ expected struct `Box`, found fn item
+ | ^ expected `Box<dyn FnMut() + Sync>`, found fn item
|
= note: expected struct `Box<(dyn FnMut() + Sync + 'static)>`
found fn item `fn() {g}`
LL | func: &foo,
| ^^^^
| |
- | expected fn pointer, found fn item
+ | expected `&fn() -> Option<isize>`, found `&fn() -> Option<isize> {foo}`
| help: consider casting to a fn pointer: `&(foo as fn() -> Option<isize>)`
|
= note: expected reference `&fn() -> Option<isize>`
--> $DIR/str-lit-type-mismatch.rs:2:20
|
LL | let x: &[u8] = "foo";
- | ----- ^^^^^ expected slice `[u8]`, found `str`
+ | ----- ^^^^^ expected `&[u8]`, found `&str`
| |
| expected due to this
|
--> $DIR/str-lit-type-mismatch.rs:3:23
|
LL | let y: &[u8; 4] = "baaa";
- | -------- ^^^^^^ expected array `[u8; 4]`, found `str`
+ | -------- ^^^^^^ expected `&[u8; 4]`, found `&str`
| |
| expected due to this
|
--> $DIR/str-lit-type-mismatch.rs:4:19
|
LL | let z: &str = b"foo";
- | ---- ^^^^^^ expected `str`, found array `[u8; 3]`
+ | ---- ^^^^^^ expected `&str`, found `&[u8; 3]`
| |
| expected due to this
|
--> $DIR/struct-base-wrong-type.rs:7:33
|
LL | static foo: Foo = Foo { a: 2, ..bar };
- | ^^^ expected struct `Foo`, found struct `Bar`
+ | ^^^ expected `Foo`, found `Bar`
error[E0308]: mismatched types
--> $DIR/struct-base-wrong-type.rs:8:35
|
LL | static foo_i: Foo = Foo { a: 2, ..4 };
- | ^ expected struct `Foo`, found integer
+ | ^ expected `Foo`, found integer
error[E0308]: mismatched types
--> $DIR/struct-base-wrong-type.rs:12:27
|
LL | let f = Foo { a: 2, ..b };
- | ^ expected struct `Foo`, found struct `Bar`
+ | ^ expected `Foo`, found `Bar`
error[E0308]: mismatched types
--> $DIR/struct-base-wrong-type.rs:13:34
|
LL | let f__isize = Foo { a: 2, ..4 };
- | ^ expected struct `Foo`, found integer
+ | ^ expected `Foo`, found integer
error: aborting due to 4 previous errors
LL | | inner: u
LL | |
LL | | }
- | |_________^ expected type parameter `U`, found type parameter `T`
+ | |_________^ expected `Foo<U>`, found `Foo<T>`
|
= note: expected struct `Foo<U>`
found struct `Foo<T>`
--> $DIR/struct-record-suggestion.rs:23:20
|
LL | let q = B { b: 1..Default::default() };
- | ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `Range<{integer}>`
|
= note: expected type `u32`
found struct `std::ops::Range<{integer}>`
LL | match (Point { x: 1, y: 2 }) {
| ---------------------- this expression has type `Point<{integer}>`
LL | PointF::<u32> { .. } => {}
- | ^^^^^^^^^^^^^^^^^^^^ expected integer, found `f32`
+ | ^^^^^^^^^^^^^^^^^^^^ expected `Point<{integer}>`, found `Point<f32>`
|
= note: expected struct `Point<{integer}>`
found struct `Point<f32>`
LL | match (Point { x: 1, y: 2 }) {
| ---------------------- this expression has type `Point<{integer}>`
LL | PointF { .. } => {}
- | ^^^^^^^^^^^^^ expected integer, found `f32`
+ | ^^^^^^^^^^^^^ expected `Point<{integer}>`, found `Point<f32>`
|
= note: expected struct `Point<{integer}>`
found struct `Point<f32>`
LL | match (Pair { x: 1, y: 2 }) {
| --------------------- this expression has type `Pair<{integer}, {integer}>`
LL | PairF::<u32> { .. } => {}
- | ^^^^^^^^^^^^^^^^^^^ expected integer, found `f32`
+ | ^^^^^^^^^^^^^^^^^^^ expected `Pair<{integer}, {integer}>`, found `Pair<f32, u32>`
|
= note: expected struct `Pair<{integer}, {integer}>`
found struct `Pair<f32, u32>`
LL | let _: Option<(i32, bool)> = Some(1, 2);
| ^^^^ - argument of type `{integer}` unexpected
|
-note: expected tuple, found integer
+note: expected `(i32, bool)`, found integer
--> $DIR/args-instead-of-tuple-errors.rs:6:39
|
LL | let _: Option<(i32, bool)> = Some(1, 2);
LL | int_bool(1, 2);
| ^^^^^^^^ - argument of type `{integer}` unexpected
|
-note: expected tuple, found integer
+note: expected `(i32, bool)`, found integer
--> $DIR/args-instead-of-tuple-errors.rs:8:14
|
LL | int_bool(1, 2);
--> $DIR/args-instead-of-tuple-errors.rs:14:34
|
LL | let _: Option<(i32,)> = Some(5_usize);
- | ---- ^^^^^^^ expected tuple, found `usize`
+ | ---- ^^^^^^^ expected `(i32,)`, found `usize`
| |
| arguments to this enum variant are incorrect
|
--> $DIR/args-instead-of-tuple-errors.rs:17:34
|
LL | let _: Option<(i32,)> = Some((5_usize));
- | ---- ^^^^^^^^^ expected tuple, found `usize`
+ | ---- ^^^^^^^^^ expected `(i32,)`, found `usize`
| |
| arguments to this enum variant are incorrect
|
--> $DIR/args-instead-of-tuple.rs:14:34
|
LL | let _: Option<(i32,)> = Some(3);
- | ---- ^ expected tuple, found integer
+ | ---- ^ expected `(i32,)`, found integer
| |
| arguments to this enum variant are incorrect
|
--> $DIR/args-instead-of-tuple.rs:17:34
|
LL | let _: Option<(i32,)> = Some((3));
- | ---- ^^^ expected tuple, found integer
+ | ---- ^^^ expected `(i32,)`, found integer
| |
| arguments to this enum variant are incorrect
|
--> $DIR/as-ref.rs:7:29
|
LL | opt.map(|arg| takes_ref(arg));
- | --- --------- ^^^ expected `&Foo`, found struct `Foo`
+ | --- --------- ^^^ expected `&Foo`, found `Foo`
| | |
| | arguments to this function are incorrect
| help: consider using `as_ref` instead: `as_ref().map`
--> $DIR/as-ref.rs:8:39
|
LL | opt.and_then(|arg| Some(takes_ref(arg)));
- | -------- --------- ^^^ expected `&Foo`, found struct `Foo`
+ | -------- --------- ^^^ expected `&Foo`, found `Foo`
| | |
| | arguments to this function are incorrect
| help: consider using `as_ref` instead: `as_ref().and_then`
--> $DIR/as-ref.rs:10:29
|
LL | opt.map(|arg| takes_ref(arg));
- | --- --------- ^^^ expected `&Foo`, found struct `Foo`
+ | --- --------- ^^^ expected `&Foo`, found `Foo`
| | |
| | arguments to this function are incorrect
| help: consider using `as_ref` instead: `as_ref().map`
--> $DIR/as-ref.rs:11:37
|
LL | opt.and_then(|arg| Ok(takes_ref(arg)));
- | -------- --------- ^^^ expected `&Foo`, found struct `Foo`
+ | -------- --------- ^^^ expected `&Foo`, found `Foo`
| | |
| | arguments to this function are incorrect
| help: consider using `as_ref` instead: `as_ref().and_then`
LL | let y: Option<&usize> = x;
| -------------- ^
| | |
- | | expected enum `Option`, found `&Option<usize>`
+ | | expected `Option<&usize>`, found `&Option<usize>`
| | help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `x.as_ref()`
| expected due to this
|
--> $DIR/as-ref.rs:15:37
|
LL | let y: Result<&usize, &usize> = x;
- | ---------------------- ^ expected enum `Result`, found reference
+ | ---------------------- ^ expected `Result<&usize, &usize>`, found `&Result<usize, usize>`
| |
| expected due to this
|
--> $DIR/as-ref.rs:19:36
|
LL | let y: Result<&usize, usize> = x;
- | --------------------- ^ expected enum `Result`, found reference
+ | --------------------- ^ expected `Result<&usize, usize>`, found `&Result<usize, usize>`
| |
| expected due to this
|
--> $DIR/as-ref.rs:22:42
|
LL | multiple_ref_opt.map(|arg| takes_ref(arg));
- | --- --------- ^^^ expected `&Foo`, found struct `Foo`
+ | --- --------- ^^^ expected `&Foo`, found `Foo`
| | |
| | arguments to this function are incorrect
| help: consider using `as_ref` instead: `as_ref().map`
--> $DIR/as-ref.rs:23:52
|
LL | multiple_ref_opt.and_then(|arg| Some(takes_ref(arg)));
- | -------- --------- ^^^ expected `&Foo`, found struct `Foo`
+ | -------- --------- ^^^ expected `&Foo`, found `Foo`
| | |
| | arguments to this function are incorrect
| help: consider using `as_ref` instead: `as_ref().and_then`
--> $DIR/as-ref.rs:25:45
|
LL | multiple_ref_result.map(|arg| takes_ref(arg));
- | --- --------- ^^^ expected `&Foo`, found struct `Foo`
+ | --- --------- ^^^ expected `&Foo`, found `Foo`
| | |
| | arguments to this function are incorrect
| help: consider using `as_ref` instead: `as_ref().map`
--> $DIR/as-ref.rs:26:53
|
LL | multiple_ref_result.and_then(|arg| Ok(takes_ref(arg)));
- | -------- --------- ^^^ expected `&Foo`, found struct `Foo`
+ | -------- --------- ^^^ expected `&Foo`, found `Foo`
| | |
| | arguments to this function are incorrect
| help: consider using `as_ref` instead: `as_ref().and_then`
--> $DIR/boxed-variant-field.rs:9:31
|
LL | Ty::List(elem) => foo(elem),
- | --- ^^^^ expected enum `Ty`, found struct `Box`
+ | --- ^^^^ expected `Ty`, found `Box<Ty>`
| |
| arguments to this function are incorrect
|
LL | let y = Box::new(|| 1);
| -- the found closure
LL | x = y;
- | ^ expected `i32`, found struct `Box`
+ | ^ expected `i32`, found `Box<[closure@call-boxed.rs:3:22]>`
|
= note: expected type `i32`
found struct `Box<[closure@$DIR/call-boxed.rs:3:22: 3:24]>`
LL | fn foo(mut s: String) -> String {
| ------ expected `String` because of return type
LL | s.push_str("asdf")
- | ^^^^^^^^^^^^^^^^^^ expected struct `String`, found `()`
+ | ^^^^^^^^^^^^^^^^^^ expected `String`, found `()`
|
note: method `push_str` modifies its receiver in-place
--> $DIR/chain-method-call-mutation-in-place.rs:3:7
LL | fn wut(t: &Foo) -> Foo {
| --- expected `Foo` because of return type
LL | t.clone()
- | ^^^^^^^^^ expected struct `Foo`, found `&Foo`
+ | ^^^^^^^^^ expected `Foo`, found `&Foo`
|
note: `Foo` does not implement `Clone`, so `&Foo` was cloned instead
--> $DIR/clone-on-unconstrained-borrowed-type-param.rs:9:5
LL | let Thing { foo } = t;
| ^^^ - this expression has type `Thing`
| |
- | expected struct `String`, found struct `foo`
+ | expected `String`, found `foo`
| `foo` is interpreted as a unit struct, not a new binding
|
help: bind the struct field to a different name instead
--> $DIR/copied-and-cloned.rs:7:26
|
LL | expect::<Option<()>>(x);
- | -------------------- ^ expected `()`, found `&()`
+ | -------------------- ^ expected `Option<()>`, found `Option<&()>`
| |
| arguments to this function are incorrect
|
--> $DIR/copied-and-cloned.rs:11:30
|
LL | expect::<Result<(), ()>>(x);
- | ------------------------ ^ expected `()`, found `&()`
+ | ------------------------ ^ expected `Result<(), ()>`, found `Result<&(), _>`
| |
| arguments to this function are incorrect
|
--> $DIR/copied-and-cloned.rs:16:30
|
LL | expect::<Option<String>>(x);
- | ------------------------ ^ expected struct `String`, found `&String`
+ | ------------------------ ^ expected `Option<String>`, found `Option<&String>`
| |
| arguments to this function are incorrect
|
--> $DIR/copied-and-cloned.rs:20:34
|
LL | expect::<Result<String, ()>>(x);
- | ---------------------------- ^ expected struct `String`, found `&String`
+ | ---------------------------- ^ expected `Result<String, ()>`, found `Result<&String, _>`
| |
| arguments to this function are incorrect
|
LL | / intrinsic_match! {
LL | | "abc"
LL | | };
- | |_____^ expected `&str`, found struct `String`
+ | |_____^ expected `&str`, found `String`
|
= note: this error originates in the macro `format` which comes from the expansion of the macro `intrinsic_match` (in Nightly builds, run with -Z macro-backtrace for more info)
--> $DIR/hidden-child.rs:9:26
|
LL | let x: Option<i32> = 1i32;
- | ----------- ^^^^ expected enum `Option`, found `i32`
+ | ----------- ^^^^ expected `Option<i32>`, found `i32`
| |
| expected due to this
|
--> $DIR/hidden-parent.rs:6:26
|
LL | let x: Option<i32> = 1i32;
- | ----------- ^^^^ expected enum `Option`, found `i32`
+ | ----------- ^^^^ expected `Option<i32>`, found `i32`
| |
| expected due to this
|
| - this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
LL | // We could instead use an `async` block, but this way we have no std spans.
LL | x
- | ^ expected struct `Pin`, found type parameter `F`
+ | ^ expected `Pin<Box<...>>`, found type parameter `F`
|
= note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
found type parameter `F`
LL | fn bar<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
| ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
LL | Box::new(x)
- | ^^^^^^^^^^^ expected struct `Pin`, found struct `Box`
+ | ^^^^^^^^^^^ expected `Pin<Box<...>>`, found `Box<F>`
|
= note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
found struct `Box<F>`
LL | fn baz<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
| - this type parameter
LL | Pin::new(x)
- | -------- ^ expected struct `Box`, found type parameter `F`
+ | -------- ^ expected `Box<dyn Future<Output = ...> + Send>`, found type parameter `F`
| |
| arguments to this function are incorrect
| help: use `Box::pin` to pin and box this expression: `Box::pin`
LL | | }
| | ^
| | |
- | |_____expected struct `Pin`, found `async` block
+ | |_____expected `Pin<Box<...>>`, found `async` block
| arguments to this function are incorrect
|
= note: expected struct `Pin<Box<dyn Future<Output = i32> + Send>>`
LL | if let B::Fst = a {};
| ^^^^^^ - this expression has type `A`
| |
- | expected struct `A`, found enum `B`
+ | expected `A`, found `B`
|
help: you might have meant to use field `b` whose type is `B`
|
| - this expression has type `A`
...
LL | B::Fst => (),
- | ^^^^^^ expected struct `A`, found enum `B`
+ | ^^^^^^ expected `A`, found `B`
|
help: you might have meant to use field `b` whose type is `B`
|
| - this expression has type `A`
...
LL | B::Snd => (),
- | ^^^^^^ expected struct `A`, found enum `B`
+ | ^^^^^^ expected `A`, found `B`
|
help: you might have meant to use field `b` whose type is `B`
|
| --- this expression has type `Foo`
LL |
LL | 1u32 => (),
- | ^^^^ expected union `Foo`, found `u32`
+ | ^^^^ expected `Foo`, found `u32`
|
help: you might have meant to use field `bar` whose type is `u32`
|
| -------- `S` defines a struct constructor here, which should be called
...
LL | let _: S = S;
- | - ^ expected struct `S`, found struct constructor
+ | - ^ expected `S`, found struct constructor
| |
| expected due to this
|
| -------- `V` defines a struct constructor here, which should be called
...
LL | let _: V = V;
- | - ^ expected struct `V`, found struct constructor
+ | - ^ expected `V`, found struct constructor
| |
| expected due to this
|
| - `A` defines an enum variant constructor here, which should be called
...
LL | let _: E = E::A;
- | - ^^^^ expected enum `E`, found enum constructor
+ | - ^^^^ expected `E`, found enum constructor
| |
| expected due to this
|
--> $DIR/format-borrow.rs:2:21
|
LL | let a: String = &String::from("a");
- | ------ ^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&String`
+ | ------ ^^^^^^^^^^^^^^^^^^ expected `String`, found `&String`
| |
| expected due to this
|
--> $DIR/format-borrow.rs:4:21
|
LL | let b: String = &format!("b");
- | ------ ^^^^^^^^^^^^^ expected struct `String`, found `&String`
+ | ------ ^^^^^^^^^^^^^ expected `String`, found `&String`
| |
| expected due to this
|
--> $DIR/format-borrow.rs:6:21
|
LL | let c: String = &mut format!("c");
- | ------ ^^^^^^^^^^^^^^^^^ expected struct `String`, found `&mut String`
+ | ------ ^^^^^^^^^^^^^^^^^ expected `String`, found `&mut String`
| |
| expected due to this
|
--> $DIR/format-borrow.rs:8:21
|
LL | let d: String = &mut (format!("d"));
- | ------ ^^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&mut String`
+ | ------ ^^^^^^^^^^^^^^^^^^^ expected `String`, found `&mut String`
| |
| expected due to this
|
--> $DIR/into-convert.rs:6:16
|
LL | let x: A = B;
- | - ^ expected struct `A`, found struct `B`
+ | - ^ expected `A`, found `B`
| |
| expected due to this
|
--> $DIR/into-convert.rs:10:24
|
LL | let y: Arc<Path> = PathBuf::new();
- | --------- ^^^^^^^^^^^^^^ expected struct `Arc`, found struct `PathBuf`
+ | --------- ^^^^^^^^^^^^^^ expected `Arc<Path>`, found `PathBuf`
| |
| expected due to this
|
--> $DIR/into-convert.rs:14:24
|
LL | let z: AtomicU32 = 1;
- | --------- ^ expected struct `AtomicU32`, found integer
+ | --------- ^ expected `AtomicU32`, found integer
| |
| expected due to this
|
| | ---------------------------------- expected because of this
LL | | } else {
LL | | FakeResult::Ok(())
- | | ^^^^^^^^^^^^^^^^^^ expected enum `FakeResult`, found `()`
+ | | ^^^^^^^^^^^^^^^^^^ expected `FakeResult<FakeResult<()>>`, found `FakeResult<()>`
LL | | };
| |_____- `if` and `else` have incompatible types
|
LL | | true => B,
| | - this is found to be of type `B`
LL | | false => C,
- | | ^ expected struct `B`, found struct `C`
+ | | ^ expected `B`, found `C`
LL | |
LL | | }
| |_____- `match` arms have incompatible types
LL | let (cmp, router) = self.router.at()?;
| ^^^^^^^^^^^^^ ----------------- this expression has type `Match<&(for<'a> fn(&'a ()), Box<Wrapper>)>`
| |
- | expected struct `Match`, found tuple
+ | expected `Match<&(for<'a> fn(&'a ()), ...)>`, found `(_, _)`
|
= note: expected struct `Match<&(for<'a> fn(&'a ()), Box<Wrapper>)>`
found tuple `(_, _)`
--> $DIR/issue-102892.rs:15:26
|
LL | let (a, b): (A, B) = &**arc; // suggests putting `&**arc` here too
- | ------ ^^^^^^ expected tuple, found `&(A, B)`
+ | ------ ^^^^^^ expected `(A, B)`, found `&(A, B)`
| |
| expected due to this
|
--> $DIR/issue-102892.rs:20:32
|
LL | let (a, b): ((A, B), A) = (&mut *mutation, &(**arc).0); // suggests putting `&**arc` here too
- | ^^^^^^^^^^^^^^ expected tuple, found `&mut (A, B)`
+ | ^^^^^^^^^^^^^^ expected `(A, B)`, found `&mut (A, B)`
|
= note: expected tuple `(A, B)`
found mutable reference `&mut (A, B)`
--> $DIR/issue-102892.rs:20:48
|
LL | let (a, b): ((A, B), A) = (&mut *mutation, &(**arc).0); // suggests putting `&**arc` here too
- | ^^^^^^^^^^ expected struct `A`, found `&A`
+ | ^^^^^^^^^^ expected `A`, found `&A`
|
help: consider removing the borrow
|
--> $DIR/issue-105494.rs:2:19
|
LL | let _v: i32 = (1 as i32).to_string();
- | --- ^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String`
+ | --- ^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String`
| |
| expected due to this
|
--> $DIR/issue-105494.rs:5:19
|
LL | let _v: i32 = (1 as i128).to_string();
- | --- ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `String`
+ | --- ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String`
| |
| expected due to this
--> $DIR/issue-105494.rs:7:20
|
LL | let _v: &str = "foo".to_string();
- | ---- ^^^^^^^^^^^^^^^^^ expected `&str`, found struct `String`
+ | ---- ^^^^^^^^^^^^^^^^^ expected `&str`, found `String`
| |
| expected due to this
|
| ------ expected due to this type
...
LL | path = format!("{}/{}", path, folder).as_str();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&str`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `&str`
|
help: try removing the method call
|
--> $DIR/issue-106443-sugg-clone-for-arg.rs:11:9
|
LL | foo(s);
- | --- ^ expected struct `S`, found `&S`
+ | --- ^ expected `S`, found `&S`
| |
| arguments to this function are incorrect
|
--> $DIR/issue-106443-sugg-clone-for-arg.rs:17:9
|
LL | bar(t);
- | --- ^ expected struct `T`, found `&T`
+ | --- ^ expected `T`, found `&T`
| |
| arguments to this function are incorrect
|
--> $DIR/issue-52820.rs:12:9
|
LL | guts,
- | ^^^^ expected struct `String`, found `&str`
+ | ^^^^ expected `String`, found `&str`
|
help: try using a conversion method
|
| ^^^^^-----^^
| | |
| | help: try using a conversion method: `to_string`
- | expected struct `String`, found `&str`
+ | expected `String`, found `&str`
error: aborting due to 2 previous errors
| -------- ^^^^^^^^^^-----^^
| | | |
| | | help: try using a conversion method: `to_vec`
- | | expected struct `Vec`, found `&[i32]`
+ | | expected `Vec<i32>`, found `&[i32]`
| expected due to this
|
= note: expected struct `Vec<i32>`
| ------ ^^-----^^
| | | |
| | | help: try using a conversion method: `to_string`
- | | expected struct `String`, found `&str`
+ | | expected `String`, found `&str`
| expected due to this
error: aborting due to 2 previous errors
--> $DIR/issue-59819.rs:28:18
|
LL | let y: i32 = x;
- | --- ^ expected `i32`, found struct `Foo`
+ | --- ^ expected `i32`, found `Foo`
| |
| expected due to this
|
LL | let g: String = f;
| ------ ^- help: try using a conversion method: `.to_string()`
| | |
- | | expected struct `String`, found struct `Bar`
+ | | expected `String`, found `Bar`
| expected due to this
error: aborting due to 3 previous errors
LL | | "B"
| | ^^^- help: try using a conversion method: `.to_string()`
| | |
- | | expected struct `String`, found `&str`
+ | | expected `String`, found `&str`
LL | | };
| |_____- `if` and `else` have incompatible types
--> $DIR/issue-86100-tuple-paren-comma.rs:9:22
|
LL | let _x: (i32,) = (5);
- | ------ ^^^ expected tuple, found integer
+ | ------ ^^^ expected `(i32,)`, found integer
| |
| expected due to this
|
--> $DIR/issue-86100-tuple-paren-comma.rs:13:9
|
LL | foo((Some(3)));
- | --- ^^^^^^^^^ expected tuple, found enum `Option`
+ | --- ^^^^^^^^^ expected `(_,)`, found `Option<{integer}>`
| |
| arguments to this function are incorrect
|
--> $DIR/issue-86100-tuple-paren-comma.rs:17:22
|
LL | let _s = S { _s: ("abc".to_string()) };
- | ^^^^^^^^^^^^^^^^^^^ expected tuple, found struct `String`
+ | ^^^^^^^^^^^^^^^^^^^ expected `(String,)`, found `String`
|
= note: expected tuple `(String,)`
found struct `String`
--> $DIR/issue-90213-expected-boxfuture-self-ice.rs:9:19
|
LL | Self::foo(None)
- | --------- ^^^^ expected struct `Box`, found enum `Option`
+ | --------- ^^^^ expected `Box<Option<S>>`, found `Option<_>`
| |
| arguments to this function are incorrect
|
LL | match &x[..] {
| ------ this expression has type `&[i32]`
LL | [&v] => {},
- | ^^ expected `i32`, found reference
+ | ^^ expected `i32`, found `&_`
|
= note: expected type `i32`
found reference `&_`
LL | match y {
| - this expression has type `i32`
LL | &v => {},
- | ^^ expected `i32`, found reference
+ | ^^ expected `i32`, found `&_`
|
= note: expected type `i32`
found reference `&_`
LL | if let [&v] = &x[..] {}
| ^^ ------ this expression has type `&[i32]`
| |
- | expected `i32`, found reference
+ | expected `i32`, found `&_`
|
= note: expected type `i32`
found reference `&_`
LL | | "baz" => Box::new(Baz),
| | ------------- this is found to be of type `Box<Baz>`
LL | | _ => Box::new(Bar),
- | | ^^^^^^^^^^^^^ expected struct `Baz`, found struct `Bar`
+ | | ^^^^^^^^^^^^^ expected `Box<Baz>`, found `Box<Bar>`
LL | | };
| |_____- `match` arms have incompatible types
|
--> $DIR/match-with-different-arm-types-as-stmt-instead-of-expr.rs:23:22
|
LL | fn wrong(c: &str) -> Box<dyn Foo> {
- | ----- ^^^^^^^^^^^^ expected struct `Box`, found `()`
+ | ----- ^^^^^^^^^^^^ expected `Box<dyn Foo>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
LL | fn method(&self) -> Option<&Vec<u8>> {
| ---------------- expected `Option<&Vec<u8>>` because of return type
LL | self.option..as_ref().map(|x| x)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Option`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<&Vec<u8>>`, found `Range<Option<Vec<u8>>>`
|
= note: expected enum `Option<&Vec<u8>>`
found struct `std::ops::Range<Option<Vec<u8>>>`
LL | fn method2(&self) -> Option<&u8> {
| ----------- expected `Option<&u8>` because of return type
LL | self.option..foo().get(0)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Option`, found struct `Range`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<&u8>`, found `Range<Option<Vec<u8>>>`
|
= note: expected enum `Option<&u8>`
found struct `std::ops::Range<Option<Vec<u8>>>`
LL | fn suggestion(opt: &mut Option<String>) {
| ------------------- expected due to this parameter type
LL | opt = None;
- | ^^^^ expected mutable reference, found enum `Option`
+ | ^^^^ expected `&mut Option<String>`, found `Option<_>`
|
= note: expected mutable reference `&mut Option<String>`
found enum `Option<_>`
LL | fn no_suggestion(opt: &mut Result<String, ()>) {
| ----------------------- expected due to this parameter type
LL | opt = None
- | ^^^^ expected mutable reference, found enum `Option`
+ | ^^^^ expected `&mut Result<String, ()>`, found `Option<_>`
|
= note: expected mutable reference `&mut Result<String, ()>`
found enum `Option<_>`
LL | fn suggestion2(opt: &mut Option<String>) {
| ------------------- expected due to this parameter type
LL | opt = Some(String::new())
- | ^^^^^^^^^^^^^^^^^^^ expected mutable reference, found enum `Option`
+ | ^^^^^^^^^^^^^^^^^^^ expected `&mut Option<String>`, found `Option<String>`
|
= note: expected mutable reference `&mut Option<String>`
found enum `Option<String>`
LL | fn no_suggestion2(opt: &mut Option<String>) {
| ------------------- expected due to this parameter type
LL | opt = Some(42)
- | ^^^^^^^^ expected mutable reference, found enum `Option`
+ | ^^^^^^^^ expected `&mut Option<String>`, found `Option<{integer}>`
|
= note: expected mutable reference `&mut Option<String>`
found enum `Option<{integer}>`
--> $DIR/option-to-bool.rs:4:16
|
LL | if true && x {}
- | ---- ^ expected `bool`, found enum `Option`
+ | ---- ^ expected `bool`, found `Option<i32>`
| |
| expected because this is `bool`
|
--> $DIR/recover-from-semicolon-trailing-item.rs:10:20
|
LL | let _: usize = S {};
- | ----- ^^^^ expected `usize`, found struct `S`
+ | ----- ^^^^ expected `usize`, found `S`
| |
| expected due to this
--> $DIR/recover-from-semicolon-trailing-item.rs:12:20
|
LL | let _: usize = X {};
- | ----- ^^^^ expected `usize`, found struct `X`
+ | ----- ^^^^ expected `usize`, found `X`
| |
| expected due to this
| ______________________________________________^
LL | |
LL | | } else {
- | |_____^ expected struct `String`, found `()`
+ | |_____^ expected `String`, found `()`
|
help: consider returning the local binding `s`
|
--> $DIR/return-bindings.rs:14:11
|
LL | fn c() -> Option<i32> {
- | - ^^^^^^^^^^^ expected enum `Option`, found `()`
+ | - ^^^^^^^^^^^ expected `Option<i32>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
| ______________________________________________^
LL | |
LL | | } else {
- | |_____^ expected struct `String`, found `()`
+ | |_____^ expected `String`, found `()`
|
help: consider returning the local binding `s`
|
LL | | } else {
| |_____- expected because of this
LL | String::new()
- | ^^^^^^^^^^^^^ expected `()`, found struct `String`
+ | ^^^^^^^^^^^^^ expected `()`, found `String`
|
help: consider returning the local binding `s`
|
--> $DIR/return-bindings.rs:37:20
|
LL | Some(s) => {}
- | ^^ expected struct `String`, found `()`
+ | ^^ expected `String`, found `()`
|
help: consider returning the local binding `s`
|
LL | | Some(s) => {}
| | -- this is found to be of type `()`
LL | | None => String::new(),
- | | ^^^^^^^^^^^^^ expected `()`, found struct `String`
+ | | ^^^^^^^^^^^^^ expected `()`, found `String`
LL | |
LL | | };
| |_____- `match` arms have incompatible types
--> $DIR/shadowed-lplace-method-2.rs:22:17
|
LL | *x.foo(0) = ();
- | --------- ^^ expected struct `X`, found `()`
+ | --------- ^^ expected `X`, found `()`
| |
| expected due to the type of this binding
|
--> $DIR/shadowed-lplace-method.rs:9:24
|
LL | *rc.borrow_mut() = false;
- | ---------------- ^^^^^ expected struct `Rc`, found `bool`
+ | ---------------- ^^^^^ expected `Rc<RefCell<bool>>`, found `bool`
| |
| expected due to the type of this binding
|
LL | | Err(())?;
LL | | Ok(())
LL | | };
- | |_____^ expected struct `Box`, found closure
+ | |_____^ expected `Box<dyn Fn() -> Result<(), ()>>`, found closure
|
= note: expected struct `Box<dyn Fn() -> Result<(), ()>>`
found closure `[closure@$DIR/suggest-box.rs:4:47: 4:49]`
--> $DIR/suggest-full-enum-variant-for-local-module.rs:9:28
|
LL | let _: option::O<()> = ();
- | ------------- ^^ expected enum `O`, found `()`
+ | ------------- ^^ expected `O<()>`, found `()`
| |
| expected due to this
|
--> $DIR/suggest-remove-deref.rs:13:9
|
LL | foo(*hello);
- | --- ^^^^^^ expected reference, found struct `S`
+ | --- ^^^^^^ expected `&_`, found `S`
| |
| arguments to this function are incorrect
|
--> $DIR/suggest-remove-deref.rs:21:9
|
LL | bar(*s);
- | --- ^^ expected `&String`, found struct `String`
+ | --- ^^ expected `&String`, found `String`
| |
| arguments to this function are incorrect
|
--> $DIR/unnecessary_dot_for_floating_point_literal.rs:2:18
|
LL | let _: f64 = 0..10;
- | --- ^^^^^ expected `f64`, found struct `Range`
+ | --- ^^^^^ expected `f64`, found `Range<{integer}>`
| |
| expected due to this
|
--> $DIR/unnecessary_dot_for_floating_point_literal.rs:3:18
|
LL | let _: f64 = 1..;
- | --- ^^^ expected `f64`, found struct `RangeFrom`
+ | --- ^^^ expected `f64`, found `RangeFrom<{integer}>`
| |
| expected due to this
|
--> $DIR/unnecessary_dot_for_floating_point_literal.rs:4:18
|
LL | let _: f64 = ..10;
- | --- ^^^^ expected `f64`, found struct `RangeTo`
+ | --- ^^^^ expected `f64`, found `RangeTo<{integer}>`
| |
| expected due to this
|
--> $DIR/unnecessary_dot_for_floating_point_literal.rs:5:18
|
LL | let _: f64 = std::ops::Range { start: 0, end: 1 };
- | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found struct `Range`
+ | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found `Range<{integer}>`
| |
| expected due to this
|
//~^ ERROR mismatched types
//~| expected unit type `()`
//~| found tuple `(_, _)`
-//~| expected `()`, found tuple
+//~| expected `()`, found
return x;
}
LL | let (x, y) = ();
| ^^^^^^ -- this expression has type `()`
| |
- | expected `()`, found tuple
+ | expected `()`, found `(_, _)`
|
= note: expected unit type `()`
found tuple `(_, _)`
--> $DIR/switched-expectations.rs:3:30
|
LL | let ref string: String = var;
- | ^^^ expected struct `String`, found `i32`
+ | ^^^ expected `String`, found `i32`
error: aborting due to previous error
//~^ ERROR mismatched types
//~| expected type `char`
//~| found enum `Option<_>`
- //~| expected `char`, found enum `Option`
+ //~| expected `char`, found `Option<_>`
}
--> $DIR/tag-that-dare-not-speak-its-name.rs:11:20
|
LL | let x : char = last(y);
- | ---- ^^^^^^^ expected `char`, found enum `Option`
+ | ---- ^^^^^^^ expected `char`, found `Option<_>`
| |
| expected due to this
|
fn want_foo(f: Foo) {}
fn have_bar(b: Bar) {
want_foo(b); //~ ERROR mismatched types
- //~| expected struct `Foo`, found struct `Bar`
+ //~| expected `Foo`, found `Bar`
}
fn main() {}
--> $DIR/terr-in-field.rs:13:14
|
LL | want_foo(b);
- | -------- ^ expected struct `Foo`, found struct `Bar`
+ | -------- ^ expected `Foo`, found `Bar`
| |
| arguments to this function are incorrect
|
--> $DIR/terr-sorts.rs:10:14
|
LL | want_foo(b);
- | -------- ^ expected struct `Foo`, found struct `Box`
+ | -------- ^ expected `Foo`, found `Box<Foo>`
| |
| arguments to this function are incorrect
|
| - this type parameter
...
LL | builder.push(output);
- | ---- ^^^^^^ expected type parameter `F`, found struct `Class`
+ | ---- ^^^^^^ expected type parameter `F`, found `Class<P>`
| |
| arguments to this method are incorrect
|
| ----------------- expected `Matrix<R, C, u32>` because of return type
...
LL | input.into_owned()
- | ^^^^^^^^^^^^^^^^^^ expected `u32`, found associated type
+ | ^^^^^^^^^^^^^^^^^^ expected `Matrix<R, C, u32>`, found `Matrix<R, C, ...>`
|
= note: expected struct `Matrix<_, _, u32>`
found struct `Matrix<_, _, <() as Allocator<R, C>>::Buffer>`
--> $DIR/issue-101739-1.rs:8:50
|
LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME_ALIGNMENT>,
- | ^^^^^^^^^^^^^^^^ expected struct `Assume`, found `bool`
+ | ^^^^^^^^^^^^^^^^ expected `Assume`, found `bool`
error: aborting due to 2 previous errors
--> $DIR/add-tuple-within-arguments.rs:8:15
|
LL | bar("hi", "hi", "hi");
- | --- ^^^^ expected tuple, found `&str`
+ | --- ^^^^ expected `(&str,)`, found `&str`
| |
| arguments to this function are incorrect
|
LL | groups.push(new_group, vec![process]);
| ^^^^ ------------- argument of type `Vec<&Process>` unexpected
|
-note: expected tuple, found struct `Vec`
+note: expected `(Vec<String>, Vec<Process>)`, found `Vec<String>`
--> $DIR/wrong_argument_ice-3.rs:9:21
|
LL | groups.push(new_group, vec![process]);
--> $DIR/enum-variant-priority-higher-than-other-inherent.rs:22:17
|
LL | let _: u8 = <E2>::V;
- | -- ^^^^^^^ expected `u8`, found enum `E2`
+ | -- ^^^^^^^ expected `u8`, found `E2`
| |
| expected due to this
--> $DIR/issue-98604.rs:9:5
|
LL | Box::new(test) as AsyncFnPtr;
- | ^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type
+ | ^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
|
note: while checking the return type of the `async fn`
--> $DIR/issue-98604.rs:5:17
| ---------- the found opaque type
...
LL | let b: Box<dyn Fn() -> Box<u8>> = Box::new(hi);
- | ^^^^^^^^^^^^ expected struct `Box`, found opaque type
+ | ^^^^^^^^^^^^ expected `Box<u8>`, found opaque type
|
= note: expected struct `Box<u8>`
found opaque type `impl Sized`
LL | fn dont_define_this(_private: MyPrivate) {}
| ^^^^^^^^^
| |
- | expected struct `Private`, found opaque type
+ | expected `Private`, found opaque type
| help: change the parameter type to match the trait: `Private`
|
note: type in trait
--> $DIR/issue-30225.rs:31:9
|
LL | u = v; // mark $0 and $1 in a subtype relationship
- | ^ expected struct `A`, found struct `B`
+ | ^ expected `A`, found `B`
error: aborting due to previous error
--> $DIR/type-ascription-precedence.rs:31:7
|
LL | &(S: &S);
- | ^ expected `&S`, found struct `S`
+ | ^ expected `&S`, found `S`
error[E0308]: mismatched types
--> $DIR/type-ascription-precedence.rs:35:7
|
LL | *(S: Z);
- | ^ expected struct `Z`, found struct `S`
+ | ^ expected `Z`, found `S`
error[E0614]: type `Z` cannot be dereferenced
--> $DIR/type-ascription-precedence.rs:35:5
--> $DIR/type-ascription-precedence.rs:40:7
|
LL | -(S: Z);
- | ^ expected struct `Z`, found struct `S`
+ | ^ expected `Z`, found `S`
error[E0600]: cannot apply unary operator `-` to type `Z`
--> $DIR/type-ascription-precedence.rs:40:5
--> $DIR/type-ascription-precedence.rs:45:5
|
LL | (S + Z): Z;
- | ^^^^^^^ expected struct `Z`, found struct `S`
+ | ^^^^^^^ expected `Z`, found `S`
error[E0308]: mismatched types
--> $DIR/type-ascription-precedence.rs:49:5
|
LL | (S * Z): Z;
- | ^^^^^^^ expected struct `Z`, found struct `S`
+ | ^^^^^^^ expected `Z`, found `S`
error[E0308]: mismatched types
--> $DIR/type-ascription-precedence.rs:53:5
|
LL | (S .. S): S;
- | ^^^^^^^^ expected struct `S`, found struct `Range`
+ | ^^^^^^^^ expected `S`, found `Range<S>`
|
= note: expected struct `S`
found struct `std::ops::Range<S>`
--> $DIR/type-ascription-soundness.rs:7:31
|
LL | let ref x = type_ascribe!(arr, &[u8]);
- | ^^^ expected slice `[u8]`, found array `[u8; 3]`
+ | ^^^ expected `&[u8]`, found `&[u8; 3]`
|
= note: expected reference `&[u8]`
found reference `&[u8; 3]`
--> $DIR/type-ascription-soundness.rs:8:35
|
LL | let ref mut x = type_ascribe!(arr, &[u8]);
- | ^^^ expected slice `[u8]`, found array `[u8; 3]`
+ | ^^^ expected `&[u8]`, found `&[u8; 3]`
|
= note: expected reference `&[u8]`
found reference `&[u8; 3]`
--> $DIR/type-ascription-soundness.rs:9:25
|
LL | match type_ascribe!(arr, &[u8]) {
- | ^^^ expected slice `[u8]`, found array `[u8; 3]`
+ | ^^^ expected `&[u8]`, found `&[u8; 3]`
|
= note: expected reference `&[u8]`
found reference `&[u8; 3]`
--> $DIR/type-ascription-soundness.rs:12:30
|
LL | let _len = type_ascribe!(arr, &[u8]).len();
- | ^^^ expected slice `[u8]`, found array `[u8; 3]`
+ | ^^^ expected `&[u8]`, found `&[u8; 3]`
|
= note: expected reference `&[u8]`
found reference `&[u8; 3]`
| ------------- expected `Result<(), B>` because of return type
LL | match true {
LL | true => x,
- | ^ expected struct `B`, found struct `A`
+ | ^ expected `Result<(), B>`, found `Result<(), A>`
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
| ------------- expected `Result<(), B>` because of return type
LL | match true {
LL | true => return x,
- | ^ expected struct `B`, found struct `A`
+ | ^ expected `Result<(), B>`, found `Result<(), A>`
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
| ____________________________^
LL | | Err(A);
LL | | };
- | |_____^ expected enum `Result`, found `()`
+ | |_____^ expected `Result<(), B>`, found `()`
|
= note: expected enum `Result<(), B>`
found unit type `()`
LL | fn foo1(x: Result<(), A>) -> Result<(), B> {
| ------------- expected `Result<(), B>` because of return type
LL | x
- | ^ expected struct `B`, found struct `A`
+ | ^ expected `Result<(), B>`, found `Result<(), A>`
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
LL | fn foo2(x: Result<(), A>) -> Result<(), B> {
| ------------- expected `Result<(), B>` because of return type
LL | return x;
- | ^ expected struct `B`, found struct `A`
+ | ^ expected `Result<(), B>`, found `Result<(), A>`
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
| ------------- expected `Result<(), B>` because of return type
LL | if true {
LL | x
- | ^ expected struct `B`, found struct `A`
+ | ^ expected `Result<(), B>`, found `Result<(), A>`
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
| ------------- expected `Result<(), B>` because of return type
...
LL | x
- | ^ expected struct `B`, found struct `A`
+ | ^ expected `Result<(), B>`, found `Result<(), A>`
|
= note: expected enum `Result<_, B>`
found enum `Result<_, A>`
--> $DIR/point-at-inference-2.rs:5:9
|
LL | bar(v);
- | --- ^ expected `i32`, found `&{integer}`
+ | --- ^ expected `Vec<i32>`, found `Vec<&{integer}>`
| |
| arguments to this function are incorrect
|
| - here the type of `v` is inferred to be `Vec<&i32>`
LL | baz(&v);
LL | bar(v);
- | --- ^ expected `i32`, found `&i32`
+ | --- ^ expected `Vec<i32>`, found `Vec<&i32>`
| |
| arguments to this function are incorrect
|
LL | baz(&v);
| - here the type of `v` is inferred to be `Vec<&i32>`
LL | bar(v);
- | --- ^ expected `i32`, found `&i32`
+ | --- ^ expected `Vec<i32>`, found `Vec<&i32>`
| |
| arguments to this function are incorrect
|
| - this is of type `&{integer}`, which causes `foo` to be inferred as `Vec<&{integer}>`
...
LL | bar(foo);
- | --- ^^^ expected `i32`, found `&{integer}`
+ | --- ^^^ expected `Vec<i32>`, found `Vec<&{integer}>`
| |
| arguments to this function are incorrect
|
a::try_foo(foo2);
//~^ ERROR mismatched types
//~| perhaps two different versions of crate `crate_a1`
- //~| expected struct `main::a::Foo`
+ //~| expected `main::a::Foo`, found a different `main::a::Foo`
a::try_bar(bar2);
//~^ ERROR mismatched types
//~| perhaps two different versions of crate `crate_a1`
--> $DIR/type-mismatch-same-crate-name.rs:16:20
|
LL | a::try_foo(foo2);
- | ---------- ^^^^ expected struct `main::a::Foo`, found a different struct `main::a::Foo`
+ | ---------- ^^^^ expected `main::a::Foo`, found a different `main::a::Foo`
| |
| arguments to this function are incorrect
|
- = note: struct `main::a::Foo` and struct `main::a::Foo` have similar names, but are actually distinct types
-note: struct `main::a::Foo` is defined in crate `crate_a2`
+ = note: `main::a::Foo` and `main::a::Foo` have similar names, but are actually distinct types
+note: `main::a::Foo` is defined in crate `crate_a2`
--> $DIR/auxiliary/crate_a2.rs:1:1
|
LL | pub struct Foo;
| ^^^^^^^^^^^^^^
-note: struct `main::a::Foo` is defined in crate `crate_a1`
+note: `main::a::Foo` is defined in crate `crate_a1`
--> $DIR/auxiliary/crate_a1.rs:1:1
|
LL | pub struct Foo;
--> $DIR/type-mismatch.rs:17:17
|
LL | want::<foo>(f);
- | ----------- ^ expected struct `foo`, found `usize`
+ | ----------- ^ expected `foo`, found `usize`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:18:17
|
LL | want::<bar>(f);
- | ----------- ^ expected struct `bar`, found `usize`
+ | ----------- ^ expected `bar`, found `usize`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:19:24
|
LL | want::<Foo<usize>>(f);
- | ------------------ ^ expected struct `Foo`, found `usize`
+ | ------------------ ^ expected `Foo<usize>`, found `usize`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:20:27
|
LL | want::<Foo<usize, B>>(f);
- | --------------------- ^ expected struct `Foo`, found `usize`
+ | --------------------- ^ expected `Foo<usize, B>`, found `usize`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:21:22
|
LL | want::<Foo<foo>>(f);
- | ---------------- ^ expected struct `Foo`, found `usize`
+ | ---------------- ^ expected `Foo<foo>`, found `usize`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:22:25
|
LL | want::<Foo<foo, B>>(f);
- | ------------------- ^ expected struct `Foo`, found `usize`
+ | ------------------- ^ expected `Foo<foo, B>`, found `usize`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:23:22
|
LL | want::<Foo<bar>>(f);
- | ---------------- ^ expected struct `Foo`, found `usize`
+ | ---------------- ^ expected `Foo<bar>`, found `usize`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:24:25
|
LL | want::<Foo<bar, B>>(f);
- | ------------------- ^ expected struct `Foo`, found `usize`
+ | ------------------- ^ expected `Foo<bar, B>`, found `usize`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:28:19
|
LL | want::<usize>(f);
- | ------------- ^ expected `usize`, found struct `foo`
+ | ------------- ^ expected `usize`, found `foo`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:29:17
|
LL | want::<bar>(f);
- | ----------- ^ expected struct `bar`, found struct `foo`
+ | ----------- ^ expected `bar`, found `foo`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:30:24
|
LL | want::<Foo<usize>>(f);
- | ------------------ ^ expected struct `Foo`, found struct `foo`
+ | ------------------ ^ expected `Foo<usize>`, found `foo`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:31:27
|
LL | want::<Foo<usize, B>>(f);
- | --------------------- ^ expected struct `Foo`, found struct `foo`
+ | --------------------- ^ expected `Foo<usize, B>`, found `foo`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:32:22
|
LL | want::<Foo<foo>>(f);
- | ---------------- ^ expected struct `Foo`, found struct `foo`
+ | ---------------- ^ expected `Foo<foo>`, found `foo`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:33:25
|
LL | want::<Foo<foo, B>>(f);
- | ------------------- ^ expected struct `Foo`, found struct `foo`
+ | ------------------- ^ expected `Foo<foo, B>`, found `foo`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:34:22
|
LL | want::<Foo<bar>>(f);
- | ---------------- ^ expected struct `Foo`, found struct `foo`
+ | ---------------- ^ expected `Foo<bar>`, found `foo`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:35:25
|
LL | want::<Foo<bar, B>>(f);
- | ------------------- ^ expected struct `Foo`, found struct `foo`
+ | ------------------- ^ expected `Foo<bar, B>`, found `foo`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:39:19
|
LL | want::<usize>(f);
- | ------------- ^ expected `usize`, found struct `Foo`
+ | ------------- ^ expected `usize`, found `Foo<foo>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:40:17
|
LL | want::<foo>(f);
- | ----------- ^ expected struct `foo`, found struct `Foo`
+ | ----------- ^ expected `foo`, found `Foo<foo>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:41:17
|
LL | want::<bar>(f);
- | ----------- ^ expected struct `bar`, found struct `Foo`
+ | ----------- ^ expected `bar`, found `Foo<foo>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:42:24
|
LL | want::<Foo<usize>>(f);
- | ------------------ ^ expected `usize`, found struct `foo`
+ | ------------------ ^ expected `Foo<usize>`, found `Foo<foo>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:43:27
|
LL | want::<Foo<usize, B>>(f);
- | --------------------- ^ expected `usize`, found struct `foo`
+ | --------------------- ^ expected `Foo<usize, B>`, found `Foo<foo>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:44:25
|
LL | want::<Foo<foo, B>>(f);
- | ------------------- ^ expected struct `B`, found struct `A`
+ | ------------------- ^ expected `Foo<foo, B>`, found `Foo<foo>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:45:22
|
LL | want::<Foo<bar>>(f);
- | ---------------- ^ expected struct `bar`, found struct `foo`
+ | ---------------- ^ expected `Foo<bar>`, found `Foo<foo>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:46:25
|
LL | want::<Foo<bar, B>>(f);
- | ------------------- ^ expected struct `bar`, found struct `foo`
+ | ------------------- ^ expected `Foo<bar, B>`, found `Foo<foo>`
| |
| arguments to this function are incorrect
|
LL | want::<&Foo<foo>>(f);
| ----------------- ^
| | |
- | | expected `&Foo<foo>`, found struct `Foo`
+ | | expected `&Foo<foo>`, found `Foo<foo>`
| | help: consider borrowing here: `&f`
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:48:26
|
LL | want::<&Foo<foo, B>>(f);
- | -------------------- ^ expected `&Foo<foo, B>`, found struct `Foo`
+ | -------------------- ^ expected `&Foo<foo, B>`, found `Foo<foo>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:52:19
|
LL | want::<usize>(f);
- | ------------- ^ expected `usize`, found struct `Foo`
+ | ------------- ^ expected `usize`, found `Foo<foo, B>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:53:17
|
LL | want::<foo>(f);
- | ----------- ^ expected struct `foo`, found struct `Foo`
+ | ----------- ^ expected `foo`, found `Foo<foo, B>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:54:17
|
LL | want::<bar>(f);
- | ----------- ^ expected struct `bar`, found struct `Foo`
+ | ----------- ^ expected `bar`, found `Foo<foo, B>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:55:24
|
LL | want::<Foo<usize>>(f);
- | ------------------ ^ expected `usize`, found struct `foo`
+ | ------------------ ^ expected `Foo<usize>`, found `Foo<foo, B>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:56:27
|
LL | want::<Foo<usize, B>>(f);
- | --------------------- ^ expected `usize`, found struct `foo`
+ | --------------------- ^ expected `Foo<usize, B>`, found `Foo<foo, B>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:57:22
|
LL | want::<Foo<foo>>(f);
- | ---------------- ^ expected struct `A`, found struct `B`
+ | ---------------- ^ expected `Foo<foo>`, found `Foo<foo, B>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:58:22
|
LL | want::<Foo<bar>>(f);
- | ---------------- ^ expected struct `bar`, found struct `foo`
+ | ---------------- ^ expected `Foo<bar>`, found `Foo<foo, B>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:59:25
|
LL | want::<Foo<bar, B>>(f);
- | ------------------- ^ expected struct `bar`, found struct `foo`
+ | ------------------- ^ expected `Foo<bar, B>`, found `Foo<foo, B>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:60:23
|
LL | want::<&Foo<foo>>(f);
- | ----------------- ^ expected `&Foo<foo>`, found struct `Foo`
+ | ----------------- ^ expected `&Foo<foo>`, found `Foo<foo, B>`
| |
| arguments to this function are incorrect
|
LL | want::<&Foo<foo, B>>(f);
| -------------------- ^
| | |
- | | expected `&Foo<foo, B>`, found struct `Foo`
+ | | expected `&Foo<foo, B>`, found `Foo<foo, B>`
| | help: consider borrowing here: `&f`
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:65:19
|
LL | want::<usize>(f);
- | ------------- ^ expected `usize`, found struct `Foo`
+ | ------------- ^ expected `usize`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:66:17
|
LL | want::<foo>(f);
- | ----------- ^ expected struct `foo`, found struct `Foo`
+ | ----------- ^ expected `foo`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:67:17
|
LL | want::<bar>(f);
- | ----------- ^ expected struct `bar`, found struct `Foo`
+ | ----------- ^ expected `bar`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:68:24
|
LL | want::<Foo<usize>>(f);
- | ------------------ ^ expected `usize`, found struct `foo`
+ | ------------------ ^ expected `Foo<usize>`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:69:27
|
LL | want::<Foo<usize, B>>(f);
- | --------------------- ^ expected `usize`, found struct `foo`
+ | --------------------- ^ expected `Foo<usize, B>`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:70:22
|
LL | want::<Foo<foo>>(f);
- | ---------------- ^ expected struct `A`, found struct `B`
+ | ---------------- ^ expected `Foo<foo>`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:71:25
|
LL | want::<Foo<foo, B>>(f);
- | ------------------- ^ expected struct `B`, found struct `A`
+ | ------------------- ^ expected `Foo<foo, B>`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:72:22
|
LL | want::<Foo<bar>>(f);
- | ---------------- ^ expected struct `bar`, found struct `foo`
+ | ---------------- ^ expected `Foo<bar>`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:73:25
|
LL | want::<Foo<bar, B>>(f);
- | ------------------- ^ expected struct `bar`, found struct `foo`
+ | ------------------- ^ expected `Foo<bar, B>`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:74:23
|
LL | want::<&Foo<foo>>(f);
- | ----------------- ^ expected `&Foo<foo>`, found struct `Foo`
+ | ----------------- ^ expected `&Foo<foo>`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
--> $DIR/type-mismatch.rs:75:26
|
LL | want::<&Foo<foo, B>>(f);
- | -------------------- ^ expected `&Foo<foo, B>`, found struct `Foo`
+ | -------------------- ^ expected `&Foo<foo, B>`, found `Foo<foo, B, A>`
| |
| arguments to this function are incorrect
|
LL | let mut y = x.lock().unwrap();
| ----------------- expected due to this value
LL | y = 2;
- | ^ expected struct `MutexGuard`, found integer
+ | ^ expected `MutexGuard<'_, usize>`, found integer
|
= note: expected struct `MutexGuard<'_, usize>`
found type `{integer}`
LL | vector.sort();
| ------ here the type of `vector` is inferred to be `Vec<_>`
LL | result.push(vector);
- | ---- ^^^^^^ expected integer, found struct `Vec`
+ | ---- ^^^^^^ expected integer, found `Vec<_>`
| |
| arguments to this method are incorrect
|
LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—";
| ------ ^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
| | |
- | | expected struct `String`, found `&str`
+ | | expected `String`, found `&str`
| expected due to this
error[E0308]: mismatched types
LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise");
| ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_path_buf()`
| | |
- | | expected struct `PathBuf`, found `&Path`
+ | | expected `PathBuf`, found `&Path`
| expected due to this
error[E0308]: mismatched types
LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here
| ------ ^- help: try using a conversion method: `.to_string()`
| | |
- | | expected struct `String`, found integer
+ | | expected `String`, found integer
| expected due to this
error[E0308]: mismatched types
--> $DIR/conversion-methods.rs:12:47
|
LL | let _prove_piercing_earnest: Vec<usize> = &[1, 2, 3];
- | ---------- ^^^^^^^^^^ expected struct `Vec`, found `&[{integer}; 3]`
+ | ---------- ^^^^^^^^^^ expected `Vec<usize>`, found `&[{integer}; 3]`
| |
| expected due to this
|
LL | fn d(x: std::sync::Mutex<&i32>) -> i32 {
| --- expected `i32` because of return type
LL | x.lock().unwrap()
- | ^^^^^^^^^^^^^^^^^ expected `i32`, found struct `MutexGuard`
+ | ^^^^^^^^^^^^^^^^^ expected `i32`, found `MutexGuard<'_, &i32>`
|
= note: expected type `i32`
found struct `MutexGuard<'_, &i32>`
nc.clone()
//~^ ERROR mismatched type
//~| NOTE `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
- //~| NOTE expected struct `NotClone`, found `&NotClone`
+ //~| NOTE expected `NotClone`, found `&NotClone`
}
| -------- expected `NotClone` because of return type
LL |
LL | nc.clone()
- | ^^^^^^^^^^ expected struct `NotClone`, found `&NotClone`
+ | ^^^^^^^^^^ expected `NotClone`, found `&NotClone`
|
note: `NotClone` does not implement `Clone`, so `&NotClone` was cloned instead
--> $DIR/explain_clone_autoref.rs:9:5
--> $DIR/issue-100246.rs:28:24
|
LL | let other: Other = downcast()?;
- | ^^^^^^^^^^^ expected struct `Other`, found reference
+ | ^^^^^^^^^^^ expected `Other`, found `&_`
|
= note: `?` operator cannot convert from `&_` to `Other`
= note: expected struct `Other`
| - this type parameter - expected `I` because of return type
...
LL | self.iter()
- | ^^^^^^^^^^^ expected type parameter `I`, found struct `Iter`
+ | ^^^^^^^^^^^ expected type parameter `I`, found `Iter<'_, N>`
|
= note: expected type parameter `I`
found struct `std::slice::Iter<'_, N>`
LL | iterate(graph);
| ------- ^^^^^
| | |
- | | expected reference, found struct `Vec`
+ | | expected `&_`, found `Vec<Stuff>`
| | help: consider borrowing here: `&graph`
| arguments to this function are incorrect
|
--> $DIR/issue-31173.rs:11:10
|
LL | .cloned()
- | ^^^^^^ expected reference, found `u8`
+ | ^^^^^^ expected `&_`, found `u8`
|
= note: expected reference `&_`
found type `u8`
--> $DIR/issue-46112.rs:9:21
|
LL | fn main() { test(Ok(())); }
- | -- ^^ expected enum `Option`, found `()`
+ | -- ^^ expected `Option<()>`, found `()`
| |
| arguments to this enum variant are incorrect
|
--> $DIR/issue-50687-ice-on-borrow.rs:40:17
|
LL | let _: () = Borrow::borrow(&owned);
- | -- ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found reference
+ | -- ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&_`
| |
| expected due to this
|
LL | fn ice(x: Box<dyn Iterator<Item=()>>) {
| - help: try adding a return type: `-> (dyn Iterator<Item = ()> + 'static)`
LL | *x
- | ^^ expected `()`, found trait object `dyn Iterator`
+ | ^^ expected `()`, found `dyn Iterator`
|
= note: expected unit type `()`
found trait object `(dyn Iterator<Item = ()> + 'static)`
--> $DIR/issue-67971.rs:3:24
|
LL | fn foo(ctx: &mut S) -> String {
- | --- ^^^^^^ expected struct `String`, found `()`
+ | --- ^^^^^^ expected `String`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
| ---- expected `&u32` because of return type
...
LL | return "test";
- | ^^^^^^ expected `u32`, found `str`
+ | ^^^^^^ expected `&u32`, found `&str`
|
= note: expected reference `&u32`
found reference `&'static str`
--> $DIR/issue-84768.rs:7:42
|
LL | <F as FnOnce(&mut u8)>::call_once(f, 1)
- | --------------------------------- ^ expected tuple, found integer
+ | --------------------------------- ^ expected `(&mut u8,)`, found integer
| |
| arguments to this function are incorrect
|
--> $DIR/issue-89856.rs:6:20
|
LL | take_str_maybe(option);
- | -------------- ^^^^^^ expected `str`, found struct `String`
+ | -------------- ^^^^^^ expected `Option<&str>`, found `Option<&String>`
| |
| arguments to this function are incorrect
|
--> $DIR/issue-91450-inner-ty-error.rs:4:13
|
LL | fn foo() -> Option<_> {}
- | --- ^^^^^^^^^ expected enum `Option`, found `()`
+ | --- ^^^^^^^^^ expected `Option<_>`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
LL | / Ok {
LL | | d..||_=m
LL | | }
- | |_____^ expected `()`, found enum `Result`
+ | |_____^ expected `()`, found `Result<_, _>`
|
= note: expected unit type `()`
found enum `Result<_, _>`
--> $DIR/issue-96530.rs:9:11
|
LL | ..man.clone()
- | ^^^^^^^^^^^ expected struct `Person`, found `&Person`
+ | ^^^^^^^^^^^ expected `Person`, found `&Person`
error: aborting due to previous error
fn foo() { //~ HELP a return type might be missing here
vec!['a'].iter().map(|c| c)
//~^ ERROR mismatched types [E0308]
- //~| NOTE expected `()`, found struct `Map`
+ //~| NOTE expected `()`, found `Map<Iter<'_, char>, ...>`
//~| NOTE expected unit type `()`
//~| HELP consider using a semicolon here
}
--> $DIR/return_type_containing_closure.rs:3:5
|
LL | vec!['a'].iter().map(|c| c)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Map`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map<Iter<'_, char>, ...>`
|
= note: expected unit type `()`
found struct `Map<std::slice::Iter<'_, char>, [closure@$DIR/return_type_containing_closure.rs:3:26: 3:29]>`
//~^ ERROR mismatched types
//~| expected struct `Foo<_>`
//~| found struct `Bar<usize>`
- //~| expected struct `Foo`, found struct `Bar`
+ //~| expected `Foo<_>`, found `Bar<usize>`
let y: Foo<usize> = x;
}
//~^ ERROR mismatched types
//~| expected struct `Foo<_>`
//~| found struct `Bar<usize>`
- //~| expected struct `Foo`, found struct `Bar`
+ //~| expected `Foo<_>`, found `Bar<usize>`
}
--> $DIR/typeck_type_placeholder_mismatch.rs:13:21
|
LL | let x: Foo<_> = Bar::<usize>(PhantomData);
- | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar`
+ | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Foo<_>`, found `Bar<usize>`
| |
| expected due to this
|
--> $DIR/typeck_type_placeholder_mismatch.rs:22:21
|
LL | let x: Foo<_> = Bar::<usize>(PhantomData);
- | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar`
+ | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Foo<_>`, found `Bar<usize>`
| |
| expected due to this
|
LL | let x: &[u8] = vec!(1, 2, 3)[..];
| ----- ^^^^^^^^^^^^^^^^^
| | |
- | | expected `&[u8]`, found slice `[{integer}]`
+ | | expected `&[u8]`, found `[{integer}]`
| | help: consider borrowing here: `&vec!(1, 2, 3)[..]`
| expected due to this
--> $DIR/suggest-borrow.rs:4:19
|
LL | let x: [u8] = &vec!(1, 2, 3)[..];
- | ---- ^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found `&[{integer}]`
+ | ---- ^^^^^^^^^^^^^^^^^^ expected `[u8]`, found `&[{integer}]`
| |
| expected due to this
|
| | expected because of this
LL | | } else {
LL | | Box::new(move || println!("{}", b))
- | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found struct `Box`
+ | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found `Box<[closure@box-instead-of-dyn-fn.rs:10:18]>`
LL | |
LL | | }
| |_____- `if` and `else` have incompatible types
--> $DIR/param-mentioned-by-different-field.rs:8:25
|
LL | let y: &Foo<[u8]> = &x;
- | ---------- ^^ expected slice `[u8]`, found array `[u8; 1]`
+ | ---------- ^^ expected `&Foo<[u8]>`, found `&Foo<[u8; 1]>`
| |
| expected due to this
|
LL | | Some(()) => &S,
| | -- this is found to be of type `&S`
LL | | None => &R,
- | | ^^ expected struct `S`, found struct `R`
+ | | ^^ expected `&S`, found `&R`
LL | | }
| |_____- `match` arms have incompatible types
|
LL | fn mul(self, s: f64) -> Vec2 {
| ^^^
| |
- | expected struct `Vec2`, found `f64`
+ | expected `Vec2`, found `f64`
| help: change the parameter type to match the trait: `Vec2`
|
= note: expected signature `fn(Vec2, Vec2) -> f64`
--> $DIR/wrong-mul-method-signature.rs:63:45
|
LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order
- | ----------------------- ^^^ expected struct `Vec2`, found floating-point number
+ | ----------------------- ^^^ expected `Vec2`, found floating-point number
| |
| expected because this is `Vec2`
--> $DIR/wrong-mul-method-signature.rs:63:19
|
LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order
- | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found `f64`
+ | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec2`, found `f64`
| |
| expected due to this