1
Fork 0

Modify primary span label for E0308

The previous output was unintuitive to users.
This commit is contained in:
Esteban Küber 2023-01-02 18:00:33 -08:00
parent 006ca9b14d
commit 62ba3e70a1
383 changed files with 889 additions and 926 deletions

View file

@ -444,7 +444,10 @@ fn check_opaque_meets_bounds<'tcx>(
Err(ty_err) => { Err(ty_err) => {
tcx.sess.delay_span_bug( tcx.sess.delay_span_bug(
span, 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)
),
); );
} }
} }

View file

@ -67,6 +67,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::lang_items::LangItem; use rustc_hir::lang_items::LangItem;
use rustc_hir::Node; use rustc_hir::Node;
use rustc_middle::dep_graph::DepContext; 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::relate::{self, RelateResult, TypeRelation};
use rustc_middle::ty::{ use rustc_middle::ty::{
self, error::TypeError, List, Region, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, self, error::TypeError, List, Region, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable,
@ -1612,16 +1613,31 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
{ {
format!("expected this to be `{}`", expected) format!("expected this to be `{}`", expected)
} else { } else {
terr.to_string() terr.to_string(self.tcx)
}; };
label_or_note(sp, &terr); label_or_note(sp, &terr);
label_or_note(span, &msg); label_or_note(span, &msg);
} else { } else {
label_or_note(span, &terr.to_string()); label_or_note(span, &terr.to_string(self.tcx));
label_or_note(sp, &msg); label_or_note(sp, &msg);
} }
} else { } 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 { if let Some((expected, found, exp_p, found_p)) = expected_found {

View file

@ -137,25 +137,25 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
diag.help( diag.help(
"given a type parameter `T` and a method `foo`: "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: the only ways to implement method `foo` are:
- constrain `T` with an explicit type: - constrain `T` with an explicit type:
``` ```
impl Trait<String> for X { 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`: - 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 { 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`: - change `foo` to return an argument of type `T`:
``` ```
impl<T> Trait<T> for X { impl<T> Trait<T> for X {
fn foo(&tcx, x: T) -> T { x } fn foo(&self, x: T) -> T { x }
} }
```", ```",
); );
@ -389,14 +389,14 @@ impl<T> Trait<T> for X {
``` ```
trait Trait { trait Trait {
type T; 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: the only way of implementing method `foo` is to constrain `T` with an explicit associated type:
``` ```
impl Trait for X { impl Trait for X {
type T = String; type T = String;
fn foo(&tcx) -> Self::T { String::new() } fn foo(&self) -> Self::T { String::new() }
} }
```", ```",
); );

View file

@ -8,9 +8,7 @@ use rustc_span::symbol::Symbol;
use rustc_target::spec::abi; use rustc_target::spec::abi;
use std::borrow::Cow; use std::borrow::Cow;
use std::collections::hash_map::DefaultHasher; use std::collections::hash_map::DefaultHasher;
use std::fmt; use std::hash::{Hash, Hasher};
use std::hash::Hash;
use std::hash::Hasher;
use std::path::PathBuf; use std::path::PathBuf;
#[derive(Clone, Copy, Debug, PartialEq, Eq, TypeFoldable, TypeVisitable, Lift)] #[derive(Clone, Copy, Debug, PartialEq, Eq, TypeFoldable, TypeVisitable, Lift)]
@ -87,20 +85,16 @@ impl TypeError<'_> {
/// in parentheses after some larger message. You should also invoke `note_and_explain_type_err()` /// 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 /// afterwards to present additional details, particularly when it comes to lifetime-related
/// errors. /// errors.
impl<'tcx> fmt::Display for TypeError<'tcx> { impl<'tcx> TypeError<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { pub fn to_string(self, tcx: TyCtxt<'tcx>) -> String {
use self::TypeError::*; use self::TypeError::*;
fn report_maybe_different( fn report_maybe_different(expected: &str, found: &str) -> String {
f: &mut fmt::Formatter<'_>,
expected: &str,
found: &str,
) -> fmt::Result {
// A naive approach to making sure that we're not reporting silly errors such as: // A naive approach to making sure that we're not reporting silly errors such as:
// (expected closure, found closure). // (expected closure, found closure).
if expected == found { if expected == found {
write!(f, "expected {}, found a different {}", expected, found) format!("expected {}, found a different {}", expected, found)
} else { } else {
write!(f, "expected {}, found {}", expected, found) format!("expected {}, found {}", expected, found)
} }
} }
@ -109,64 +103,59 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
_ => String::new(), _ => String::new(),
}; };
match *self { match self {
CyclicTy(_) => write!(f, "cyclic type of infinite size"), CyclicTy(_) => format!("cyclic type of infinite size"),
CyclicConst(_) => write!(f, "encountered a self-referencing constant"), CyclicConst(_) => format!("encountered a self-referencing constant"),
Mismatch => write!(f, "types differ"), Mismatch => format!("types differ"),
ConstnessMismatch(values) => { ConstnessMismatch(values) => {
write!(f, "expected {} bound, found {} bound", values.expected, values.found) format!("expected {} bound, found {} bound", values.expected, values.found)
} }
PolarityMismatch(values) => { PolarityMismatch(values) => {
write!(f, "expected {} polarity, found {} polarity", values.expected, values.found) format!("expected {} polarity, found {} polarity", values.expected, values.found)
} }
UnsafetyMismatch(values) => { UnsafetyMismatch(values) => {
write!(f, "expected {} fn, found {} fn", values.expected, values.found) format!("expected {} fn, found {} fn", values.expected, values.found)
} }
AbiMismatch(values) => { 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"), ArgumentMutability(_) | Mutability => format!("types differ in mutability"),
TupleSize(values) => write!( TupleSize(values) => format!(
f,
"expected a tuple with {} element{}, found one with {} element{}", "expected a tuple with {} element{}, found one with {} element{}",
values.expected, values.expected,
pluralize!(values.expected), pluralize!(values.expected),
values.found, values.found,
pluralize!(values.found) pluralize!(values.found)
), ),
FixedArraySize(values) => write!( FixedArraySize(values) => format!(
f,
"expected an array with a fixed size of {} element{}, found one with {} element{}", "expected an array with a fixed size of {} element{}, found one with {} element{}",
values.expected, values.expected,
pluralize!(values.expected), pluralize!(values.expected),
values.found, values.found,
pluralize!(values.found) pluralize!(values.found)
), ),
ArgCount => write!(f, "incorrect number of function parameters"), ArgCount => format!("incorrect number of function parameters"),
FieldMisMatch(adt, field) => write!(f, "field type mismatch: {}.{}", adt, field), FieldMisMatch(adt, field) => format!("field type mismatch: {}.{}", adt, field),
RegionsDoesNotOutlive(..) => write!(f, "lifetime mismatch"), RegionsDoesNotOutlive(..) => format!("lifetime mismatch"),
// Actually naming the region here is a bit confusing because context is lacking // Actually naming the region here is a bit confusing because context is lacking
RegionsInsufficientlyPolymorphic(..) => { RegionsInsufficientlyPolymorphic(..) => {
write!(f, "one type is more general than the other") format!("one type is more general than the other")
} }
RegionsOverlyPolymorphic(br, _) => write!( RegionsOverlyPolymorphic(br, _) => format!(
f,
"expected concrete lifetime, found bound lifetime parameter{}", "expected concrete lifetime, found bound lifetime parameter{}",
br_string(br) br_string(br)
), ),
RegionsPlaceholderMismatch => write!(f, "one type is more general than the other"), RegionsPlaceholderMismatch => format!("one type is more general than the other"),
ArgumentSorts(values, _) | Sorts(values) => ty::tls::with(|tcx| { ArgumentSorts(values, _) | Sorts(values) => {
let (mut expected, mut found) = with_forced_trimmed_paths!(( let mut expected = values.expected.sort_string(tcx);
values.expected.sort_string(tcx), let mut found = values.found.sort_string(tcx);
values.found.sort_string(tcx),
));
if expected == found { if expected == found {
expected = values.expected.sort_string(tcx); expected = values.expected.sort_string(tcx);
found = values.found.sort_string(tcx); found = values.found.sort_string(tcx);
} }
report_maybe_different(f, &expected, &found) report_maybe_different(&expected, &found)
}), }
Traits(values) => ty::tls::with(|tcx| { Traits(values) => {
let (mut expected, mut found) = with_forced_trimmed_paths!(( let (mut expected, mut found) = with_forced_trimmed_paths!((
tcx.def_path_str(values.expected), tcx.def_path_str(values.expected),
tcx.def_path_str(values.found), tcx.def_path_str(values.found),
@ -175,12 +164,8 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
expected = tcx.def_path_str(values.expected); expected = tcx.def_path_str(values.expected);
found = tcx.def_path_str(values.found); found = tcx.def_path_str(values.found);
} }
report_maybe_different( report_maybe_different(&format!("trait `{expected}`"), &format!("trait `{found}`"))
f, }
&format!("trait `{expected}`"),
&format!("trait `{found}`"),
)
}),
IntMismatch(ref values) => { IntMismatch(ref values) => {
let expected = match values.expected { let expected = match values.expected {
ty::IntVarValue::IntType(ty) => ty.name_str(), ty::IntVarValue::IntType(ty) => ty.name_str(),
@ -190,41 +175,34 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
ty::IntVarValue::IntType(ty) => ty.name_str(), ty::IntVarValue::IntType(ty) => ty.name_str(),
ty::IntVarValue::UintType(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) => { FloatMismatch(ref values) => {
write!( format!(
f,
"expected `{}`, found `{}`", "expected `{}`, found `{}`",
values.expected.name_str(), values.expected.name_str(),
values.found.name_str() values.found.name_str()
) )
} }
VariadicMismatch(ref values) => write!( VariadicMismatch(ref values) => format!(
f,
"expected {} fn, found {} function", "expected {} fn, found {} function",
if values.expected { "variadic" } else { "non-variadic" }, if values.expected { "variadic" } else { "non-variadic" },
if values.found { "variadic" } else { "non-variadic" } if values.found { "variadic" } else { "non-variadic" }
), ),
ProjectionMismatched(ref values) => ty::tls::with(|tcx| { ProjectionMismatched(ref values) => format!(
write!( "expected {}, found {}",
f, tcx.def_path_str(values.expected),
"expected {}, found {}", tcx.def_path_str(values.found)
tcx.def_path_str(values.expected), ),
tcx.def_path_str(values.found)
)
}),
ExistentialMismatch(ref values) => report_maybe_different( ExistentialMismatch(ref values) => report_maybe_different(
f,
&format!("trait `{}`", values.expected), &format!("trait `{}`", values.expected),
&format!("trait `{}`", values.found), &format!("trait `{}`", values.found),
), ),
ConstMismatch(ref values) => { 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"), IntrinsicCast => format!("cannot coerce intrinsics to function pointers"),
TargetFeatureCast(_) => write!( TargetFeatureCast(_) => format!(
f,
"cannot coerce functions with `#[target_feature]` to safe function pointers" "cannot coerce functions with `#[target_feature]` to safe function pointers"
), ),
} }
@ -259,60 +237,9 @@ impl<'tcx> TypeError<'tcx> {
} }
impl<'tcx> Ty<'tcx> { 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() { 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::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) { ty::FnDef(def_id, ..) => match tcx.def_kind(def_id) {
DefKind::Ctor(CtorOf::Struct, _) => "struct constructor".into(), DefKind::Ctor(CtorOf::Struct, _) => "struct constructor".into(),
DefKind::Ctor(CtorOf::Variant, _) => "enum constructor".into(), DefKind::Ctor(CtorOf::Variant, _) => "enum constructor".into(),
@ -320,14 +247,13 @@ impl<'tcx> Ty<'tcx> {
}, },
ty::FnPtr(_) => "fn pointer".into(), ty::FnPtr(_) => "fn pointer".into(),
ty::Dynamic(ref inner, ..) if let Some(principal) = inner.principal() => { 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::Dynamic(..) => "trait object".into(),
ty::Closure(..) => "closure".into(), ty::Closure(..) => "closure".into(),
ty::Generator(def_id, ..) => tcx.generator_kind(def_id).unwrap().descr().into(), ty::Generator(def_id, ..) => tcx.generator_kind(def_id).unwrap().descr().into(),
ty::GeneratorWitness(..) | ty::GeneratorWitness(..) |
ty::GeneratorWitnessMIR(..) => "generator witness".into(), ty::GeneratorWitnessMIR(..) => "generator witness".into(),
ty::Tuple(..) => "tuple".into(),
ty::Infer(ty::TyVar(_)) => "inferred type".into(), ty::Infer(ty::TyVar(_)) => "inferred type".into(),
ty::Infer(ty::IntVar(_)) => "integer".into(), ty::Infer(ty::IntVar(_)) => "integer".into(),
ty::Infer(ty::FloatVar(_)) => "floating-point number".into(), ty::Infer(ty::FloatVar(_)) => "floating-point number".into(),
@ -337,9 +263,14 @@ impl<'tcx> Ty<'tcx> {
ty::Infer(ty::FreshIntTy(_)) => "fresh integral type".into(), ty::Infer(ty::FreshIntTy(_)) => "fresh integral type".into(),
ty::Infer(ty::FreshFloatTy(_)) => "fresh floating-point type".into(), ty::Infer(ty::FreshFloatTy(_)) => "fresh floating-point type".into(),
ty::Alias(ty::Projection, _) => "associated 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::Alias(ty::Opaque, ..) => "opaque type".into(),
ty::Error(_) => "type error".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))
}
} }
} }
@ -386,16 +317,14 @@ impl<'tcx> Ty<'tcx> {
} }
impl<'tcx> TyCtxt<'tcx> { impl<'tcx> TyCtxt<'tcx> {
pub fn short_ty_string(self, ty: Ty<'tcx>) -> (String, Option<PathBuf>) { pub fn ty_string_with_limit(self, ty: Ty<'tcx>, length_limit: usize) -> String {
let width = self.sess.diagnostic_width();
let length_limit = width.saturating_sub(30);
let mut type_limit = 50; let mut type_limit = 50;
let regular = FmtPrinter::new(self, hir::def::Namespace::TypeNS) let regular = FmtPrinter::new(self, hir::def::Namespace::TypeNS)
.pretty_print_type(ty) .pretty_print_type(ty)
.expect("could not write to `String`") .expect("could not write to `String`")
.into_buffer(); .into_buffer();
if regular.len() <= width { if regular.len() <= length_limit {
return (regular, None); return regular;
} }
let mut short; let mut short;
loop { loop {
@ -415,6 +344,20 @@ impl<'tcx> TyCtxt<'tcx> {
} }
type_limit -= 1; 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 { if regular == short {
return (regular, None); return (regular, None);
} }

View file

@ -2454,7 +2454,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
.at(&cause, obligation.param_env) .at(&cause, obligation.param_env)
.define_opaque_types(false) .define_opaque_types(false)
.eq(placeholder_obligation_trait_ref, impl_trait_ref) .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); nested_obligations.extend(obligations);
if !self.is_intercrate() if !self.is_intercrate()

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/track-diagnostics.rs:LL:CC --> $DIR/track-diagnostics.rs:LL:CC
| |
LL | const S: A = B; 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 -Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:LL:CC
error: aborting due to previous error error: aborting due to previous error

View file

@ -11,7 +11,7 @@ all:
tr -d '\r\n' | $(CGREP) -e \ tr -d '\r\n' | $(CGREP) -e \
"mismatched types.*\ "mismatched types.*\
crateB::try_foo\(foo2\);.*\ crateB::try_foo\(foo2\);.*\
expected struct \`crateA::foo::Foo\`, found struct \`Foo\`.*\ expected \`crateA::foo::Foo\`, found \`Foo\`.*\
different versions of crate \`crateA\`.*\ different versions of crate \`crateA\`.*\
mismatched types.*\ mismatched types.*\
crateB::try_bar\(bar2\);.*\ crateB::try_bar\(bar2\);.*\

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/track-diagnostics.rs:LL:CC --> $DIR/track-diagnostics.rs:LL:CC
| |
LL | const S: A = B; 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 -Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:LL:CC
error: aborting due to previous error error: aborting due to previous error

View file

@ -10,7 +10,7 @@ LL | || ) -> ()
LL | | { LL | | {
LL | | loop {} LL | | loop {}
LL | | } LL | | }
| |__^ expected `&Layout`, found struct `Layout` | |__^ expected `&Layout`, found `Layout`
| |
note: function defined here note: function defined here
--> $DIR/alloc-error-handler-bad-signature-1.rs:10:4 --> $DIR/alloc-error-handler-bad-signature-1.rs:10:4

View file

@ -9,12 +9,12 @@ LL | || ) {
| ||_- arguments to this function are incorrect | ||_- arguments to this function are incorrect
LL | | loop {} LL | | loop {}
LL | | } 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: `core::alloc::Layout` and `Layout` have similar names, but are actually distinct types
note: struct `core::alloc::Layout` is defined in crate `core` note: `core::alloc::Layout` is defined in crate `core`
--> $SRC_DIR/core/src/alloc/layout.rs:LL:COL --> $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 --> $DIR/alloc-error-handler-bad-signature-2.rs:7:1
| |
LL | struct Layout; LL | struct Layout;

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/formal-and-expected-differ.rs:22:29 --> $DIR/formal-and-expected-differ.rs:22:29
| |
LL | let _: U<_, u32> = U(1, S(3u32)); LL | let _: U<_, u32> = U(1, S(3u32));
| - ^^^^^^^ expected `f32`, found `u32` | - ^^^^^^^ expected `S<f32>`, found `S<u32>`
| | | |
| arguments to this struct are incorrect | arguments to this struct are incorrect
| |
@ -18,7 +18,7 @@ error[E0308]: mismatched types
--> $DIR/formal-and-expected-differ.rs:22:24 --> $DIR/formal-and-expected-differ.rs:22:24
| |
LL | let _: U<_, u32> = U(1, S(3u32)); LL | let _: U<_, u32> = U(1, S(3u32));
| --------- ^^^^^^^^^^^^^ expected `u32`, found `f32` | --------- ^^^^^^^^^^^^^ expected `U<_, u32>`, found `U<i32, f32>`
| | | |
| expected due to this | expected due to this
| |

View file

@ -100,7 +100,7 @@ error[E0308]: mismatched types
--> $DIR/invalid_arguments.rs:24:18 --> $DIR/invalid_arguments.rs:24:18
| |
LL | three_arg_diff(X{}, 1.0, ""); LL | three_arg_diff(X{}, 1.0, "");
| -------------- ^^^ expected `i32`, found struct `X` | -------------- ^^^ expected `i32`, found `X`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
@ -114,7 +114,7 @@ error[E0308]: mismatched types
--> $DIR/invalid_arguments.rs:25:21 --> $DIR/invalid_arguments.rs:25:21
| |
LL | three_arg_diff(1, X {}, ""); LL | three_arg_diff(1, X {}, "");
| -------------- ^^^^ expected `f32`, found struct `X` | -------------- ^^^^ expected `f32`, found `X`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
@ -128,7 +128,7 @@ error[E0308]: mismatched types
--> $DIR/invalid_arguments.rs:26:26 --> $DIR/invalid_arguments.rs:26:26
| |
LL | three_arg_diff(1, 1.0, X {}); LL | three_arg_diff(1, 1.0, X {});
| -------------- ^^^^ expected `&str`, found struct `X` | -------------- ^^^^ expected `&str`, found `X`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
@ -142,9 +142,9 @@ error[E0308]: arguments to this function are incorrect
--> $DIR/invalid_arguments.rs:28:3 --> $DIR/invalid_arguments.rs:28:3
| |
LL | three_arg_diff(X {}, X {}, ""); 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 note: function defined here
--> $DIR/invalid_arguments.rs:8:4 --> $DIR/invalid_arguments.rs:8:4
@ -156,9 +156,9 @@ error[E0308]: arguments to this function are incorrect
--> $DIR/invalid_arguments.rs:29:3 --> $DIR/invalid_arguments.rs:29:3
| |
LL | three_arg_diff(X {}, 1.0, X {}); 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 note: function defined here
--> $DIR/invalid_arguments.rs:8:4 --> $DIR/invalid_arguments.rs:8:4
@ -170,9 +170,9 @@ error[E0308]: arguments to this function are incorrect
--> $DIR/invalid_arguments.rs:30:3 --> $DIR/invalid_arguments.rs:30:3
| |
LL | three_arg_diff(1, X {}, X {}); 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 note: function defined here
--> $DIR/invalid_arguments.rs:8:4 --> $DIR/invalid_arguments.rs:8:4
@ -184,10 +184,10 @@ error[E0308]: arguments to this function are incorrect
--> $DIR/invalid_arguments.rs:32:3 --> $DIR/invalid_arguments.rs:32:3
| |
LL | three_arg_diff(X {}, X {}, X {}); LL | three_arg_diff(X {}, X {}, X {});
| ^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found struct `X` | ^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found `X`
| | | | | |
| | expected `f32`, found struct `X` | | expected `f32`, found `X`
| expected `i32`, found struct `X` | expected `i32`, found `X`
| |
note: function defined here note: function defined here
--> $DIR/invalid_arguments.rs:8:4 --> $DIR/invalid_arguments.rs:8:4
@ -199,7 +199,7 @@ error[E0308]: mismatched types
--> $DIR/invalid_arguments.rs:34:20 --> $DIR/invalid_arguments.rs:34:20
| |
LL | three_arg_repeat(X {}, 1, ""); LL | three_arg_repeat(X {}, 1, "");
| ---------------- ^^^^ expected `i32`, found struct `X` | ---------------- ^^^^ expected `i32`, found `X`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
@ -213,7 +213,7 @@ error[E0308]: mismatched types
--> $DIR/invalid_arguments.rs:35:23 --> $DIR/invalid_arguments.rs:35:23
| |
LL | three_arg_repeat(1, X {}, ""); LL | three_arg_repeat(1, X {}, "");
| ---------------- ^^^^ expected `i32`, found struct `X` | ---------------- ^^^^ expected `i32`, found `X`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
@ -227,7 +227,7 @@ error[E0308]: mismatched types
--> $DIR/invalid_arguments.rs:36:26 --> $DIR/invalid_arguments.rs:36:26
| |
LL | three_arg_repeat(1, 1, X {}); LL | three_arg_repeat(1, 1, X {});
| ---------------- ^^^^ expected `&str`, found struct `X` | ---------------- ^^^^ expected `&str`, found `X`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
@ -241,9 +241,9 @@ error[E0308]: arguments to this function are incorrect
--> $DIR/invalid_arguments.rs:38:3 --> $DIR/invalid_arguments.rs:38:3
| |
LL | three_arg_repeat(X {}, X {}, ""); 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 note: function defined here
--> $DIR/invalid_arguments.rs:9:4 --> $DIR/invalid_arguments.rs:9:4
@ -255,9 +255,9 @@ error[E0308]: arguments to this function are incorrect
--> $DIR/invalid_arguments.rs:39:3 --> $DIR/invalid_arguments.rs:39:3
| |
LL | three_arg_repeat(X {}, 1, X {}); 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 note: function defined here
--> $DIR/invalid_arguments.rs:9:4 --> $DIR/invalid_arguments.rs:9:4
@ -269,9 +269,9 @@ error[E0308]: arguments to this function are incorrect
--> $DIR/invalid_arguments.rs:40:3 --> $DIR/invalid_arguments.rs:40:3
| |
LL | three_arg_repeat(1, X {}, X{}); 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 note: function defined here
--> $DIR/invalid_arguments.rs:9:4 --> $DIR/invalid_arguments.rs:9:4
@ -283,10 +283,10 @@ error[E0308]: arguments to this function are incorrect
--> $DIR/invalid_arguments.rs:42:3 --> $DIR/invalid_arguments.rs:42:3
| |
LL | three_arg_repeat(X {}, X {}, X {}); LL | three_arg_repeat(X {}, X {}, X {});
| ^^^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found struct `X` | ^^^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found `X`
| | | | | |
| | expected `i32`, found struct `X` | | expected `i32`, found `X`
| expected `i32`, found struct `X` | expected `i32`, found `X`
| |
note: function defined here note: function defined here
--> $DIR/invalid_arguments.rs:9:4 --> $DIR/invalid_arguments.rs:9:4

View file

@ -41,7 +41,7 @@ error[E0308]: arguments to this function are incorrect
--> $DIR/issue-100478.rs:36:5 --> $DIR/issue-100478.rs:36:5
| |
LL | four_shuffle(T3::default(), T2::default(), T1::default(), T3::default()); 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 `T3`, found `T1`
| expected `T1`, found `T3` | expected `T1`, found `T3`

View file

@ -128,7 +128,7 @@ LL | f(C, C, A, B, A, A);
| ^ - - - - - expected `C`, found `A` | ^ - - - - - expected `C`, found `A`
| | | | | | | | | |
| | | | 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`
| expected `A`, found `C` | expected `A`, found `C`
| |

View file

@ -4,7 +4,7 @@ error[E0061]: this function takes 4 arguments but 7 arguments were supplied
LL | foo(&&A, B, C, D, E, F, G); LL | foo(&&A, B, C, D, E, F, G);
| ^^^ - - - - argument of type `F` unexpected | ^^^ - - - - argument of type `F` unexpected
| | | | | | | |
| | | expected `&E`, found struct `E` | | | expected `&E`, found `E`
| | argument of type `C` unexpected | | argument of type `C` unexpected
| argument of type `B` unexpected | argument of type `B` unexpected
| |

View file

@ -41,7 +41,7 @@ error[E0061]: this function takes 3 arguments but 2 arguments were supplied
LL | three_args(1, X {}); LL | three_args(1, X {});
| ^^^^^^^^^^--------- | ^^^^^^^^^^---------
| | | | | |
| | expected `f32`, found struct `X` | | expected `f32`, found `X`
| an argument of type `&str` is missing | an argument of type `&str` is missing
| |
note: function defined here note: function defined here
@ -78,7 +78,7 @@ error[E0308]: arguments to this function are incorrect
LL | three_args("", X {}, 1); LL | three_args("", X {}, 1);
| ^^^^^^^^^^ -- ---- - expected `&str`, found `{integer}` | ^^^^^^^^^^ -- ---- - expected `&str`, found `{integer}`
| | | | | |
| | expected `f32`, found struct `X` | | expected `f32`, found `X`
| expected `i32`, found `&'static str` | expected `i32`, found `&'static str`
| |
note: function defined here note: function defined here

View file

@ -4,14 +4,14 @@ error[E0308]: arguments to this function are incorrect
LL | foo(f, w); LL | foo(f, w);
| ^^^ | ^^^
| |
note: expected `i32`, found `u32` note: expected fn pointer, found fn item
--> $DIR/two-mismatch-notes.rs:10:9 --> $DIR/two-mismatch-notes.rs:10:9
| |
LL | foo(f, w); LL | foo(f, w);
| ^ | ^
= note: expected fn pointer `fn(i32)` = note: expected fn pointer `fn(i32)`
found fn item `fn(u32) {f}` 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 --> $DIR/two-mismatch-notes.rs:10:12
| |
LL | foo(f, w); LL | foo(f, w);

View file

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

View file

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

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/slice-to-vec-comparison.rs:4:9 --> $DIR/slice-to-vec-comparison.rs:4:9
| |
LL | a > b; LL | a > b;
| ^ expected array of 0 elements, found struct `Vec` | ^ expected `&[_; 0]`, found `&Vec<u8>`
| |
= note: expected reference `&[_; 0]` = note: expected reference `&[_; 0]`
found reference `&Vec<u8>` found reference `&Vec<u8>`

View file

@ -2,7 +2,7 @@ error[E0326]: implemented const `FROM` has an incompatible type for trait
--> $DIR/associated-const-generic-obligations.rs:14:17 --> $DIR/associated-const-generic-obligations.rs:14:17
| |
LL | const FROM: &'static str = "foo"; LL | const FROM: &'static str = "foo";
| ^^^^^^^^^^^^ expected associated type, found `&str` | ^^^^^^^^^^^^ expected associated type, found `&'static str`
| |
note: type in trait note: type in trait
--> $DIR/associated-const-generic-obligations.rs:10:17 --> $DIR/associated-const-generic-obligations.rs:10:17

View file

@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/elision.rs:5:79 --> $DIR/elision.rs:5:79
| |
LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()> { x.next() } 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 | | expected `Option<&'static ()>` because of return type
| this type parameter | this type parameter

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn hello<F: for<'a> Iterator<Item: 'a>>() { LL | fn hello<F: for<'a> Iterator<Item: 'a>>() {
| - help: try adding a return type: `-> Incorrect` | - help: try adding a return type: `-> Incorrect`
LL | Incorrect LL | Incorrect
| ^^^^^^^^^ expected `()`, found struct `Incorrect` | ^^^^^^^^^ expected `()`, found `Incorrect`
error: aborting due to previous error error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:27:23 --> $DIR/associated-type-projection-from-supertrait.rs:27:23
| |
LL | fn b() { dent(ModelT, Blue); } LL | fn b() { dent(ModelT, Blue); }
| ---- ^^^^ expected struct `Black`, found struct `Blue` | ---- ^^^^ expected `Black`, found `Blue`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
@ -16,7 +16,7 @@ error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:28:23 --> $DIR/associated-type-projection-from-supertrait.rs:28:23
| |
LL | fn c() { dent(ModelU, Black); } LL | fn c() { dent(ModelU, Black); }
| ---- ^^^^^ expected struct `Blue`, found struct `Black` | ---- ^^^^^ expected `Blue`, found `Black`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
@ -30,7 +30,7 @@ error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:32:28 --> $DIR/associated-type-projection-from-supertrait.rs:32:28
| |
LL | fn f() { ModelT.chip_paint(Blue); } LL | fn f() { ModelT.chip_paint(Blue); }
| ---------- ^^^^ expected struct `Black`, found struct `Blue` | ---------- ^^^^ expected `Black`, found `Blue`
| | | |
| arguments to this method are incorrect | arguments to this method are incorrect
| |
@ -44,7 +44,7 @@ error[E0308]: mismatched types
--> $DIR/associated-type-projection-from-supertrait.rs:33:28 --> $DIR/associated-type-projection-from-supertrait.rs:33:28
| |
LL | fn g() { ModelU.chip_paint(Black); } LL | fn g() { ModelU.chip_paint(Black); }
| ---------- ^^^^^ expected struct `Blue`, found struct `Black` | ---------- ^^^^^ expected `Blue`, found `Black`
| | | |
| arguments to this method are incorrect | arguments to this method are incorrect
| |

View file

@ -23,7 +23,7 @@ fn foo2<I: Foo>(x: I) {
let _: Bar = x.boo(); let _: Bar = x.boo();
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| found associated type `<I as Foo>::A` //~| found associated type `<I as Foo>::A`
//~| expected struct `Bar`, found associated type //~| expected `Bar`, found
//~| expected struct `Bar` //~| expected struct `Bar`
} }

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/associated-types-eq-3.rs:23:18 --> $DIR/associated-types-eq-3.rs:23:18
| |
LL | let _: Bar = x.boo(); LL | let _: Bar = x.boo();
| --- ^^^^^^^ expected struct `Bar`, found associated type | --- ^^^^^^^ expected `Bar`, found associated type
| | | |
| expected due to this | expected due to this
| |

View file

@ -57,7 +57,7 @@ error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:49:44 --> $DIR/async-block-control-flow-static-semantics.rs:49:44
| |
LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> { LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
| ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected `Result<u8, MyErr>`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
| |
@ -68,7 +68,7 @@ error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:58:50 --> $DIR/async-block-control-flow-static-semantics.rs:58:50
| |
LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> { LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> {
| ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected `Result<u8, MyErr>`, found `()`
| | | |
| implicitly returns `()` as its body has no tail or `return` expression | implicitly returns `()` as its body has no tail or `return` expression
| |

View file

@ -2,7 +2,7 @@ error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:15:28 --> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
| |
LL | async fn foo(&self) -> i32 { 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 note: type in trait
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:22 --> $DIR/async-example-desugared-boxed-in-trait.rs:11:22

View file

@ -13,7 +13,7 @@ error[E0308]: mismatched types
LL | Ok(()) LL | Ok(())
| ^^^^^^- help: consider using a semicolon here: `;` | ^^^^^^- help: consider using a semicolon here: `;`
| | | |
| expected `()`, found enum `Result` | expected `()`, found `Result<(), _>`
| |
= note: expected unit type `()` = note: expected unit type `()`
found enum `Result<(), _>` found enum `Result<(), _>`

View file

@ -89,7 +89,7 @@ async fn match_() {
match tuple() { //~ HELP consider `await`ing on the `Future` match tuple() { //~ HELP consider `await`ing on the `Future`
//~^ NOTE this expression has type `impl Future<Output = Tuple>` //~^ NOTE this expression has type `impl Future<Output = Tuple>`
Tuple(_) => {} //~ ERROR mismatched types 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>` //~| NOTE expected opaque type `impl Future<Output = Tuple>`
} }
} }

View file

@ -62,7 +62,7 @@ LL | match tuple() {
| ------- this expression has type `impl Future<Output = Tuple>` | ------- this expression has type `impl Future<Output = Tuple>`
LL | LL |
LL | Tuple(_) => {} LL | Tuple(_) => {}
| ^^^^^^^^ expected opaque type, found struct `Tuple` | ^^^^^^^^ expected opaque type, found `Tuple`
| |
note: while checking the return type of the `async fn` note: while checking the return type of the `async fn`
--> $DIR/issue-61076.rs:56:21 --> $DIR/issue-61076.rs:56:21

View file

@ -2,7 +2,7 @@ error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn
--> $DIR/issue-98634.rs:45:23 --> $DIR/issue-98634.rs:45:23
| |
LL | StructAsync { callback }.await; 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` note: while checking the return type of the `async fn`
--> $DIR/issue-98634.rs:24:21 --> $DIR/issue-98634.rs:24:21
@ -21,7 +21,7 @@ error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn
--> $DIR/issue-98634.rs:45:9 --> $DIR/issue-98634.rs:45:9
| |
LL | StructAsync { callback }.await; 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` note: while checking the return type of the `async fn`
--> $DIR/issue-98634.rs:24:21 --> $DIR/issue-98634.rs:24:21
@ -40,7 +40,7 @@ error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn
--> $DIR/issue-98634.rs:45:33 --> $DIR/issue-98634.rs:45:33
| |
LL | StructAsync { callback }.await; 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` note: while checking the return type of the `async fn`
--> $DIR/issue-98634.rs:24:21 --> $DIR/issue-98634.rs:24:21

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | std::mem::size_of_val(foo()); LL | std::mem::size_of_val(foo());
| --------------------- ^^^^^ | --------------------- ^^^^^
| | | | | |
| | expected reference, found opaque type | | expected `&_`, found opaque type
| | help: consider borrowing here: `&foo()` | | help: consider borrowing here: `&foo()`
| arguments to this function are incorrect | arguments to this function are incorrect
| |

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/proper-span-for-type-error.rs:8:5 --> $DIR/proper-span-for-type-error.rs:8:5
| |
LL | a().await LL | a().await
| ^^^^^^^^^ expected enum `Result`, found `()` | ^^^^^^^^^ expected `Result<(), i32>`, found `()`
| |
= note: expected enum `Result<(), i32>` = note: expected enum `Result<(), i32>`
found unit type `()` found unit type `()`

View file

@ -127,7 +127,7 @@ LL | match dummy_result() {
| -------------- this expression has type `impl Future<Output = Result<(), ()>>` | -------------- this expression has type `impl Future<Output = Result<(), ()>>`
... ...
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ expected opaque type, found enum `Result` | ^^^^^ expected opaque type, found `Result<_, _>`
| |
note: while checking the return type of the `async fn` note: while checking the return type of the `async fn`
--> $DIR/suggest-missing-await.rs:57:28 --> $DIR/suggest-missing-await.rs:57:28
@ -148,7 +148,7 @@ LL | match dummy_result() {
| -------------- this expression has type `impl Future<Output = Result<(), ()>>` | -------------- this expression has type `impl Future<Output = Result<(), ()>>`
... ...
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ expected opaque type, found enum `Result` | ^^^^^^ expected opaque type, found `Result<_, _>`
| |
note: while checking the return type of the `async fn` note: while checking the return type of the `async fn`
--> $DIR/suggest-missing-await.rs:57:28 --> $DIR/suggest-missing-await.rs:57:28

View file

@ -10,7 +10,7 @@ error[E0308]: mismatched types
--> $DIR/issue-38940.rs:49:22 --> $DIR/issue-38940.rs:49:22
| |
LL | let x: &Bottom = &t; LL | let x: &Bottom = &t;
| ------- ^^ expected struct `Bottom`, found struct `Top` | ------- ^^ expected `&Bottom`, found `&Top`
| | | |
| expected due to this | expected due to this
| |

View file

@ -7,7 +7,7 @@ LL | mod foo { pub struct bar; }
LL | let bar = 5; LL | let bar = 5;
| ^^^ - this expression has type `{integer}` | ^^^ - 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 | `bar` is interpreted as a unit struct, not a new binding
| help: introduce a new binding instead: `other_bar` | help: introduce a new binding instead: `other_bar`

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn main() { LL | fn main() {
| - expected `()` because of default return type | - expected `()` because of default return type
LL | &panic!() LL | &panic!()
| ^^^^^^^^^ expected `()`, found reference | ^^^^^^^^^ expected `()`, found `&_`
| |
= note: expected unit type `()` = note: expected unit type `()`
found reference `&_` found reference `&_`

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-82446.rs:11:9 --> $DIR/issue-82446.rs:11:9
| |
LL | val LL | val
| ^^^ expected struct `Box`, found reference | ^^^ expected `Box<dyn MyTrait>`, found `&Box<dyn MyTrait>`
| |
= note: expected struct `Box<(dyn MyTrait + 'static)>` = note: expected struct `Box<(dyn MyTrait + 'static)>`
found reference `&Box<(dyn MyTrait + 'static)>` found reference `&Box<(dyn MyTrait + 'static)>`

View file

@ -26,7 +26,7 @@ error[E0308]: mismatched types
--> $DIR/issue-78720.rs:7:39 --> $DIR/issue-78720.rs:7:39
| |
LL | fn map2<F>(self, f: F) -> Map2<F> {} LL | fn map2<F>(self, f: F) -> Map2<F> {}
| ^^ expected struct `Map2`, found `()` | ^^ expected `Map2<F>`, found `()`
| |
= note: expected struct `Map2<F>` = note: expected struct `Map2<F>`
found unit type `()` found unit type `()`

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-block-tail-26978.rs:9:9 --> $DIR/coerce-block-tail-26978.rs:9:9
| |
LL | f(&{x}); LL | f(&{x});
| ^ expected `i32`, found struct `Box` | ^ expected `i32`, found `Box<i32>`
| |
= note: expected type `i32` = note: expected type `i32`
found struct `Box<i32>` found struct `Box<i32>`

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-block-tail-57749.rs:33:14 --> $DIR/coerce-block-tail-57749.rs:33:14
| |
LL | reset(&{ Homura }); LL | reset(&{ Homura });
| ^^^^^^ expected `u32`, found struct `Homura` | ^^^^^^ expected `u32`, found `Homura`
| |
help: consider dereferencing the type help: consider dereferencing the type
| |

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-block-tail-83783.rs:7:32 --> $DIR/coerce-block-tail-83783.rs:7:32
| |
LL | _consume_reference::<i32>(&async { Box::new(7_i32) }.await); LL | _consume_reference::<i32>(&async { Box::new(7_i32) }.await);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `Box` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `Box<i32>`
| |
= note: expected type `i32` = note: expected type `i32`
found struct `Box<i32>` found struct `Box<i32>`

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-block-tail-83850.rs:5:7 --> $DIR/coerce-block-tail-83850.rs:5:7
| |
LL | f(&Box::new([1, 2])); LL | f(&Box::new([1, 2]));
| - ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found struct `Box` | - ^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&Box<[{integer}; 2]>`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-block-tail.rs:4:23 --> $DIR/coerce-block-tail.rs:4:23
| |
LL | let _: &i32 = & { Box::new(1i32) }; LL | let _: &i32 = & { Box::new(1i32) };
| ^^^^^^^^^^^^^^ expected `i32`, found struct `Box` | ^^^^^^^^^^^^^^ expected `i32`, found `Box<i32>`
| |
= note: expected type `i32` = note: expected type `i32`
found struct `Box<i32>` found struct `Box<i32>`

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:9:27 --> $DIR/coerce-expect-unsized-ascribed.rs:9:27
| |
LL | let _ = type_ascribe!(box { [1, 2, 3] }, Box<[i32]>); 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]>` = note: expected struct `Box<[i32]>`
found struct `Box<[i32; 3]>` found struct `Box<[i32; 3]>`
@ -11,7 +11,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:10:27 --> $DIR/coerce-expect-unsized-ascribed.rs:10:27
| |
LL | let _ = type_ascribe!(box if true { [1, 2, 3] } else { [1, 3, 4] }, Box<[i32]>); 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]>` = note: expected struct `Box<[i32]>`
found struct `Box<[i32; 3]>` found struct `Box<[i32; 3]>`
@ -20,7 +20,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:11:27 --> $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]>); 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]>` = note: expected struct `Box<[i32]>`
found struct `Box<[i32; 3]>` found struct `Box<[i32; 3]>`
@ -29,7 +29,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:13:27 --> $DIR/coerce-expect-unsized-ascribed.rs:13:27
| |
LL | let _ = type_ascribe!(box { |x| (x as u8) }, Box<dyn Fn(i32) -> _>); 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>` = note: expected struct `Box<dyn Fn(i32) -> u8>`
found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:33: 13:36]>` found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:33: 13:36]>`
@ -38,7 +38,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:14:27 --> $DIR/coerce-expect-unsized-ascribed.rs:14:27
| |
LL | let _ = type_ascribe!(box if true { false } else { true }, Box<dyn Debug>); 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>` = note: expected struct `Box<dyn Debug>`
found struct `Box<bool>` found struct `Box<bool>`
@ -47,7 +47,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:15:27 --> $DIR/coerce-expect-unsized-ascribed.rs:15:27
| |
LL | let _ = type_ascribe!(box match true { true => 'a', false => 'b' }, Box<dyn Debug>); 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>` = note: expected struct `Box<dyn Debug>`
found struct `Box<char>` found struct `Box<char>`
@ -56,7 +56,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:17:27 --> $DIR/coerce-expect-unsized-ascribed.rs:17:27
| |
LL | let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]); LL | let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]);
| ^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` | ^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]`
| |
= note: expected reference `&[i32]` = note: expected reference `&[i32]`
found reference `&[i32; 3]` found reference `&[i32; 3]`
@ -65,7 +65,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:18:27 --> $DIR/coerce-expect-unsized-ascribed.rs:18:27
| |
LL | let _ = type_ascribe!(&if true { [1, 2, 3] } else { [1, 3, 4] }, &[i32]); 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]` = note: expected reference `&[i32]`
found reference `&[i32; 3]` found reference `&[i32; 3]`
@ -74,7 +74,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:19:27 --> $DIR/coerce-expect-unsized-ascribed.rs:19:27
| |
LL | let _ = type_ascribe!(&match true { true => [1, 2, 3], false => [1, 3, 4] }, &[i32]); 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]` = note: expected reference `&[i32]`
found reference `&[i32; 3]` found reference `&[i32; 3]`
@ -83,7 +83,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:21:27 --> $DIR/coerce-expect-unsized-ascribed.rs:21:27
| |
LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _); 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` = note: expected reference `&dyn Fn(i32) -> u8`
found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:30: 21:33]` found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:30: 21:33]`
@ -92,7 +92,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:22:27 --> $DIR/coerce-expect-unsized-ascribed.rs:22:27
| |
LL | let _ = type_ascribe!(&if true { false } else { true }, &dyn Debug); 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` = note: expected reference `&dyn Debug`
found reference `&bool` found reference `&bool`
@ -101,7 +101,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:23:27 --> $DIR/coerce-expect-unsized-ascribed.rs:23:27
| |
LL | let _ = type_ascribe!(&match true { true => 'a', false => 'b' }, &dyn Debug); 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` = note: expected reference `&dyn Debug`
found reference `&char` found reference `&char`
@ -110,7 +110,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:25:27 --> $DIR/coerce-expect-unsized-ascribed.rs:25:27
| |
LL | let _ = type_ascribe!(Box::new([1, 2, 3]), Box<[i32]>); 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]>` = note: expected struct `Box<[i32]>`
found struct `Box<[i32; 3]>` found struct `Box<[i32; 3]>`
@ -119,7 +119,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:26:27 --> $DIR/coerce-expect-unsized-ascribed.rs:26:27
| |
LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box<dyn Fn(i32) -> _>); 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>` = note: expected struct `Box<dyn Fn(i32) -> u8>`
found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:36: 26:39]>` found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:36: 26:39]>`

View file

@ -82,7 +82,7 @@ error[E0308]: mismatched types
--> $DIR/coerce-to-bang.rs:50:21 --> $DIR/coerce-to-bang.rs:50:21
| |
LL | let x: [!; 2] = [return, 22]; LL | let x: [!; 2] = [return, 22];
| ------ ^^^^^^^^^^^^ expected `!`, found integer | ------ ^^^^^^^^^^^^ expected `[!; 2]`, found `[{integer}; 2]`
| | | |
| expected due to this | expected due to this
| |

View file

@ -12,7 +12,7 @@ error[E0308]: mismatched types
--> $DIR/coercion-missing-tail-expected-type.rs:8:13 --> $DIR/coercion-missing-tail-expected-type.rs:8:13
| |
LL | fn foo() -> Result<u8, u64> { 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 | implicitly returns `()` as its body has no tail or `return` expression
LL | Ok(1); LL | Ok(1);

View file

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

View file

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

View file

@ -4,7 +4,7 @@ error[E0053]: method `poll` has an incompatible type for trait
LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> { 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>` | help: change the self-receiver type to match the trait: `self: Pin<&mut MyFuture>`
| |
= note: expected signature `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>` = note: expected signature `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>`
@ -16,7 +16,7 @@ error[E0053]: method `foo` has an incompatible type for trait
LL | fn foo(self: Box<Self>) {} 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` | help: change the self-receiver type to match the trait: `self`
| |
note: type in trait note: type in trait
@ -31,7 +31,7 @@ error[E0053]: method `bar` has an incompatible type for trait
--> $DIR/bad-self-type.rs:24:18 --> $DIR/bad-self-type.rs:24:18
| |
LL | fn bar(self) {} LL | fn bar(self) {}
| ^ expected enum `Option`, found `()` | ^ expected `Option<()>`, found `()`
| |
note: type in trait note: type in trait
--> $DIR/bad-self-type.rs:18:21 --> $DIR/bad-self-type.rs:18:21

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/mismatch.rs:7:26 --> $DIR/mismatch.rs:7:26
| |
LL | let e: Example<13> = (); LL | let e: Example<13> = ();
| ----------- ^^ expected struct `Example`, found `()` | ----------- ^^ expected `Example`, found `()`
| | | |
| expected due to this | expected due to this
| |
@ -13,7 +13,7 @@ error[E0308]: mismatched types
--> $DIR/mismatch.rs:10:32 --> $DIR/mismatch.rs:10:32
| |
LL | let e: Example2<u32, 13> = (); LL | let e: Example2<u32, 13> = ();
| ----------------- ^^ expected struct `Example2`, found `()` | ----------------- ^^ expected `Example2`, found `()`
| | | |
| expected due to this | expected due to this
| |
@ -24,7 +24,7 @@ error[E0308]: mismatched types
--> $DIR/mismatch.rs:13:32 --> $DIR/mismatch.rs:13:32
| |
LL | let e: Example3<13, u32> = (); LL | let e: Example3<13, u32> = ();
| ----------------- ^^ expected struct `Example3`, found `()` | ----------------- ^^ expected `Example3`, found `()`
| | | |
| expected due to this | expected due to this
| |
@ -35,7 +35,7 @@ error[E0308]: mismatched types
--> $DIR/mismatch.rs:16:26 --> $DIR/mismatch.rs:16:26
| |
LL | let e: Example3<7> = (); LL | let e: Example3<7> = ();
| ----------- ^^ expected struct `Example3`, found `()` | ----------- ^^ expected `Example3<7>`, found `()`
| | | |
| expected due to this | expected due to this
| |
@ -46,7 +46,7 @@ error[E0308]: mismatched types
--> $DIR/mismatch.rs:19:26 --> $DIR/mismatch.rs:19:26
| |
LL | let e: Example4<7> = (); LL | let e: Example4<7> = ();
| ----------- ^^ expected struct `Example4`, found `()` | ----------- ^^ expected `Example4<7>`, found `()`
| | | |
| expected due to this | expected due to this
| |

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-79518-default_trait_method_normalization.rs:16:32 --> $DIR/issue-79518-default_trait_method_normalization.rs:16:32
| |
LL | Self::AssocInstance == [(); std::mem::size_of::<Self::Assoc>()]; 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` | expected because this is `<Self as Foo>::Assoc`
| |

View file

@ -5,7 +5,7 @@ LL | struct Bug<S> {
| - this type parameter | - this type parameter
... ...
LL | let x: S = MaybeUninit::uninit(); LL | let x: S = MaybeUninit::uninit();
| - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found union `MaybeUninit` | - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found `MaybeUninit<_>`
| | | |
| expected due to this | expected due to this
| |

View file

@ -8,7 +8,7 @@ error[E0308]: mismatched types
--> $DIR/type_mismatch.rs:5:26 --> $DIR/type_mismatch.rs:5:26
| |
LL | fn bar<const N: u8>() -> [u8; N] {} 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 | implicitly returns `()` as its body has no tail or `return` expression

View file

@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/type_not_in_scope.rs:7:33 --> $DIR/type_not_in_scope.rs:7:33
| |
LL | fn getn<const N: cfg_attr>() -> [u8; N] {} 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 | implicitly returns `()` as its body has no tail or `return` expression

View file

@ -11,7 +11,7 @@ error[E0308]: mismatched types
--> $DIR/types-mismatch-const-args.rs:16:41 --> $DIR/types-mismatch-const-args.rs:16:41
| |
LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32` | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 2, 3>`, found `A<'_, u32, 2, 3>`
| | | |
| expected due to this | expected due to this
| |
@ -22,7 +22,7 @@ error[E0308]: mismatched types
--> $DIR/types-mismatch-const-args.rs:18:41 --> $DIR/types-mismatch-const-args.rs:18:41
| |
LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; 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 | expected due to this
| |

View file

@ -13,7 +13,7 @@ error[E0308]: mismatched types
--> $DIR/types-mismatch-const-args.rs:16:41 --> $DIR/types-mismatch-const-args.rs:16:41
| |
LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32` | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 2, 3>`, found `A<'_, u32, 2, 3>`
| | | |
| expected due to this | expected due to this
| |
@ -24,7 +24,7 @@ error[E0308]: mismatched types
--> $DIR/types-mismatch-const-args.rs:18:41 --> $DIR/types-mismatch-const-args.rs:18:41
| |
LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; 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 | expected due to this
| |

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/nested_erroneous_ctfe.rs:2:16 --> $DIR/nested_erroneous_ctfe.rs:2:16
| |
LL | [9; || [9; []]]; LL | [9; || [9; []]];
| ^^ expected `usize`, found array of 0 elements | ^^ expected `usize`, found `[_; 0]`
| |
= note: expected type `usize` = note: expected type `usize`
found array `[_; 0]` found array `[_; 0]`

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/cross-borrow-trait.rs:10:26 --> $DIR/cross-borrow-trait.rs:10:26
| |
LL | let _y: &dyn Trait = x; LL | let _y: &dyn Trait = x;
| ---------- ^ expected `&dyn Trait`, found struct `Box` | ---------- ^ expected `&dyn Trait`, found `Box<dyn Trait>`
| | | |
| expected due to this | expected due to this
| |

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | match String::new() { LL | match String::new() {
| ------------- this expression has type `String` | ------------- this expression has type `String`
LL | "" | _ => {} LL | "" | _ => {}
| ^^ expected struct `String`, found `&str` | ^^ expected `String`, found `&str`
error: aborting due to previous error error: aborting due to previous error

View file

@ -22,7 +22,7 @@ error[E0308]: mismatched types
LL | let &&x = &1isize as &dyn T; LL | let &&x = &1isize as &dyn T;
| ^^ ----------------- this expression has type `&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` = note: expected trait object `dyn T`
found reference `&_` found reference `&_`
@ -38,7 +38,7 @@ error[E0308]: mismatched types
LL | let &&&x = &(&1isize as &dyn T); LL | let &&&x = &(&1isize as &dyn T);
| ^^ -------------------- this expression has type `&&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` = note: expected trait object `dyn T`
found reference `&_` found reference `&_`
@ -54,7 +54,7 @@ error[E0308]: mismatched types
LL | let box box x = Box::new(1isize) as Box<dyn T>; LL | let box box x = Box::new(1isize) as Box<dyn T>;
| ^^^^^ ------------------------------ this expression has type `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` = note: expected trait object `dyn T`
found struct `Box<_>` found struct `Box<_>`

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | (x, y) = &(1, 2); LL | (x, y) = &(1, 2);
| ^^^^^^ ------- this expression has type `&({integer}, {integer})` | ^^^^^^ ------- this expression has type `&({integer}, {integer})`
| | | |
| expected reference, found tuple | expected `&({integer}, {integer})`, found `(_, _)`
| |
= note: expected reference `&({integer}, {integer})` = note: expected reference `&({integer}, {integer})`
found tuple `(_, _)` found tuple `(_, _)`

View file

@ -16,7 +16,7 @@ LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok...
LL | | Ok("") LL | | Ok("")
LL | | )))))))))))))))))))))))))))))) LL | | ))))))))))))))))))))))))))))))
LL | | )))))))))))))))))))))))))))))); LL | | ))))))))))))))))))))))))))))));
| |__________________________________^ expected struct `Atype`, found enum `Result` | |__________________________________^ expected `Atype<Btype<..., ...>, ...>`, found `Result<Result<..., ...>, ...>`
| |
= note: expected struct `Atype<Btype<..., ...>, ...>` = 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' the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
@ -32,7 +32,7 @@ LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(...
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
LL | | )))))))))))))))))))))))))))))) LL | | ))))))))))))))))))))))))))))))
LL | | )))))))))))))))))))))))); LL | | ))))))))))))))))))))))));
| |____________________________^ expected enum `Option`, found enum `Result` | |____________________________^ expected `Option<Result<..., ...>>`, found `Result<Result<..., ...>, ...>`
| |
= note: expected enum `Option<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' the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
@ -50,7 +50,7 @@ LL | | Atype<
... | ... |
LL | | i32 LL | | i32
LL | | > = (); LL | | > = ();
| | - ^^ expected struct `Atype`, found `()` | | - ^^ expected `Atype<Btype<..., ...>, ...>`, found `()`
| |_____| | |_____|
| expected due to this | expected due to this
| |
@ -69,7 +69,7 @@ LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(...
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
LL | | )))))))))))))))))))))))))))))) LL | | ))))))))))))))))))))))))))))))
LL | | )))))))))))))))))))))))); LL | | ))))))))))))))))))))))));
| |____________________________^ expected `()`, found enum `Result` | |____________________________^ expected `()`, found `Result<Result<..., ...>, ...>`
| |
= note: expected unit type `()` = note: expected unit type `()`
found enum `Result<Result<..., ...>, ...>` found enum `Result<Result<..., ...>, ...>`

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/brackets-to-braces-single-element.rs:1:24 --> $DIR/brackets-to-braces-single-element.rs:1:24
| |
LL | const A: [&str; 1] = { "hello" }; 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 help: to create an array, use square brackets instead of curly braces
| |
@ -13,7 +13,7 @@ error[E0308]: mismatched types
--> $DIR/brackets-to-braces-single-element.rs:4:19 --> $DIR/brackets-to-braces-single-element.rs:4:19
| |
LL | const B: &[u32] = &{ 1 }; LL | const B: &[u32] = &{ 1 };
| ^^^^^^ expected slice `[u32]`, found integer | ^^^^^^ expected `&[u32]`, found `&{integer}`
| |
= note: expected reference `&'static [u32]` = note: expected reference `&'static [u32]`
found reference `&{integer}` found reference `&{integer}`
@ -26,7 +26,7 @@ error[E0308]: mismatched types
--> $DIR/brackets-to-braces-single-element.rs:7:27 --> $DIR/brackets-to-braces-single-element.rs:7:27
| |
LL | const C: &&[u32; 1] = &&{ 1 }; 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 help: to create an array, use square brackets instead of curly braces
| |

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | match f { LL | match f {
| - this expression has type `Foo` | - this expression has type `Foo`
LL | Bar { x } => { LL | Bar { x } => {
| ^^^^^^^^^ expected enum `Foo`, found struct `Bar` | ^^^^^^^^^ expected `Foo`, found `Bar`
| |
help: try wrapping the pattern in `Foo::Bar` help: try wrapping the pattern in `Foo::Bar`
| |
@ -22,7 +22,7 @@ LL | match s {
LL | S => { LL | S => {
| ^ | ^
| | | |
| expected enum `Option`, found struct `S` | expected `Option<S>`, found `S`
| `S` is interpreted as a unit struct, not a new binding | `S` is interpreted as a unit struct, not a new binding
| |
= note: expected enum `Option<S>` = note: expected enum `Option<S>`
@ -47,7 +47,7 @@ LL | match s {
LL | 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 | `S` is interpreted as a unit struct, not a new binding
| |
= note: expected enum `Result<S, S>` = note: expected enum `Result<S, S>`

View file

@ -7,7 +7,7 @@ LL | / while false {
LL | | LL | |
LL | | f(); LL | | f();
LL | | } LL | | }
| |_____^ expected enum `Option`, found `()` | |_____^ expected `Option<()>`, found `()`
| |
= note: expected enum `Option<()>` = note: expected enum `Option<()>`
found unit type `()` found unit type `()`
@ -26,7 +26,7 @@ error[E0308]: mismatched types
LL | fn b() -> Result<(), ()> { LL | fn b() -> Result<(), ()> {
| -------------- expected `Result<(), ()>` because of return type | -------------- expected `Result<(), ()>` because of return type
LL | f() LL | f()
| ^^^ expected enum `Result`, found `()` | ^^^ expected `Result<(), ()>`, found `()`
| |
= note: expected enum `Result<(), ()>` = note: expected enum `Result<(), ()>`
found unit type `()` found unit type `()`
@ -45,7 +45,7 @@ LL | / for _ in [1, 2] {
LL | | LL | |
LL | | f(); LL | | f();
LL | | } LL | | }
| |_____^ expected enum `Option`, found `()` | |_____^ expected `Option<()>`, found `()`
| |
= note: expected enum `Option<()>` = note: expected enum `Option<()>`
found unit type `()` found unit type `()`
@ -62,7 +62,7 @@ error[E0308]: `?` operator has incompatible types
--> $DIR/compatible-variants.rs:35:5 --> $DIR/compatible-variants.rs:35:5
| |
LL | c()? LL | c()?
| ^^^^ expected enum `Option`, found `()` | ^^^^ expected `Option<()>`, found `()`
| |
= note: `?` operator cannot convert from `()` to `Option<()>` = note: `?` operator cannot convert from `()` to `Option<()>`
= note: expected enum `Option<()>` = note: expected enum `Option<()>`
@ -85,7 +85,7 @@ error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:42:25 --> $DIR/compatible-variants.rs:42:25
| |
LL | let _: Option<()> = while false {}; LL | let _: Option<()> = while false {};
| ---------- ^^^^^^^^^^^^^^ expected enum `Option`, found `()` | ---------- ^^^^^^^^^^^^^^ expected `Option<()>`, found `()`
| | | |
| expected due to this | expected due to this
| |
@ -100,7 +100,7 @@ error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:46:9 --> $DIR/compatible-variants.rs:46:9
| |
LL | while false {} LL | while false {}
| ^^^^^^^^^^^^^^ expected enum `Option`, found `()` | ^^^^^^^^^^^^^^ expected `Option<()>`, found `()`
| |
= note: expected enum `Option<()>` = note: expected enum `Option<()>`
found unit type `()` found unit type `()`
@ -117,7 +117,7 @@ error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:50:31 --> $DIR/compatible-variants.rs:50:31
| |
LL | let _: Result<i32, i32> = 1; LL | let _: Result<i32, i32> = 1;
| ---------------- ^ expected enum `Result`, found integer | ---------------- ^ expected `Result<i32, i32>`, found integer
| | | |
| expected due to this | expected due to this
| |
@ -134,7 +134,7 @@ error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:53:26 --> $DIR/compatible-variants.rs:53:26
| |
LL | let _: Option<i32> = 1; LL | let _: Option<i32> = 1;
| ----------- ^ expected enum `Option`, found integer | ----------- ^ expected `Option<i32>`, found integer
| | | |
| expected due to this | expected due to this
| |
@ -149,7 +149,7 @@ error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:56:28 --> $DIR/compatible-variants.rs:56:28
| |
LL | let _: Hey<i32, i32> = 1; LL | let _: Hey<i32, i32> = 1;
| ------------- ^ expected enum `Hey`, found integer | ------------- ^ expected `Hey<i32, i32>`, found integer
| | | |
| expected due to this | expected due to this
| |
@ -166,7 +166,7 @@ error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:59:29 --> $DIR/compatible-variants.rs:59:29
| |
LL | let _: Hey<i32, bool> = false; LL | let _: Hey<i32, bool> = false;
| -------------- ^^^^^ expected enum `Hey`, found `bool` | -------------- ^^^^^ expected `Hey<i32, bool>`, found `bool`
| | | |
| expected due to this | expected due to this
| |
@ -181,7 +181,7 @@ error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:63:19 --> $DIR/compatible-variants.rs:63:19
| |
LL | let _ = Foo { bar }; LL | let _ = Foo { bar };
| ^^^ expected enum `Option`, found `i32` | ^^^ expected `Option<i32>`, found `i32`
| |
= note: expected enum `Option<i32>` = note: expected enum `Option<i32>`
found type `i32` found type `i32`
@ -194,7 +194,7 @@ error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:80:16 --> $DIR/compatible-variants.rs:80:16
| |
LL | let a: A = B::Fst; LL | let a: A = B::Fst;
| - ^^^^^^ expected enum `A`, found enum `B` | - ^^^^^^ expected `A`, found `B`
| | | |
| expected due to this | expected due to this
| |
@ -207,7 +207,7 @@ error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:86:17 --> $DIR/compatible-variants.rs:86:17
| |
LL | let a: A2 = B::Fst; LL | let a: A2 = B::Fst;
| -- ^^^^^^ expected struct `A2`, found enum `B` | -- ^^^^^^ expected `A2`, found `B`
| | | |
| expected due to this | expected due to this
| |

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-42764.rs:11:43 --> $DIR/issue-42764.rs:11:43
| |
LL | this_function_expects_a_double_option(n); LL | this_function_expects_a_double_option(n);
| ------------------------------------- ^ expected enum `DoubleOption`, found `usize` | ------------------------------------- ^ expected `DoubleOption<_>`, found `usize`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
@ -24,7 +24,7 @@ error[E0308]: mismatched types
--> $DIR/issue-42764.rs:27:33 --> $DIR/issue-42764.rs:27:33
| |
LL | let _c = Context { wrapper: Payload{} }; LL | let _c = Context { wrapper: Payload{} };
| ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload` | ^^^^^^^^^ expected `Wrapper`, found `Payload`
| |
help: try wrapping the expression in `Wrapper` help: try wrapping the expression in `Wrapper`
| |

View file

@ -10,7 +10,7 @@ error[E0308]: mismatched types
--> $DIR/recursion_limit_deref.rs:51:22 --> $DIR/recursion_limit_deref.rs:51:22
| |
LL | let x: &Bottom = &t; LL | let x: &Bottom = &t;
| ------- ^^ expected struct `Bottom`, found struct `Top` | ------- ^^ expected `&Bottom`, found `&Top`
| | | |
| expected due to this | expected due to this
| |

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/disambiguate-identical-names.rs:13:10 --> $DIR/disambiguate-identical-names.rs:13:10
| |
LL | test(&v); LL | test(&v);
| ---- ^^ expected struct `Vec`, found struct `HashMap` | ---- ^^ expected `&Vec<Vec<u32>>`, found `&HashMap<u8, u8>`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/dst-bad-coerce1.rs:16:29 --> $DIR/dst-bad-coerce1.rs:16:29
| |
LL | let f3: &Fat<[usize]> = f2; LL | let f3: &Fat<[usize]> = f2;
| ------------- ^^ expected slice `[usize]`, found array `[isize; 3]` | ------------- ^^ expected `&Fat<[usize]>`, found `&Fat<[isize; 3]>`
| | | |
| expected due to this | expected due to this
| |
@ -21,7 +21,7 @@ error[E0308]: mismatched types
--> $DIR/dst-bad-coerce1.rs:28:27 --> $DIR/dst-bad-coerce1.rs:28:27
| |
LL | let f3: &([usize],) = f2; LL | let f3: &([usize],) = f2;
| ----------- ^^ expected slice `[usize]`, found array `[isize; 3]` | ----------- ^^ expected `&([usize],)`, found `&([isize; 3],)`
| | | |
| expected due to this | expected due to this
| |

View file

@ -11,7 +11,7 @@ pub fn main() {
let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] }; let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] };
let f2: &Fat<[isize; 3]> = f1; let f2: &Fat<[isize; 3]> = f1;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected array `[isize; 3]`, found slice `[isize]` //~| expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>`
//~| expected reference `&Fat<[isize; 3]>` //~| expected reference `&Fat<[isize; 3]>`
//~| found reference `&Fat<[isize]>` //~| found reference `&Fat<[isize]>`
@ -19,7 +19,7 @@ pub fn main() {
let f1: &([isize],) = &([1, 2, 3],); let f1: &([isize],) = &([1, 2, 3],);
let f2: &([isize; 3],) = f1; let f2: &([isize; 3],) = f1;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected array `[isize; 3]`, found slice `[isize]` //~| expected `&([isize; 3],)`, found `&([isize],)`
//~| expected reference `&([isize; 3],)` //~| expected reference `&([isize; 3],)`
//~| found reference `&([isize],)` //~| found reference `&([isize],)`
} }

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/dst-bad-coerce4.rs:12:32 --> $DIR/dst-bad-coerce4.rs:12:32
| |
LL | let f2: &Fat<[isize; 3]> = f1; 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 | expected due to this
| |
@ -13,7 +13,7 @@ error[E0308]: mismatched types
--> $DIR/dst-bad-coerce4.rs:20:30 --> $DIR/dst-bad-coerce4.rs:20:30
| |
LL | let f2: &([isize; 3],) = f1; LL | let f2: &([isize; 3],) = f1;
| -------------- ^^ expected array `[isize; 3]`, found slice `[isize]` | -------------- ^^ expected `&([isize; 3],)`, found `&([isize],)`
| | | |
| expected due to this | expected due to this
| |

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/no-implicit-dyn-star.rs:6:48 --> $DIR/no-implicit-dyn-star.rs:6:48
| |
LL | dyn_star_foreign::require_dyn_star_display(1usize); 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 | arguments to this function are incorrect
| |

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | let empty_struct::XEmpty2 = (); LL | let empty_struct::XEmpty2 = ();
| ^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()` | ^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()`
| | | |
| expected `()`, found struct `XEmpty2` | expected `()`, found `XEmpty2`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/issue-37026.rs:7:9 --> $DIR/issue-37026.rs:7:9
@ -12,7 +12,7 @@ error[E0308]: mismatched types
LL | let empty_struct::XEmpty6(..) = (); LL | let empty_struct::XEmpty6(..) = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()` | ^^^^^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()`
| | | |
| expected `()`, found struct `XEmpty6` | expected `()`, found `XEmpty6`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -3,5 +3,5 @@ type FooAlias = Foo;
fn main() { fn main() {
let u = FooAlias { value: 0 }; 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]
} }

View file

@ -1,4 +1,4 @@
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 --> $DIR/E0071.rs:5:13
| |
LL | let u = FooAlias { value: 0 }; LL | let u = FooAlias { value: 0 };

View file

@ -9,7 +9,7 @@ LL | type B;
LL | fn foo(r: &A) -> &B { LL | fn foo(r: &A) -> &B {
| -- expected `&B` because of return type | -- expected `&B` because of return type
LL | r LL | r
| ^ expected extern type `B`, found extern type `A` | ^ expected `&B`, found `&A`
| |
= note: expected reference `&B` = note: expected reference `&B`
found reference `&A` found reference `&A`

View file

@ -302,7 +302,7 @@ error[E0308]: mismatched types
LL | println!("{} {:.*} {}", 1, 3.2, 4); LL | println!("{} {:.*} {}", 1, 3.2, 4);
| ^^^ | ^^^
| | | |
| expected `usize`, found floating-point number | expected `&usize`, found `&{float}`
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected reference `&usize` = note: expected reference `&usize`
@ -317,7 +317,7 @@ error[E0308]: mismatched types
LL | println!("{} {:07$.*} {}", 1, 3.2, 4); LL | println!("{} {:07$.*} {}", 1, 3.2, 4);
| ^^^ | ^^^
| | | |
| expected `usize`, found floating-point number | expected `&usize`, found `&{float}`
| arguments to this function are incorrect | arguments to this function are incorrect
| |
= note: expected reference `&usize` = note: expected reference `&usize`

View file

@ -34,8 +34,7 @@ fn main() {
eq(bar::<String>, bar::<Vec<u8>>); eq(bar::<String>, bar::<Vec<u8>>);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| found fn item `fn(_) -> _ {bar::<Vec<u8>>}` //~| found fn item `fn(_) -> _ {bar::<Vec<u8>>}`
//~| expected struct `String`, found struct `Vec` //~| expected `String`, found `Vec<u8>`
//~| different fn items have unique types, even if their signatures are the same
// Make sure we distinguish between trait methods correctly. // Make sure we distinguish between trait methods correctly.
eq(<u8 as Foo>::foo, <u16 as Foo>::foo); eq(<u8 as Foo>::foo, <u16 as Foo>::foo);

View file

@ -38,7 +38,7 @@ error[E0308]: mismatched types
--> $DIR/fn-item-type.rs:34:23 --> $DIR/fn-item-type.rs:34:23
| |
LL | eq(bar::<String>, bar::<Vec<u8>>); LL | eq(bar::<String>, bar::<Vec<u8>>);
| -- ^^^^^^^^^^^^^^ expected struct `String`, found struct `Vec` | -- ^^^^^^^^^^^^^^ expected `String`, found `Vec<u8>`
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |
@ -53,7 +53,7 @@ LL | fn eq<T>(x: T, y: T) {}
= help: consider casting both fn items to fn pointers using `as fn(isize) -> isize` = help: consider casting both fn items to fn pointers using `as fn(isize) -> isize`
error[E0308]: mismatched types 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); LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
| -- ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16` | -- ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
@ -71,7 +71,7 @@ LL | fn eq<T>(x: T, y: T) {}
= help: consider casting both fn items to fn pointers using `as fn()` = help: consider casting both fn items to fn pointers using `as fn()`
error[E0308]: mismatched types 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); LL | eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found fn pointer | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found fn pointer

View file

@ -2,7 +2,7 @@ error[E0308]: `if` and `else` have incompatible types
--> $DIR/fn-pointer-mismatch.rs:11:43 --> $DIR/fn-pointer-mismatch.rs:11:43
| |
LL | let g = if n % 2 == 0 { &foo } else { &bar }; 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 | expected because of this
| |
@ -45,7 +45,7 @@ error[E0308]: mismatched types
LL | let c: fn(u32) -> u32 = &foo; 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` | | help: consider removing the reference: `foo`
| expected due to this | expected due to this
| |
@ -71,7 +71,7 @@ error[E0308]: mismatched types
LL | let e: &fn(u32) -> u32 = &foo; 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)` | | help: consider casting to a fn pointer: `&(foo as fn(u32) -> u32)`
| expected due to this | expected due to this
| |

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:6:17 --> $DIR/fn-trait-formatting.rs:6:17
| |
LL | let _: () = Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>; LL | let _: () = Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box` | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box<dyn FnOnce(isize)>`
| | | |
| expected due to this | expected due to this
| |
@ -17,7 +17,7 @@ error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:10:17 --> $DIR/fn-trait-formatting.rs:10:17
| |
LL | let _: () = Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>; 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 | expected due to this
| |
@ -32,7 +32,7 @@ error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:14:17 --> $DIR/fn-trait-formatting.rs:14:17
| |
LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>; 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 | expected due to this
| |

View file

@ -9,7 +9,7 @@ fn needs_ptr(_: fn(i32, u32)) {}
fn main() { fn main() {
needs_ptr(foo); needs_ptr(foo);
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| NOTE expected `u32`, found `i32` //~| NOTE expected fn pointer, found fn item
//~| NOTE expected fn pointer `fn(i32, u32)` //~| NOTE expected fn pointer `fn(i32, u32)`
//~| NOTE arguments to this function are incorrect //~| NOTE arguments to this function are incorrect
} }

View file

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/signature-error-reporting-under-verbose.rs:10:15 --> $DIR/signature-error-reporting-under-verbose.rs:10:15
| |
LL | needs_ptr(foo); LL | needs_ptr(foo);
| --------- ^^^ expected `u32`, found `i32` | --------- ^^^ expected fn pointer, found fn item
| | | |
| arguments to this function are incorrect | arguments to this function are incorrect
| |

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