Auto merge of #106399 - estebank:type-err-span-label, r=nagisa
Modify primary span label for E0308 Looking at the reactions to https://hachyderm.io/`@ekuber/109622160673605438,` a lot of people seem to have trouble understanding the current output, where the primary span label on type errors talks about the specific types that diverged, but these can be deeply nested type parameters. Because of that we could see "expected i32, found u32" in the label while the note said "expected Vec<i32>, found Vec<u32>". This understandably confuses people. I believe that once people learn to read these errors it starts to make more sense, but this PR changes the output to be more in line with what people might expect, without sacrificing terseness. Fix #68220.
This commit is contained in:
commit
f361413cbf
@ -442,6 +442,7 @@ fn check_opaque_meets_bounds<'tcx>(
|
||||
match ocx.eq(&misc_cause, param_env, opaque_ty, hidden_ty) {
|
||||
Ok(()) => {}
|
||||
Err(ty_err) => {
|
||||
let ty_err = ty_err.to_string(tcx);
|
||||
tcx.sess.delay_span_bug(
|
||||
span,
|
||||
&format!("could not unify `{hidden_ty}` with revealed type:\n{ty_err}"),
|
||||
|
@ -259,7 +259,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let mode = no_match_data.mode;
|
||||
let tcx = self.tcx;
|
||||
let rcvr_ty = self.resolve_vars_if_possible(rcvr_ty);
|
||||
let ty_str = with_forced_trimmed_paths!(self.ty_to_string(rcvr_ty));
|
||||
let (ty_str, ty_file) = tcx.short_ty_string(rcvr_ty);
|
||||
let short_ty_str = with_forced_trimmed_paths!(rcvr_ty.to_string());
|
||||
let is_method = mode == Mode::MethodCall;
|
||||
let unsatisfied_predicates = &no_match_data.unsatisfied_predicates;
|
||||
let similar_candidate = no_match_data.similar_candidate;
|
||||
@ -276,11 +277,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
};
|
||||
|
||||
if self.suggest_wrapping_range_with_parens(tcx, rcvr_ty, source, span, item_name, &ty_str)
|
||||
|| self.suggest_constraining_numerical_ty(
|
||||
tcx, rcvr_ty, source, span, item_kind, item_name, &ty_str,
|
||||
)
|
||||
{
|
||||
// We could pass the file for long types into these two, but it isn't strictly necessary
|
||||
// given how targetted they are.
|
||||
if self.suggest_wrapping_range_with_parens(
|
||||
tcx,
|
||||
rcvr_ty,
|
||||
source,
|
||||
span,
|
||||
item_name,
|
||||
&short_ty_str,
|
||||
) || self.suggest_constraining_numerical_ty(
|
||||
tcx,
|
||||
rcvr_ty,
|
||||
source,
|
||||
span,
|
||||
item_kind,
|
||||
item_name,
|
||||
&short_ty_str,
|
||||
) {
|
||||
return None;
|
||||
}
|
||||
span = item_name.span;
|
||||
@ -319,6 +333,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
rcvr_ty.prefix_string(self.tcx),
|
||||
ty_str_reported,
|
||||
);
|
||||
let ty_str = if short_ty_str.len() < ty_str.len() && ty_str.len() > 10 {
|
||||
short_ty_str
|
||||
} else {
|
||||
ty_str
|
||||
};
|
||||
if let Some(file) = ty_file {
|
||||
err.note(&format!("the full type name has been written to '{}'", file.display(),));
|
||||
}
|
||||
if rcvr_ty.references_error() {
|
||||
err.downgrade_to_delayed_bug();
|
||||
}
|
||||
@ -826,7 +848,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let primary_message = primary_message.unwrap_or_else(|| {
|
||||
format!(
|
||||
"the {item_kind} `{item_name}` exists for {actual_prefix} `{ty_str}`, \
|
||||
but its trait bounds were not satisfied"
|
||||
but its trait bounds were not satisfied"
|
||||
)
|
||||
});
|
||||
err.set_primary_message(&primary_message);
|
||||
|
@ -67,6 +67,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_hir::Node;
|
||||
use rustc_middle::dep_graph::DepContext;
|
||||
use rustc_middle::ty::print::with_forced_trimmed_paths;
|
||||
use rustc_middle::ty::relate::{self, RelateResult, TypeRelation};
|
||||
use rustc_middle::ty::{
|
||||
self, error::TypeError, List, Region, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable,
|
||||
@ -1612,16 +1613,31 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
{
|
||||
format!("expected this to be `{}`", expected)
|
||||
} else {
|
||||
terr.to_string()
|
||||
terr.to_string(self.tcx).to_string()
|
||||
};
|
||||
label_or_note(sp, &terr);
|
||||
label_or_note(span, &msg);
|
||||
} else {
|
||||
label_or_note(span, &terr.to_string());
|
||||
label_or_note(span, &terr.to_string(self.tcx));
|
||||
label_or_note(sp, &msg);
|
||||
}
|
||||
} else {
|
||||
label_or_note(span, &terr.to_string());
|
||||
if let Some(values) = values
|
||||
&& let Some((e, f)) = values.ty()
|
||||
&& let TypeError::ArgumentSorts(..) | TypeError::Sorts(_) = terr
|
||||
{
|
||||
let e = self.tcx.erase_regions(e);
|
||||
let f = self.tcx.erase_regions(f);
|
||||
let expected = with_forced_trimmed_paths!(e.sort_string(self.tcx));
|
||||
let found = with_forced_trimmed_paths!(f.sort_string(self.tcx));
|
||||
if expected == found {
|
||||
label_or_note(span, &terr.to_string(self.tcx));
|
||||
} else {
|
||||
label_or_note(span, &format!("expected {expected}, found {found}"));
|
||||
}
|
||||
} else {
|
||||
label_or_note(span, &terr.to_string(self.tcx));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((expected, found, exp_p, found_p)) = expected_found {
|
||||
@ -1849,6 +1865,18 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
self.check_and_note_conflicting_crates(diag, terr);
|
||||
|
||||
self.note_and_explain_type_err(diag, terr, cause, span, cause.body_id.to_def_id());
|
||||
if let Some(exp_found) = exp_found
|
||||
&& let exp_found = TypeError::Sorts(exp_found)
|
||||
&& exp_found != terr
|
||||
{
|
||||
self.note_and_explain_type_err(
|
||||
diag,
|
||||
exp_found,
|
||||
cause,
|
||||
span,
|
||||
cause.body_id.to_def_id(),
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(ValuePairs::PolyTraitRefs(exp_found)) = values
|
||||
&& let ty::Closure(def_id, _) = exp_found.expected.skip_binder().self_ty().kind()
|
||||
|
@ -137,25 +137,25 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
diag.help(
|
||||
"given a type parameter `T` and a method `foo`:
|
||||
```
|
||||
trait Trait<T> { fn foo(&tcx) -> T; }
|
||||
trait Trait<T> { fn foo(&self) -> T; }
|
||||
```
|
||||
the only ways to implement method `foo` are:
|
||||
- constrain `T` with an explicit type:
|
||||
```
|
||||
impl Trait<String> for X {
|
||||
fn foo(&tcx) -> String { String::new() }
|
||||
fn foo(&self) -> String { String::new() }
|
||||
}
|
||||
```
|
||||
- add a trait bound to `T` and call a method on that trait that returns `Self`:
|
||||
```
|
||||
impl<T: std::default::Default> Trait<T> for X {
|
||||
fn foo(&tcx) -> T { <T as std::default::Default>::default() }
|
||||
fn foo(&self) -> T { <T as std::default::Default>::default() }
|
||||
}
|
||||
```
|
||||
- change `foo` to return an argument of type `T`:
|
||||
```
|
||||
impl<T> Trait<T> for X {
|
||||
fn foo(&tcx, x: T) -> T { x }
|
||||
fn foo(&self, x: T) -> T { x }
|
||||
}
|
||||
```",
|
||||
);
|
||||
@ -218,6 +218,13 @@ impl<T> Trait<T> for X {
|
||||
);
|
||||
}
|
||||
}
|
||||
(ty::FnPtr(_), ty::FnDef(def, _))
|
||||
if let hir::def::DefKind::Fn = tcx.def_kind(def) => {
|
||||
diag.note(
|
||||
"when the arguments and return types match, functions can be coerced \
|
||||
to function pointers",
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
debug!(
|
||||
@ -389,14 +396,14 @@ impl<T> Trait<T> for X {
|
||||
```
|
||||
trait Trait {
|
||||
type T;
|
||||
fn foo(&tcx) -> Self::T;
|
||||
fn foo(&self) -> Self::T;
|
||||
}
|
||||
```
|
||||
the only way of implementing method `foo` is to constrain `T` with an explicit associated type:
|
||||
```
|
||||
impl Trait for X {
|
||||
type T = String;
|
||||
fn foo(&tcx) -> Self::T { String::new() }
|
||||
fn foo(&self) -> Self::T { String::new() }
|
||||
}
|
||||
```",
|
||||
);
|
||||
|
@ -404,7 +404,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
(msg, sug)
|
||||
}
|
||||
};
|
||||
diag.span_suggestion(span, msg, sug, Applicability::MaybeIncorrect);
|
||||
diag.span_suggestion_verbose(span, msg, sug, Applicability::MaybeIncorrect);
|
||||
}
|
||||
(ty::FnDef(did1, substs1), ty::FnDef(did2, substs2)) => {
|
||||
let expected_sig =
|
||||
|
@ -8,9 +8,7 @@ use rustc_span::symbol::Symbol;
|
||||
use rustc_target::spec::abi;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::fmt;
|
||||
use std::hash::Hash;
|
||||
use std::hash::Hasher;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, TypeFoldable, TypeVisitable, Lift)]
|
||||
@ -30,7 +28,7 @@ impl<T> ExpectedFound<T> {
|
||||
}
|
||||
|
||||
// Data structures used in type unification
|
||||
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable, Lift)]
|
||||
#[derive(Copy, Clone, Debug, TypeFoldable, TypeVisitable, Lift, PartialEq, Eq)]
|
||||
#[rustc_pass_by_value]
|
||||
pub enum TypeError<'tcx> {
|
||||
Mismatch,
|
||||
@ -87,20 +85,16 @@ impl TypeError<'_> {
|
||||
/// in parentheses after some larger message. You should also invoke `note_and_explain_type_err()`
|
||||
/// afterwards to present additional details, particularly when it comes to lifetime-related
|
||||
/// errors.
|
||||
impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
impl<'tcx> TypeError<'tcx> {
|
||||
pub fn to_string(self, tcx: TyCtxt<'tcx>) -> Cow<'static, str> {
|
||||
use self::TypeError::*;
|
||||
fn report_maybe_different(
|
||||
f: &mut fmt::Formatter<'_>,
|
||||
expected: &str,
|
||||
found: &str,
|
||||
) -> fmt::Result {
|
||||
fn report_maybe_different(expected: &str, found: &str) -> String {
|
||||
// A naive approach to making sure that we're not reporting silly errors such as:
|
||||
// (expected closure, found closure).
|
||||
if expected == found {
|
||||
write!(f, "expected {}, found a different {}", expected, found)
|
||||
format!("expected {}, found a different {}", expected, found)
|
||||
} else {
|
||||
write!(f, "expected {}, found {}", expected, found)
|
||||
format!("expected {}, found {}", expected, found)
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,64 +103,63 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||
_ => String::new(),
|
||||
};
|
||||
|
||||
match *self {
|
||||
CyclicTy(_) => write!(f, "cyclic type of infinite size"),
|
||||
CyclicConst(_) => write!(f, "encountered a self-referencing constant"),
|
||||
Mismatch => write!(f, "types differ"),
|
||||
match self {
|
||||
CyclicTy(_) => "cyclic type of infinite size".into(),
|
||||
CyclicConst(_) => "encountered a self-referencing constant".into(),
|
||||
Mismatch => "types differ".into(),
|
||||
ConstnessMismatch(values) => {
|
||||
write!(f, "expected {} bound, found {} bound", values.expected, values.found)
|
||||
format!("expected {} bound, found {} bound", values.expected, values.found).into()
|
||||
}
|
||||
PolarityMismatch(values) => {
|
||||
write!(f, "expected {} polarity, found {} polarity", values.expected, values.found)
|
||||
format!("expected {} polarity, found {} polarity", values.expected, values.found)
|
||||
.into()
|
||||
}
|
||||
UnsafetyMismatch(values) => {
|
||||
write!(f, "expected {} fn, found {} fn", values.expected, values.found)
|
||||
format!("expected {} fn, found {} fn", values.expected, values.found).into()
|
||||
}
|
||||
AbiMismatch(values) => {
|
||||
write!(f, "expected {} fn, found {} fn", values.expected, values.found)
|
||||
format!("expected {} fn, found {} fn", values.expected, values.found).into()
|
||||
}
|
||||
ArgumentMutability(_) | Mutability => write!(f, "types differ in mutability"),
|
||||
TupleSize(values) => write!(
|
||||
f,
|
||||
ArgumentMutability(_) | Mutability => "types differ in mutability".into(),
|
||||
TupleSize(values) => format!(
|
||||
"expected a tuple with {} element{}, found one with {} element{}",
|
||||
values.expected,
|
||||
pluralize!(values.expected),
|
||||
values.found,
|
||||
pluralize!(values.found)
|
||||
),
|
||||
FixedArraySize(values) => write!(
|
||||
f,
|
||||
)
|
||||
.into(),
|
||||
FixedArraySize(values) => format!(
|
||||
"expected an array with a fixed size of {} element{}, found one with {} element{}",
|
||||
values.expected,
|
||||
pluralize!(values.expected),
|
||||
values.found,
|
||||
pluralize!(values.found)
|
||||
),
|
||||
ArgCount => write!(f, "incorrect number of function parameters"),
|
||||
FieldMisMatch(adt, field) => write!(f, "field type mismatch: {}.{}", adt, field),
|
||||
RegionsDoesNotOutlive(..) => write!(f, "lifetime mismatch"),
|
||||
)
|
||||
.into(),
|
||||
ArgCount => "incorrect number of function parameters".into(),
|
||||
FieldMisMatch(adt, field) => format!("field type mismatch: {}.{}", adt, field).into(),
|
||||
RegionsDoesNotOutlive(..) => "lifetime mismatch".into(),
|
||||
// Actually naming the region here is a bit confusing because context is lacking
|
||||
RegionsInsufficientlyPolymorphic(..) => {
|
||||
write!(f, "one type is more general than the other")
|
||||
"one type is more general than the other".into()
|
||||
}
|
||||
RegionsOverlyPolymorphic(br, _) => write!(
|
||||
f,
|
||||
RegionsOverlyPolymorphic(br, _) => format!(
|
||||
"expected concrete lifetime, found bound lifetime parameter{}",
|
||||
br_string(br)
|
||||
),
|
||||
RegionsPlaceholderMismatch => write!(f, "one type is more general than the other"),
|
||||
ArgumentSorts(values, _) | Sorts(values) => ty::tls::with(|tcx| {
|
||||
let (mut expected, mut found) = with_forced_trimmed_paths!((
|
||||
values.expected.sort_string(tcx),
|
||||
values.found.sort_string(tcx),
|
||||
));
|
||||
)
|
||||
.into(),
|
||||
RegionsPlaceholderMismatch => "one type is more general than the other".into(),
|
||||
ArgumentSorts(values, _) | Sorts(values) => {
|
||||
let mut expected = values.expected.sort_string(tcx);
|
||||
let mut found = values.found.sort_string(tcx);
|
||||
if expected == found {
|
||||
expected = values.expected.sort_string(tcx);
|
||||
found = values.found.sort_string(tcx);
|
||||
}
|
||||
report_maybe_different(f, &expected, &found)
|
||||
}),
|
||||
Traits(values) => ty::tls::with(|tcx| {
|
||||
report_maybe_different(&expected, &found).into()
|
||||
}
|
||||
Traits(values) => {
|
||||
let (mut expected, mut found) = with_forced_trimmed_paths!((
|
||||
tcx.def_path_str(values.expected),
|
||||
tcx.def_path_str(values.found),
|
||||
@ -175,12 +168,9 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||
expected = tcx.def_path_str(values.expected);
|
||||
found = tcx.def_path_str(values.found);
|
||||
}
|
||||
report_maybe_different(
|
||||
f,
|
||||
&format!("trait `{expected}`"),
|
||||
&format!("trait `{found}`"),
|
||||
)
|
||||
}),
|
||||
report_maybe_different(&format!("trait `{expected}`"), &format!("trait `{found}`"))
|
||||
.into()
|
||||
}
|
||||
IntMismatch(ref values) => {
|
||||
let expected = match values.expected {
|
||||
ty::IntVarValue::IntType(ty) => ty.name_str(),
|
||||
@ -190,43 +180,38 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||
ty::IntVarValue::IntType(ty) => ty.name_str(),
|
||||
ty::IntVarValue::UintType(ty) => ty.name_str(),
|
||||
};
|
||||
write!(f, "expected `{}`, found `{}`", expected, found)
|
||||
format!("expected `{}`, found `{}`", expected, found).into()
|
||||
}
|
||||
FloatMismatch(ref values) => {
|
||||
write!(
|
||||
f,
|
||||
"expected `{}`, found `{}`",
|
||||
values.expected.name_str(),
|
||||
values.found.name_str()
|
||||
)
|
||||
}
|
||||
VariadicMismatch(ref values) => write!(
|
||||
f,
|
||||
FloatMismatch(ref values) => format!(
|
||||
"expected `{}`, found `{}`",
|
||||
values.expected.name_str(),
|
||||
values.found.name_str()
|
||||
)
|
||||
.into(),
|
||||
VariadicMismatch(ref values) => format!(
|
||||
"expected {} fn, found {} function",
|
||||
if values.expected { "variadic" } else { "non-variadic" },
|
||||
if values.found { "variadic" } else { "non-variadic" }
|
||||
),
|
||||
ProjectionMismatched(ref values) => ty::tls::with(|tcx| {
|
||||
write!(
|
||||
f,
|
||||
"expected {}, found {}",
|
||||
tcx.def_path_str(values.expected),
|
||||
tcx.def_path_str(values.found)
|
||||
)
|
||||
}),
|
||||
)
|
||||
.into(),
|
||||
ProjectionMismatched(ref values) => format!(
|
||||
"expected `{}`, found `{}`",
|
||||
tcx.def_path_str(values.expected),
|
||||
tcx.def_path_str(values.found)
|
||||
)
|
||||
.into(),
|
||||
ExistentialMismatch(ref values) => report_maybe_different(
|
||||
f,
|
||||
&format!("trait `{}`", values.expected),
|
||||
&format!("trait `{}`", values.found),
|
||||
),
|
||||
)
|
||||
.into(),
|
||||
ConstMismatch(ref values) => {
|
||||
write!(f, "expected `{}`, found `{}`", values.expected, values.found)
|
||||
format!("expected `{}`, found `{}`", values.expected, values.found).into()
|
||||
}
|
||||
IntrinsicCast => "cannot coerce intrinsics to function pointers".into(),
|
||||
TargetFeatureCast(_) => {
|
||||
"cannot coerce functions with `#[target_feature]` to safe function pointers".into()
|
||||
}
|
||||
IntrinsicCast => write!(f, "cannot coerce intrinsics to function pointers"),
|
||||
TargetFeatureCast(_) => write!(
|
||||
f,
|
||||
"cannot coerce functions with `#[target_feature]` to safe function pointers"
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -259,60 +244,9 @@ impl<'tcx> TypeError<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> Ty<'tcx> {
|
||||
pub fn sort_string(self, tcx: TyCtxt<'_>) -> Cow<'static, str> {
|
||||
pub fn sort_string(self, tcx: TyCtxt<'tcx>) -> Cow<'static, str> {
|
||||
match *self.kind() {
|
||||
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => {
|
||||
format!("`{}`", self).into()
|
||||
}
|
||||
ty::Tuple(ref tys) if tys.is_empty() => format!("`{}`", self).into(),
|
||||
|
||||
ty::Adt(def, _) => format!("{} `{}`", def.descr(), tcx.def_path_str(def.did())).into(),
|
||||
ty::Foreign(def_id) => format!("extern type `{}`", tcx.def_path_str(def_id)).into(),
|
||||
ty::Array(t, n) => {
|
||||
if t.is_simple_ty() {
|
||||
return format!("array `{}`", self).into();
|
||||
}
|
||||
|
||||
let n = tcx.lift(n).unwrap();
|
||||
if let ty::ConstKind::Value(v) = n.kind() {
|
||||
if let Some(n) = v.try_to_machine_usize(tcx) {
|
||||
return format!("array of {} element{}", n, pluralize!(n)).into();
|
||||
}
|
||||
}
|
||||
"array".into()
|
||||
}
|
||||
ty::Slice(ty) if ty.is_simple_ty() => format!("slice `{}`", self).into(),
|
||||
ty::Slice(_) => "slice".into(),
|
||||
ty::RawPtr(tymut) => {
|
||||
let tymut_string = match tymut.mutbl {
|
||||
hir::Mutability::Mut => tymut.to_string(),
|
||||
hir::Mutability::Not => format!("const {}", tymut.ty),
|
||||
};
|
||||
|
||||
if tymut_string != "_" && (tymut.ty.is_simple_text() || tymut_string.len() < "const raw pointer".len()) {
|
||||
format!("`*{}`", tymut_string).into()
|
||||
} else {
|
||||
// Unknown type name, it's long or has type arguments
|
||||
"raw pointer".into()
|
||||
}
|
||||
},
|
||||
ty::Ref(_, ty, mutbl) => {
|
||||
let tymut = ty::TypeAndMut { ty, mutbl };
|
||||
let tymut_string = tymut.to_string();
|
||||
|
||||
if tymut_string != "_"
|
||||
&& (ty.is_simple_text() || tymut_string.len() < "mutable reference".len())
|
||||
{
|
||||
format!("`&{}`", tymut_string).into()
|
||||
} else {
|
||||
// Unknown type name, it's long or has type arguments
|
||||
match mutbl {
|
||||
hir::Mutability::Mut => "mutable reference",
|
||||
_ => "reference",
|
||||
}
|
||||
.into()
|
||||
}
|
||||
}
|
||||
ty::FnDef(def_id, ..) => match tcx.def_kind(def_id) {
|
||||
DefKind::Ctor(CtorOf::Struct, _) => "struct constructor".into(),
|
||||
DefKind::Ctor(CtorOf::Variant, _) => "enum constructor".into(),
|
||||
@ -320,14 +254,13 @@ impl<'tcx> Ty<'tcx> {
|
||||
},
|
||||
ty::FnPtr(_) => "fn pointer".into(),
|
||||
ty::Dynamic(ref inner, ..) if let Some(principal) = inner.principal() => {
|
||||
format!("trait object `dyn {}`", tcx.def_path_str(principal.def_id())).into()
|
||||
format!("`dyn {}`", tcx.def_path_str(principal.def_id())).into()
|
||||
}
|
||||
ty::Dynamic(..) => "trait object".into(),
|
||||
ty::Closure(..) => "closure".into(),
|
||||
ty::Generator(def_id, ..) => tcx.generator_kind(def_id).unwrap().descr().into(),
|
||||
ty::GeneratorWitness(..) |
|
||||
ty::GeneratorWitnessMIR(..) => "generator witness".into(),
|
||||
ty::Tuple(..) => "tuple".into(),
|
||||
ty::Infer(ty::TyVar(_)) => "inferred type".into(),
|
||||
ty::Infer(ty::IntVar(_)) => "integer".into(),
|
||||
ty::Infer(ty::FloatVar(_)) => "floating-point number".into(),
|
||||
@ -337,9 +270,14 @@ impl<'tcx> Ty<'tcx> {
|
||||
ty::Infer(ty::FreshIntTy(_)) => "fresh integral type".into(),
|
||||
ty::Infer(ty::FreshFloatTy(_)) => "fresh floating-point type".into(),
|
||||
ty::Alias(ty::Projection, _) => "associated type".into(),
|
||||
ty::Param(p) => format!("type parameter `{}`", p).into(),
|
||||
ty::Param(p) => format!("type parameter `{p}`").into(),
|
||||
ty::Alias(ty::Opaque, ..) => "opaque type".into(),
|
||||
ty::Error(_) => "type error".into(),
|
||||
_ => {
|
||||
let width = tcx.sess.diagnostic_width();
|
||||
let length_limit = std::cmp::max(width / 4, 15);
|
||||
format!("`{}`", tcx.ty_string_with_limit(self, length_limit)).into()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,16 +324,14 @@ impl<'tcx> Ty<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn short_ty_string(self, ty: Ty<'tcx>) -> (String, Option<PathBuf>) {
|
||||
let width = self.sess.diagnostic_width();
|
||||
let length_limit = width.saturating_sub(30);
|
||||
pub fn ty_string_with_limit(self, ty: Ty<'tcx>, length_limit: usize) -> String {
|
||||
let mut type_limit = 50;
|
||||
let regular = FmtPrinter::new(self, hir::def::Namespace::TypeNS)
|
||||
.pretty_print_type(ty)
|
||||
.expect("could not write to `String`")
|
||||
.into_buffer();
|
||||
if regular.len() <= width {
|
||||
return (regular, None);
|
||||
if regular.len() <= length_limit {
|
||||
return regular;
|
||||
}
|
||||
let mut short;
|
||||
loop {
|
||||
@ -415,6 +351,20 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
type_limit -= 1;
|
||||
}
|
||||
short
|
||||
}
|
||||
|
||||
pub fn short_ty_string(self, ty: Ty<'tcx>) -> (String, Option<PathBuf>) {
|
||||
let width = self.sess.diagnostic_width();
|
||||
let length_limit = width.saturating_sub(30);
|
||||
let regular = FmtPrinter::new(self, hir::def::Namespace::TypeNS)
|
||||
.pretty_print_type(ty)
|
||||
.expect("could not write to `String`")
|
||||
.into_buffer();
|
||||
if regular.len() <= width {
|
||||
return (regular, None);
|
||||
}
|
||||
let short = self.ty_string_with_limit(ty, length_limit);
|
||||
if regular == short {
|
||||
return (regular, None);
|
||||
}
|
||||
|
@ -1084,9 +1084,11 @@ pub trait PrettyPrinter<'tcx>:
|
||||
write!(self, "Sized")?;
|
||||
}
|
||||
|
||||
for re in lifetimes {
|
||||
write!(self, " + ")?;
|
||||
self = self.print_region(re)?;
|
||||
if !FORCE_TRIMMED_PATH.with(|flag| flag.get()) {
|
||||
for re in lifetimes {
|
||||
write!(self, " + ")?;
|
||||
self = self.print_region(re)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(self)
|
||||
@ -2070,6 +2072,10 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
|
||||
return true;
|
||||
}
|
||||
|
||||
if FORCE_TRIMMED_PATH.with(|flag| flag.get()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let identify_regions = self.tcx.sess.opts.unstable_opts.identify_regions;
|
||||
|
||||
match *region {
|
||||
@ -2346,6 +2352,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
|
||||
} else {
|
||||
let tcx = self.tcx;
|
||||
|
||||
let trim_path = FORCE_TRIMMED_PATH.with(|flag| flag.get());
|
||||
// Closure used in `RegionFolder` to create names for anonymous late-bound
|
||||
// regions. We use two `DebruijnIndex`es (one for the currently folded
|
||||
// late-bound region and the other for the binder level) to determine
|
||||
@ -2400,8 +2407,10 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
|
||||
}
|
||||
};
|
||||
|
||||
start_or_continue(&mut self, "for<", ", ");
|
||||
do_continue(&mut self, name);
|
||||
if !trim_path {
|
||||
start_or_continue(&mut self, "for<", ", ");
|
||||
do_continue(&mut self, name);
|
||||
}
|
||||
tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BoundRegion { var: br.var, kind }))
|
||||
};
|
||||
let mut folder = RegionFolder {
|
||||
@ -2412,7 +2421,9 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
|
||||
};
|
||||
let new_value = value.clone().skip_binder().fold_with(&mut folder);
|
||||
let region_map = folder.region_map;
|
||||
start_or_continue(&mut self, "", "> ");
|
||||
if !trim_path {
|
||||
start_or_continue(&mut self, "", "> ");
|
||||
}
|
||||
(new_value, region_map)
|
||||
};
|
||||
|
||||
|
@ -1866,10 +1866,14 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
|
||||
with_forced_trimmed_paths! {
|
||||
if Some(pred.projection_ty.def_id) == self.tcx.lang_items().fn_once_output() {
|
||||
let fn_kind = self_ty.prefix_string(self.tcx);
|
||||
let item = match self_ty.kind() {
|
||||
ty::FnDef(def, _) => self.tcx.item_name(*def).to_string(),
|
||||
_ => self_ty.to_string(),
|
||||
};
|
||||
Some(format!(
|
||||
"expected `{self_ty}` to be a {fn_kind} that returns `{expected_ty}`, but it \
|
||||
"expected `{item}` to be a {fn_kind} that returns `{expected_ty}`, but it \
|
||||
returns `{normalized_ty}`",
|
||||
fn_kind = self_ty.prefix_string(self.tcx)
|
||||
))
|
||||
} else if Some(trait_def_id) == self.tcx.lang_items().future_trait() {
|
||||
Some(format!(
|
||||
|
@ -2454,7 +2454,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
.at(&cause, obligation.param_env)
|
||||
.define_opaque_types(false)
|
||||
.eq(placeholder_obligation_trait_ref, impl_trait_ref)
|
||||
.map_err(|e| debug!("match_impl: failed eq_trait_refs due to `{e}`"))?;
|
||||
.map_err(|e| {
|
||||
debug!("match_impl: failed eq_trait_refs due to `{}`", e.to_string(self.tcx()))
|
||||
})?;
|
||||
nested_obligations.extend(obligations);
|
||||
|
||||
if !self.is_intercrate()
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/track-diagnostics.rs:LL:CC
|
||||
|
|
||||
LL | const S: A = B;
|
||||
| ^ expected struct `A`, found struct `B`
|
||||
| ^ expected `A`, found `B`
|
||||
-Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:LL:CC
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -11,7 +11,7 @@ all:
|
||||
tr -d '\r\n' | $(CGREP) -e \
|
||||
"mismatched types.*\
|
||||
crateB::try_foo\(foo2\);.*\
|
||||
expected struct \`crateA::foo::Foo\`, found struct \`Foo\`.*\
|
||||
expected \`crateA::foo::Foo\`, found \`Foo\`.*\
|
||||
different versions of crate \`crateA\`.*\
|
||||
mismatched types.*\
|
||||
crateB::try_bar\(bar2\);.*\
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/track-diagnostics.rs:LL:CC
|
||||
|
|
||||
LL | const S: A = B;
|
||||
| ^ expected struct `A`, found struct `B`
|
||||
| ^ expected `A`, found `B`
|
||||
-Ztrack-diagnostics: created at compiler/rustc_infer/src/infer/error_reporting/mod.rs:LL:CC
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -10,7 +10,7 @@ LL | || ) -> ()
|
||||
LL | | {
|
||||
LL | | loop {}
|
||||
LL | | }
|
||||
| |__^ expected `&Layout`, found struct `Layout`
|
||||
| |__^ expected `&Layout`, found `Layout`
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/alloc-error-handler-bad-signature-1.rs:10:4
|
||||
|
@ -9,12 +9,12 @@ LL | || ) {
|
||||
| ||_- arguments to this function are incorrect
|
||||
LL | | loop {}
|
||||
LL | | }
|
||||
| |__^ expected struct `Layout`, found struct `core::alloc::Layout`
|
||||
| |__^ expected `Layout`, found `core::alloc::Layout`
|
||||
|
|
||||
= note: struct `core::alloc::Layout` and struct `Layout` have similar names, but are actually distinct types
|
||||
note: struct `core::alloc::Layout` is defined in crate `core`
|
||||
= note: `core::alloc::Layout` and `Layout` have similar names, but are actually distinct types
|
||||
note: `core::alloc::Layout` is defined in crate `core`
|
||||
--> $SRC_DIR/core/src/alloc/layout.rs:LL:COL
|
||||
note: struct `Layout` is defined in the current crate
|
||||
note: `Layout` is defined in the current crate
|
||||
--> $DIR/alloc-error-handler-bad-signature-2.rs:7:1
|
||||
|
|
||||
LL | struct Layout;
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/formal-and-expected-differ.rs:22:29
|
||||
|
|
||||
LL | let _: U<_, u32> = U(1, S(3u32));
|
||||
| - ^^^^^^^ expected `f32`, found `u32`
|
||||
| - ^^^^^^^ expected `S<f32>`, found `S<u32>`
|
||||
| |
|
||||
| arguments to this struct are incorrect
|
||||
|
|
||||
@ -18,7 +18,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/formal-and-expected-differ.rs:22:24
|
||||
|
|
||||
LL | let _: U<_, u32> = U(1, S(3u32));
|
||||
| --------- ^^^^^^^^^^^^^ expected `u32`, found `f32`
|
||||
| --------- ^^^^^^^^^^^^^ expected `U<_, u32>`, found `U<i32, f32>`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -100,7 +100,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:24:18
|
||||
|
|
||||
LL | three_arg_diff(X{}, 1.0, "");
|
||||
| -------------- ^^^ expected `i32`, found struct `X`
|
||||
| -------------- ^^^ expected `i32`, found `X`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
@ -114,7 +114,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:25:21
|
||||
|
|
||||
LL | three_arg_diff(1, X {}, "");
|
||||
| -------------- ^^^^ expected `f32`, found struct `X`
|
||||
| -------------- ^^^^ expected `f32`, found `X`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
@ -128,7 +128,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:26:26
|
||||
|
|
||||
LL | three_arg_diff(1, 1.0, X {});
|
||||
| -------------- ^^^^ expected `&str`, found struct `X`
|
||||
| -------------- ^^^^ expected `&str`, found `X`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
@ -142,9 +142,9 @@ error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:28:3
|
||||
|
|
||||
LL | three_arg_diff(X {}, X {}, "");
|
||||
| ^^^^^^^^^^^^^^ ---- ---- expected `f32`, found struct `X`
|
||||
| ^^^^^^^^^^^^^^ ---- ---- expected `f32`, found `X`
|
||||
| |
|
||||
| expected `i32`, found struct `X`
|
||||
| expected `i32`, found `X`
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:8:4
|
||||
@ -156,9 +156,9 @@ error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:29:3
|
||||
|
|
||||
LL | three_arg_diff(X {}, 1.0, X {});
|
||||
| ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found struct `X`
|
||||
| ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found `X`
|
||||
| |
|
||||
| expected `i32`, found struct `X`
|
||||
| expected `i32`, found `X`
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:8:4
|
||||
@ -170,9 +170,9 @@ error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:30:3
|
||||
|
|
||||
LL | three_arg_diff(1, X {}, X {});
|
||||
| ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found struct `X`
|
||||
| ^^^^^^^^^^^^^^ ---- ---- expected `&str`, found `X`
|
||||
| |
|
||||
| expected `f32`, found struct `X`
|
||||
| expected `f32`, found `X`
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:8:4
|
||||
@ -184,10 +184,10 @@ error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:32:3
|
||||
|
|
||||
LL | three_arg_diff(X {}, X {}, X {});
|
||||
| ^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found struct `X`
|
||||
| ^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found `X`
|
||||
| | |
|
||||
| | expected `f32`, found struct `X`
|
||||
| expected `i32`, found struct `X`
|
||||
| | expected `f32`, found `X`
|
||||
| expected `i32`, found `X`
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:8:4
|
||||
@ -199,7 +199,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:34:20
|
||||
|
|
||||
LL | three_arg_repeat(X {}, 1, "");
|
||||
| ---------------- ^^^^ expected `i32`, found struct `X`
|
||||
| ---------------- ^^^^ expected `i32`, found `X`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
@ -213,7 +213,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:35:23
|
||||
|
|
||||
LL | three_arg_repeat(1, X {}, "");
|
||||
| ---------------- ^^^^ expected `i32`, found struct `X`
|
||||
| ---------------- ^^^^ expected `i32`, found `X`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
@ -227,7 +227,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:36:26
|
||||
|
|
||||
LL | three_arg_repeat(1, 1, X {});
|
||||
| ---------------- ^^^^ expected `&str`, found struct `X`
|
||||
| ---------------- ^^^^ expected `&str`, found `X`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
@ -241,9 +241,9 @@ error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:38:3
|
||||
|
|
||||
LL | three_arg_repeat(X {}, X {}, "");
|
||||
| ^^^^^^^^^^^^^^^^ ---- ---- expected `i32`, found struct `X`
|
||||
| ^^^^^^^^^^^^^^^^ ---- ---- expected `i32`, found `X`
|
||||
| |
|
||||
| expected `i32`, found struct `X`
|
||||
| expected `i32`, found `X`
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:9:4
|
||||
@ -255,9 +255,9 @@ error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:39:3
|
||||
|
|
||||
LL | three_arg_repeat(X {}, 1, X {});
|
||||
| ^^^^^^^^^^^^^^^^ ---- ---- expected `&str`, found struct `X`
|
||||
| ^^^^^^^^^^^^^^^^ ---- ---- expected `&str`, found `X`
|
||||
| |
|
||||
| expected `i32`, found struct `X`
|
||||
| expected `i32`, found `X`
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:9:4
|
||||
@ -269,9 +269,9 @@ error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:40:3
|
||||
|
|
||||
LL | three_arg_repeat(1, X {}, X{});
|
||||
| ^^^^^^^^^^^^^^^^ ---- --- expected `&str`, found struct `X`
|
||||
| ^^^^^^^^^^^^^^^^ ---- --- expected `&str`, found `X`
|
||||
| |
|
||||
| expected `i32`, found struct `X`
|
||||
| expected `i32`, found `X`
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:9:4
|
||||
@ -283,10 +283,10 @@ error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:42:3
|
||||
|
|
||||
LL | three_arg_repeat(X {}, X {}, X {});
|
||||
| ^^^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found struct `X`
|
||||
| ^^^^^^^^^^^^^^^^ ---- ---- ---- expected `&str`, found `X`
|
||||
| | |
|
||||
| | expected `i32`, found struct `X`
|
||||
| expected `i32`, found struct `X`
|
||||
| | expected `i32`, found `X`
|
||||
| expected `i32`, found `X`
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:9:4
|
||||
|
@ -41,7 +41,7 @@ error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/issue-100478.rs:36:5
|
||||
|
|
||||
LL | four_shuffle(T3::default(), T2::default(), T1::default(), T3::default());
|
||||
| ^^^^^^^^^^^^ ------------- ------------- ------------- expected struct `T4`, found struct `T3`
|
||||
| ^^^^^^^^^^^^ ------------- ------------- ------------- expected `T4`, found `T3`
|
||||
| | |
|
||||
| | expected `T3`, found `T1`
|
||||
| expected `T1`, found `T3`
|
||||
|
@ -128,7 +128,7 @@ LL | f(C, C, A, B, A, 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`
|
||||
|
|
||||
|
@ -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);
|
||||
| ^^^ - - - - argument of type `F` unexpected
|
||||
| | | |
|
||||
| | | expected `&E`, found struct `E`
|
||||
| | | expected `&E`, found `E`
|
||||
| | argument of type `C` unexpected
|
||||
| argument of type `B` unexpected
|
||||
|
|
||||
|
@ -41,7 +41,7 @@ error[E0061]: this function takes 3 arguments but 2 arguments were supplied
|
||||
LL | three_args(1, X {});
|
||||
| ^^^^^^^^^^---------
|
||||
| | |
|
||||
| | expected `f32`, found struct `X`
|
||||
| | expected `f32`, found `X`
|
||||
| an argument of type `&str` is missing
|
||||
|
|
||||
note: function defined here
|
||||
@ -78,7 +78,7 @@ error[E0308]: arguments to this function are incorrect
|
||||
LL | three_args("", X {}, 1);
|
||||
| ^^^^^^^^^^ -- ---- - expected `&str`, found `{integer}`
|
||||
| | |
|
||||
| | expected `f32`, found struct `X`
|
||||
| | expected `f32`, found `X`
|
||||
| expected `i32`, found `&'static str`
|
||||
|
|
||||
note: function defined here
|
||||
|
@ -4,14 +4,15 @@ error[E0308]: arguments to this function are incorrect
|
||||
LL | foo(f, w);
|
||||
| ^^^
|
||||
|
|
||||
note: expected `i32`, found `u32`
|
||||
note: expected fn pointer, found fn item
|
||||
--> $DIR/two-mismatch-notes.rs:10:9
|
||||
|
|
||||
LL | foo(f, w);
|
||||
| ^
|
||||
= note: expected fn pointer `fn(i32)`
|
||||
found fn item `fn(u32) {f}`
|
||||
note: expected `i32`, found `isize`
|
||||
= note: when the arguments and return types match, functions can be coerced to function pointers
|
||||
note: expected `Wrapper<i32>`, found `Wrapper<isize>`
|
||||
--> $DIR/two-mismatch-notes.rs:10:12
|
||||
|
|
||||
LL | foo(f, w);
|
||||
|
@ -1,12 +1,12 @@
|
||||
fn main() {
|
||||
let _x: i32 = [1, 2, 3];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `i32`, found array
|
||||
//~| expected `i32`, found `[{integer}; 3]`
|
||||
|
||||
let x: &[i32] = &[1, 2, 3];
|
||||
let _y: &i32 = x;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected reference `&i32`
|
||||
//~| found reference `&[i32]`
|
||||
//~| expected `i32`, found slice
|
||||
//~| expected `&i32`, found `&[i32]`
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/array-not-vector.rs:2:19
|
||||
|
|
||||
LL | let _x: i32 = [1, 2, 3];
|
||||
| --- ^^^^^^^^^ expected `i32`, found array `[{integer}; 3]`
|
||||
| --- ^^^^^^^^^ expected `i32`, found `[{integer}; 3]`
|
||||
| |
|
||||
| expected due to this
|
||||
|
||||
@ -10,7 +10,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/array-not-vector.rs:7:20
|
||||
|
|
||||
LL | let _y: &i32 = x;
|
||||
| ---- ^ expected `i32`, found slice `[i32]`
|
||||
| ---- ^ expected `&i32`, found `&[i32]`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/slice-to-vec-comparison.rs:4:9
|
||||
|
|
||||
LL | a > b;
|
||||
| ^ expected array of 0 elements, found struct `Vec`
|
||||
| ^ expected `&[_; 0]`, found `&Vec<u8>`
|
||||
|
|
||||
= note: expected reference `&[_; 0]`
|
||||
found reference `&Vec<u8>`
|
||||
|
@ -2,7 +2,7 @@ error[E0326]: implemented const `FROM` has an incompatible type for trait
|
||||
--> $DIR/associated-const-generic-obligations.rs:14:17
|
||||
|
|
||||
LL | const FROM: &'static str = "foo";
|
||||
| ^^^^^^^^^^^^ expected associated type, found `&str`
|
||||
| ^^^^^^^^^^^^ expected associated type, found `&'static str`
|
||||
|
|
||||
note: type in trait
|
||||
--> $DIR/associated-const-generic-obligations.rs:10:17
|
||||
|
@ -14,7 +14,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/elision.rs:5:79
|
||||
|
|
||||
LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()> { x.next() }
|
||||
| ----------------------------- -------------- ^^^^^^^^ expected `&()`, found type parameter `impl Iterator<Item = &'_ ()>`
|
||||
| ----------------------------- -------------- ^^^^^^^^ expected `Option<&()>`, found `Option<impl Iterator<Item = &'_ ()>>`
|
||||
| | |
|
||||
| | expected `Option<&'static ()>` because of return type
|
||||
| this type parameter
|
||||
|
@ -95,7 +95,7 @@ LL | union U1 { f: ManuallyDrop<dyn Iterator<Item: Copy>> }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `ManuallyDrop<(dyn Iterator<Item = impl Copy> + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator<Item = impl Copy> + 'static)`
|
||||
= note: required because it appears within the type `ManuallyDrop<(dyn Iterator<Item = impl Copy> + 'static)>`
|
||||
= note: required because it appears within the type `ManuallyDrop<dyn Iterator<Item = impl Copy>>`
|
||||
= note: no field of a union may have a dynamically sized type
|
||||
= help: change the field's type to have a statically known size
|
||||
help: borrowed types always have a statically known size
|
||||
@ -114,7 +114,7 @@ LL | union U3 { f: ManuallyDrop<dyn Iterator<Item: 'static>> }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: within `ManuallyDrop<(dyn Iterator<Item = impl Sized + 'static> + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator<Item = impl Sized + 'static> + 'static)`
|
||||
= note: required because it appears within the type `ManuallyDrop<(dyn Iterator<Item = impl Sized + 'static> + 'static)>`
|
||||
= note: required because it appears within the type `ManuallyDrop<dyn Iterator<Item = impl Sized>>`
|
||||
= note: no field of a union may have a dynamically sized type
|
||||
= help: change the field's type to have a statically known size
|
||||
help: borrowed types always have a statically known size
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn hello<F: for<'a> Iterator<Item: 'a>>() {
|
||||
| - help: try adding a return type: `-> Incorrect`
|
||||
LL | Incorrect
|
||||
| ^^^^^^^^^ expected `()`, found struct `Incorrect`
|
||||
| ^^^^^^^^^ expected `()`, found `Incorrect`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:27:23
|
||||
|
|
||||
LL | fn b() { dent(ModelT, Blue); }
|
||||
| ---- ^^^^ expected struct `Black`, found struct `Blue`
|
||||
| ---- ^^^^ expected `Black`, found `Blue`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
@ -16,7 +16,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:28:23
|
||||
|
|
||||
LL | fn c() { dent(ModelU, Black); }
|
||||
| ---- ^^^^^ expected struct `Blue`, found struct `Black`
|
||||
| ---- ^^^^^ expected `Blue`, found `Black`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
@ -30,7 +30,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:32:28
|
||||
|
|
||||
LL | fn f() { ModelT.chip_paint(Blue); }
|
||||
| ---------- ^^^^ expected struct `Black`, found struct `Blue`
|
||||
| ---------- ^^^^ expected `Black`, found `Blue`
|
||||
| |
|
||||
| arguments to this method are incorrect
|
||||
|
|
||||
@ -44,7 +44,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:33:28
|
||||
|
|
||||
LL | fn g() { ModelU.chip_paint(Black); }
|
||||
| ---------- ^^^^^ expected struct `Blue`, found struct `Black`
|
||||
| ---------- ^^^^^ expected `Blue`, found `Black`
|
||||
| |
|
||||
| arguments to this method are incorrect
|
||||
|
|
||||
|
@ -23,7 +23,7 @@ fn foo2<I: Foo>(x: I) {
|
||||
let _: Bar = x.boo();
|
||||
//~^ ERROR mismatched types
|
||||
//~| found associated type `<I as Foo>::A`
|
||||
//~| expected struct `Bar`, found associated type
|
||||
//~| expected `Bar`, found
|
||||
//~| expected struct `Bar`
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/associated-types-eq-3.rs:23:18
|
||||
|
|
||||
LL | let _: Bar = x.boo();
|
||||
| --- ^^^^^^^ expected struct `Bar`, found associated type
|
||||
| --- ^^^^^^^ expected `Bar`, found associated type
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0271]: type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
|
||||
error[E0271]: type mismatch resolving `<UintStruct as TheTrait<&isize>>::A == &isize`
|
||||
--> $DIR/associated-types-eq-hr.rs:87:11
|
||||
|
|
||||
LL | foo::<UintStruct>();
|
||||
| ^^^^^^^^^^ type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
|
||||
| ^^^^^^^^^^ type mismatch resolving `<UintStruct as TheTrait<&isize>>::A == &isize`
|
||||
|
|
||||
note: expected this to be `&isize`
|
||||
--> $DIR/associated-types-eq-hr.rs:26:14
|
||||
@ -20,11 +20,11 @@ LL | where
|
||||
LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>,
|
||||
| ^^^^^^^^^^^^^ required by this bound in `foo`
|
||||
|
||||
error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
|
||||
error[E0271]: type mismatch resolving `<IntStruct as TheTrait<&isize>>::A == &usize`
|
||||
--> $DIR/associated-types-eq-hr.rs:91:11
|
||||
|
|
||||
LL | bar::<IntStruct>();
|
||||
| ^^^^^^^^^ type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
|
||||
| ^^^^^^^^^ type mismatch resolving `<IntStruct as TheTrait<&isize>>::A == &usize`
|
||||
|
|
||||
note: expected this to be `&usize`
|
||||
--> $DIR/associated-types-eq-hr.rs:14:14
|
||||
|
@ -14,7 +14,7 @@ error[E0599]: no function or associated item named `default` found for trait obj
|
||||
--> $DIR/issue-43924.rs:14:39
|
||||
|
|
||||
LL | assert_eq!(<() as Foo<u32>>::Out::default().to_string(), "false");
|
||||
| ^^^^^^^ function or associated item not found in `(dyn ToString + 'static)`
|
||||
| ^^^^^^^ function or associated item not found in `dyn ToString`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -77,10 +77,10 @@ where
|
||||
|
||||
fn main() {
|
||||
accepts_trait(returns_opaque());
|
||||
//~^ ERROR type mismatch resolving `<impl Trait + 'static as Trait>::Associated == ()`
|
||||
//~^ ERROR type mismatch resolving `<impl Trait as Trait>::Associated == ()`
|
||||
|
||||
accepts_trait(returns_opaque_derived());
|
||||
//~^ ERROR type mismatch resolving `<impl DerivedTrait + 'static as Trait>::Associated == ()`
|
||||
//~^ ERROR type mismatch resolving `<impl DerivedTrait as Trait>::Associated == ()`
|
||||
|
||||
accepts_trait(returns_opaque_foo());
|
||||
//~^ ERROR type mismatch resolving `<impl Trait + Foo as Trait>::Associated == ()`
|
||||
@ -89,7 +89,7 @@ fn main() {
|
||||
//~^ ERROR type mismatch resolving `<impl DerivedTrait + Foo as Trait>::Associated == ()`
|
||||
|
||||
accepts_generic_trait(returns_opaque_generic());
|
||||
//~^ ERROR type mismatch resolving `<impl GenericTrait<()> + 'static as GenericTrait<()>>::Associated == ()`
|
||||
//~^ ERROR type mismatch resolving `<impl GenericTrait<()> as GenericTrait<()>>::Associated == ()`
|
||||
|
||||
accepts_generic_trait(returns_opaque_generic_foo());
|
||||
//~^ ERROR type mismatch resolving `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated == ()`
|
||||
|
@ -132,7 +132,7 @@ note: required by a bound in `accepts_generic_trait`
|
||||
LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {}
|
||||
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait`
|
||||
|
||||
error[E0271]: type mismatch resolving `<impl Trait + 'static as Trait>::Associated == ()`
|
||||
error[E0271]: type mismatch resolving `<impl Trait as Trait>::Associated == ()`
|
||||
--> $DIR/issue-87261.rs:79:19
|
||||
|
|
||||
LL | fn returns_opaque() -> impl Trait + 'static {
|
||||
@ -155,7 +155,7 @@ help: consider constraining the associated type `<impl Trait + 'static as Trait>
|
||||
LL | fn returns_opaque() -> impl Trait<Associated = ()> + 'static {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0271]: type mismatch resolving `<impl DerivedTrait + 'static as Trait>::Associated == ()`
|
||||
error[E0271]: type mismatch resolving `<impl DerivedTrait as Trait>::Associated == ()`
|
||||
--> $DIR/issue-87261.rs:82:19
|
||||
|
|
||||
LL | fn returns_opaque_derived() -> impl DerivedTrait + 'static {
|
||||
@ -222,7 +222,7 @@ note: required by a bound in `accepts_trait`
|
||||
LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {}
|
||||
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait`
|
||||
|
||||
error[E0271]: type mismatch resolving `<impl GenericTrait<()> + 'static as GenericTrait<()>>::Associated == ()`
|
||||
error[E0271]: type mismatch resolving `<impl GenericTrait<()> as GenericTrait<()>>::Associated == ()`
|
||||
--> $DIR/issue-87261.rs:91:27
|
||||
|
|
||||
LL | fn returns_opaque_generic() -> impl GenericTrait<()> + 'static {
|
||||
|
@ -57,7 +57,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/async-block-control-flow-static-semantics.rs:49:44
|
||||
|
|
||||
LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
|
||||
| ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
|
||||
| ---------------------------------- ^^^^^^^^^^^^^^^^^ expected `Result<u8, MyErr>`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
|
||||
@ -68,7 +68,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/async-block-control-flow-static-semantics.rs:58:50
|
||||
|
|
||||
LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> {
|
||||
| ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
|
||||
| ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected `Result<u8, MyErr>`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0053]: method `foo` has an incompatible type for trait
|
||||
--> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
|
||||
|
|
||||
LL | async fn foo(&self) -> i32 {
|
||||
| ^^^ expected struct `Pin`, found opaque type
|
||||
| ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found opaque type
|
||||
|
|
||||
note: type in trait
|
||||
--> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
|
||||
|
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
LL | Ok(())
|
||||
| ^^^^^^- help: consider using a semicolon here: `;`
|
||||
| |
|
||||
| expected `()`, found enum `Result`
|
||||
| expected `()`, found `Result<(), _>`
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found enum `Result<(), _>`
|
||||
|
@ -89,7 +89,7 @@ async fn match_() {
|
||||
match tuple() { //~ HELP consider `await`ing on the `Future`
|
||||
//~^ NOTE this expression has type `impl Future<Output = Tuple>`
|
||||
Tuple(_) => {} //~ ERROR mismatched types
|
||||
//~^ NOTE expected opaque type, found struct `Tuple`
|
||||
//~^ NOTE expected opaque type, found `Tuple`
|
||||
//~| NOTE expected opaque type `impl Future<Output = Tuple>`
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ LL | match tuple() {
|
||||
| ------- this expression has type `impl Future<Output = Tuple>`
|
||||
LL |
|
||||
LL | Tuple(_) => {}
|
||||
| ^^^^^^^^ expected opaque type, found struct `Tuple`
|
||||
| ^^^^^^^^ expected opaque type, found `Tuple`
|
||||
|
|
||||
note: while checking the return type of the `async fn`
|
||||
--> $DIR/issue-61076.rs:56:21
|
||||
|
@ -43,8 +43,8 @@ impl Runtime {
|
||||
fn main() {
|
||||
Runtime.block_on(async {
|
||||
StructAsync { callback }.await;
|
||||
//~^ ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
|
||||
//~| ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
|
||||
//~| ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
|
||||
//~^ ERROR expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
|
||||
//~| ERROR expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
|
||||
//~| ERROR expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
|
||||
});
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
|
||||
error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
|
||||
--> $DIR/issue-98634.rs:45:23
|
||||
|
|
||||
LL | StructAsync { callback }.await;
|
||||
| ^^^^^^^^ expected struct `Pin`, found opaque type
|
||||
| ^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
|
||||
|
|
||||
note: while checking the return type of the `async fn`
|
||||
--> $DIR/issue-98634.rs:24:21
|
||||
@ -17,11 +17,11 @@ note: required by a bound in `StructAsync`
|
||||
LL | pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync`
|
||||
|
||||
error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
|
||||
error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
|
||||
--> $DIR/issue-98634.rs:45:9
|
||||
|
|
||||
LL | StructAsync { callback }.await;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
|
||||
|
|
||||
note: while checking the return type of the `async fn`
|
||||
--> $DIR/issue-98634.rs:24:21
|
||||
@ -36,11 +36,11 @@ note: required by a bound in `StructAsync`
|
||||
LL | pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync`
|
||||
|
||||
error[E0271]: expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
|
||||
error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
|
||||
--> $DIR/issue-98634.rs:45:33
|
||||
|
|
||||
LL | StructAsync { callback }.await;
|
||||
| ^^^^^^ expected struct `Pin`, found opaque type
|
||||
| ^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found opaque type
|
||||
|
|
||||
note: while checking the return type of the `async fn`
|
||||
--> $DIR/issue-98634.rs:24:21
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | std::mem::size_of_val(foo());
|
||||
| --------------------- ^^^^^
|
||||
| | |
|
||||
| | expected reference, found opaque type
|
||||
| | expected `&_`, found opaque type
|
||||
| | help: consider borrowing here: `&foo()`
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/proper-span-for-type-error.rs:8:5
|
||||
|
|
||||
LL | a().await
|
||||
| ^^^^^^^^^ expected enum `Result`, found `()`
|
||||
| ^^^^^^^^^ expected `Result<(), i32>`, found `()`
|
||||
|
|
||||
= note: expected enum `Result<(), i32>`
|
||||
found unit type `()`
|
||||
|
@ -127,7 +127,7 @@ LL | match dummy_result() {
|
||||
| -------------- this expression has type `impl Future<Output = Result<(), ()>>`
|
||||
...
|
||||
LL | Ok(_) => {}
|
||||
| ^^^^^ expected opaque type, found enum `Result`
|
||||
| ^^^^^ expected opaque type, found `Result<_, _>`
|
||||
|
|
||||
note: while checking the return type of the `async fn`
|
||||
--> $DIR/suggest-missing-await.rs:57:28
|
||||
@ -148,7 +148,7 @@ LL | match dummy_result() {
|
||||
| -------------- this expression has type `impl Future<Output = Result<(), ()>>`
|
||||
...
|
||||
LL | Err(_) => {}
|
||||
| ^^^^^^ expected opaque type, found enum `Result`
|
||||
| ^^^^^^ expected opaque type, found `Result<_, _>`
|
||||
|
|
||||
note: while checking the return type of the `async fn`
|
||||
--> $DIR/suggest-missing-await.rs:57:28
|
||||
|
@ -10,7 +10,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-38940.rs:49:22
|
||||
|
|
||||
LL | let x: &Bottom = &t;
|
||||
| ------- ^^ expected struct `Bottom`, found struct `Top`
|
||||
| ------- ^^ expected `&Bottom`, found `&Top`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -7,7 +7,7 @@ LL | mod foo { pub struct bar; }
|
||||
LL | let bar = 5;
|
||||
| ^^^ - this expression has type `{integer}`
|
||||
| |
|
||||
| expected integer, found struct `bar`
|
||||
| expected integer, found `bar`
|
||||
| `bar` is interpreted as a unit struct, not a new binding
|
||||
| help: introduce a new binding instead: `other_bar`
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/consider-removing-last-semi.rs:3:15
|
||||
|
|
||||
LL | pub fn f() -> String {
|
||||
| - ^^^^^^ expected struct `String`, found `()`
|
||||
| - ^^^^^^ expected `String`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
LL | 0u8;
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/consider-removing-last-semi.rs:8:15
|
||||
|
|
||||
LL | pub fn g() -> String {
|
||||
| - ^^^^^^ expected struct `String`, found `()`
|
||||
| - ^^^^^^ expected `String`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
LL | "this won't work".to_string();
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-13428.rs:3:13
|
||||
|
|
||||
LL | fn foo() -> String {
|
||||
| --- ^^^^^^ expected struct `String`, found `()`
|
||||
| --- ^^^^^^ expected `String`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
||||
@ -10,7 +10,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-13428.rs:11:13
|
||||
|
|
||||
LL | fn bar() -> String {
|
||||
| --- ^^^^^^ expected struct `String`, found `()`
|
||||
| --- ^^^^^^ expected `String`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
LL | "foobar".to_string()
|
||||
|
@ -6,7 +6,7 @@ mod a {
|
||||
pub fn get_enum_struct_variant() -> () {
|
||||
Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `()`, found enum `Enum`
|
||||
//~| expected `()`, found `Enum`
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ mod b {
|
||||
match enum_struct_variant {
|
||||
a::Enum::EnumStructVariant { x, y, z } => {
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `()`, found enum `Enum`
|
||||
//~| expected `()`, found `Enum`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | pub fn get_enum_struct_variant() -> () {
|
||||
| -- expected `()` because of return type
|
||||
LL | Enum::EnumStructVariant { x: 1, y: 2, z: 3 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Enum`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Enum`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-13624.rs:20:9
|
||||
@ -12,7 +12,7 @@ error[E0308]: mismatched types
|
||||
LL | match enum_struct_variant {
|
||||
| ------------------- this expression has type `()`
|
||||
LL | a::Enum::EnumStructVariant { x, y, z } => {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Enum`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Enum`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -20,7 +20,7 @@ LL | fn main() {
|
||||
| - expected `()` because of default return type
|
||||
LL | let b = Bob + 3.5;
|
||||
LL | b + 3
|
||||
| ^^^^^ expected `()`, found struct `Bob`
|
||||
| ^^^^^ expected `()`, found `Bob`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -3,5 +3,5 @@ fn main() {
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected unit type `()`
|
||||
//~| found reference `&_`
|
||||
//~| expected `()`, found reference
|
||||
//~| expected `()`, found `&_`
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn main() {
|
||||
| - expected `()` because of default return type
|
||||
LL | &panic!()
|
||||
| ^^^^^^^^^ expected `()`, found reference
|
||||
| ^^^^^^^^^ expected `()`, found `&_`
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found reference `&_`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-82446.rs:11:9
|
||||
|
|
||||
LL | val
|
||||
| ^^^ expected struct `Box`, found reference
|
||||
| ^^^ expected `Box<dyn MyTrait>`, found `&Box<dyn MyTrait>`
|
||||
|
|
||||
= note: expected struct `Box<(dyn MyTrait + 'static)>`
|
||||
found reference `&Box<(dyn MyTrait + 'static)>`
|
||||
|
@ -46,6 +46,7 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
|
||||
|
|
||||
= note: expected fn pointer `unsafe extern "C" fn(_, _)`
|
||||
found fn item `unsafe extern "C" fn(_, _, ...) {foo}`
|
||||
= note: when the arguments and return types match, functions can be coerced to function pointers
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/variadic-ffi-1.rs:26:54
|
||||
@ -57,6 +58,7 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
|
||||
|
|
||||
= note: expected fn pointer `extern "C" fn(_, _, ...)`
|
||||
found fn item `extern "C" fn(_, _) {bar}`
|
||||
= note: when the arguments and return types match, functions can be coerced to function pointers
|
||||
|
||||
error[E0617]: can't pass `f32` to variadic function
|
||||
--> $DIR/variadic-ffi-1.rs:28:19
|
||||
|
@ -26,7 +26,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-78720.rs:7:39
|
||||
|
|
||||
LL | fn map2<F>(self, f: F) -> Map2<F> {}
|
||||
| ^^ expected struct `Map2`, found `()`
|
||||
| ^^ expected `Map2<F>`, found `()`
|
||||
|
|
||||
= note: expected struct `Map2<F>`
|
||||
found unit type `()`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-block-tail-26978.rs:9:9
|
||||
|
|
||||
LL | f(&{x});
|
||||
| ^ expected `i32`, found struct `Box`
|
||||
| ^ expected `i32`, found `Box<i32>`
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found struct `Box<i32>`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-block-tail-57749.rs:33:14
|
||||
|
|
||||
LL | reset(&{ Homura });
|
||||
| ^^^^^^ expected `u32`, found struct `Homura`
|
||||
| ^^^^^^ expected `u32`, found `Homura`
|
||||
|
|
||||
help: consider dereferencing the type
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-block-tail-83783.rs:7:32
|
||||
|
|
||||
LL | _consume_reference::<i32>(&async { Box::new(7_i32) }.await);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `Box`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `Box<i32>`
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found struct `Box<i32>`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-block-tail-83850.rs:5:7
|
||||
|
|
||||
LL | f(&Box::new([1, 2]));
|
||||
| - ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found struct `Box`
|
||||
| - ^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&Box<[{integer}; 2]>`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-block-tail.rs:4:23
|
||||
|
|
||||
LL | let _: &i32 = & { Box::new(1i32) };
|
||||
| ^^^^^^^^^^^^^^ expected `i32`, found struct `Box`
|
||||
| ^^^^^^^^^^^^^^ expected `i32`, found `Box<i32>`
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found struct `Box<i32>`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:9:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(box { [1, 2, 3] }, Box<[i32]>);
|
||||
| ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
| ^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
||||
|
|
||||
= note: expected struct `Box<[i32]>`
|
||||
found struct `Box<[i32; 3]>`
|
||||
@ -11,7 +11,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:10:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(box if true { [1, 2, 3] } else { [1, 3, 4] }, Box<[i32]>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
||||
|
|
||||
= note: expected struct `Box<[i32]>`
|
||||
found struct `Box<[i32; 3]>`
|
||||
@ -20,7 +20,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:11:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(box match true { true => [1, 2, 3], false => [1, 3, 4] }, Box<[i32]>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
||||
|
|
||||
= note: expected struct `Box<[i32]>`
|
||||
found struct `Box<[i32; 3]>`
|
||||
@ -29,7 +29,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:13:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(box { |x| (x as u8) }, Box<dyn Fn(i32) -> _>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:13:33]>`
|
||||
|
|
||||
= note: expected struct `Box<dyn Fn(i32) -> u8>`
|
||||
found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:33: 13:36]>`
|
||||
@ -38,7 +38,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:14:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(box if true { false } else { true }, Box<dyn Debug>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Debug>`, found `Box<bool>`
|
||||
|
|
||||
= note: expected struct `Box<dyn Debug>`
|
||||
found struct `Box<bool>`
|
||||
@ -47,7 +47,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:15:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(box match true { true => 'a', false => 'b' }, Box<dyn Debug>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Debug>`, found `Box<char>`
|
||||
|
|
||||
= note: expected struct `Box<dyn Debug>`
|
||||
found struct `Box<char>`
|
||||
@ -56,7 +56,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:17:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]);
|
||||
| ^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
| ^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]`
|
||||
|
|
||||
= note: expected reference `&[i32]`
|
||||
found reference `&[i32; 3]`
|
||||
@ -65,7 +65,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:18:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(&if true { [1, 2, 3] } else { [1, 3, 4] }, &[i32]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]`
|
||||
|
|
||||
= note: expected reference `&[i32]`
|
||||
found reference `&[i32; 3]`
|
||||
@ -74,7 +74,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:19:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(&match true { true => [1, 2, 3], false => [1, 3, 4] }, &[i32]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]`
|
||||
|
|
||||
= note: expected reference `&[i32]`
|
||||
found reference `&[i32; 3]`
|
||||
@ -83,7 +83,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:21:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _);
|
||||
| ^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure
|
||||
| ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&[closure@coerce-expect-unsized-ascribed.rs:21:30]`
|
||||
|
|
||||
= note: expected reference `&dyn Fn(i32) -> u8`
|
||||
found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:30: 21:33]`
|
||||
@ -92,7 +92,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:22:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(&if true { false } else { true }, &dyn Debug);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Debug`, found `&bool`
|
||||
|
|
||||
= note: expected reference `&dyn Debug`
|
||||
found reference `&bool`
|
||||
@ -101,7 +101,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:23:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(&match true { true => 'a', false => 'b' }, &dyn Debug);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Debug`, found `&char`
|
||||
|
|
||||
= note: expected reference `&dyn Debug`
|
||||
found reference `&char`
|
||||
@ -110,7 +110,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:25:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(Box::new([1, 2, 3]), Box<[i32]>);
|
||||
| ^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]`
|
||||
| ^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
||||
|
|
||||
= note: expected struct `Box<[i32]>`
|
||||
found struct `Box<[i32; 3]>`
|
||||
@ -119,7 +119,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:26:27
|
||||
|
|
||||
LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box<dyn Fn(i32) -> _>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<[closure@coerce-expect-unsized-ascribed.rs:26:36]>`
|
||||
|
|
||||
= note: expected struct `Box<dyn Fn(i32) -> u8>`
|
||||
found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:36: 26:39]>`
|
||||
|
@ -82,7 +82,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:50:21
|
||||
|
|
||||
LL | let x: [!; 2] = [return, 22];
|
||||
| ------ ^^^^^^^^^^^^ expected `!`, found integer
|
||||
| ------ ^^^^^^^^^^^^ expected `[!; 2]`, found `[{integer}; 2]`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -12,7 +12,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/coercion-missing-tail-expected-type.rs:8:13
|
||||
|
|
||||
LL | fn foo() -> Result<u8, u64> {
|
||||
| --- ^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
|
||||
| --- ^^^^^^^^^^^^^^^ expected `Result<u8, u64>`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
LL | Ok(1);
|
||||
|
@ -3,5 +3,5 @@
|
||||
fn main() {
|
||||
let _: &[i32] = [0];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `&[i32]`, found array `[{integer}; 1]`
|
||||
//~| expected `&[i32]`, found `[{integer}; 1]`
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | let _: &[i32] = [0];
|
||||
| ------ ^^^
|
||||
| | |
|
||||
| | expected `&[i32]`, found array `[{integer}; 1]`
|
||||
| | expected `&[i32]`, found `[{integer}; 1]`
|
||||
| | help: consider borrowing here: `&[0]`
|
||||
| expected due to this
|
||||
|
||||
|
@ -4,7 +4,7 @@ error[E0053]: method `poll` has an incompatible type for trait
|
||||
LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> {
|
||||
| ^^^^
|
||||
| |
|
||||
| expected struct `Pin`, found struct `MyFuture`
|
||||
| expected `Pin<&mut MyFuture>`, found `MyFuture`
|
||||
| help: change the self-receiver type to match the trait: `self: Pin<&mut MyFuture>`
|
||||
|
|
||||
= note: expected signature `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>`
|
||||
@ -16,7 +16,7 @@ error[E0053]: method `foo` has an incompatible type for trait
|
||||
LL | fn foo(self: Box<Self>) {}
|
||||
| ------^^^^^^^^^
|
||||
| | |
|
||||
| | expected struct `MyFuture`, found struct `Box`
|
||||
| | expected `MyFuture`, found `Box<MyFuture>`
|
||||
| help: change the self-receiver type to match the trait: `self`
|
||||
|
|
||||
note: type in trait
|
||||
@ -31,7 +31,7 @@ error[E0053]: method `bar` has an incompatible type for trait
|
||||
--> $DIR/bad-self-type.rs:24:18
|
||||
|
|
||||
LL | fn bar(self) {}
|
||||
| ^ expected enum `Option`, found `()`
|
||||
| ^ expected `Option<()>`, found `()`
|
||||
|
|
||||
note: type in trait
|
||||
--> $DIR/bad-self-type.rs:18:21
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0599]: no method named `closure` found for reference `&Obj<[closure@issue-33784.rs:25:43]>` in the current scope
|
||||
error[E0599]: no method named `closure` found for reference `&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope
|
||||
--> $DIR/issue-33784.rs:27:7
|
||||
|
|
||||
LL | p.closure();
|
||||
@ -9,7 +9,7 @@ help: to call the function stored in `closure`, surround the field access with p
|
||||
LL | (p.closure)();
|
||||
| + +
|
||||
|
||||
error[E0599]: no method named `fn_ptr` found for reference `&&Obj<[closure@issue-33784.rs:25:43]>` in the current scope
|
||||
error[E0599]: no method named `fn_ptr` found for reference `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope
|
||||
--> $DIR/issue-33784.rs:29:7
|
||||
|
|
||||
LL | q.fn_ptr();
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/mismatch.rs:7:26
|
||||
|
|
||||
LL | let e: Example<13> = ();
|
||||
| ----------- ^^ expected struct `Example`, found `()`
|
||||
| ----------- ^^ expected `Example`, found `()`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/mismatch.rs:10:32
|
||||
|
|
||||
LL | let e: Example2<u32, 13> = ();
|
||||
| ----------------- ^^ expected struct `Example2`, found `()`
|
||||
| ----------------- ^^ expected `Example2`, found `()`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -24,7 +24,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/mismatch.rs:13:32
|
||||
|
|
||||
LL | let e: Example3<13, u32> = ();
|
||||
| ----------------- ^^ expected struct `Example3`, found `()`
|
||||
| ----------------- ^^ expected `Example3`, found `()`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -35,7 +35,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/mismatch.rs:16:26
|
||||
|
|
||||
LL | let e: Example3<7> = ();
|
||||
| ----------- ^^ expected struct `Example3`, found `()`
|
||||
| ----------- ^^ expected `Example3<7>`, found `()`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -46,7 +46,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/mismatch.rs:19:26
|
||||
|
|
||||
LL | let e: Example4<7> = ();
|
||||
| ----------- ^^ expected struct `Example4`, found `()`
|
||||
| ----------- ^^ expected `Example4<7>`, found `()`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-79518-default_trait_method_normalization.rs:16:32
|
||||
|
|
||||
LL | Self::AssocInstance == [(); std::mem::size_of::<Self::Assoc>()];
|
||||
| ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found array `[(); std::mem::size_of::<Self::Assoc>()]`
|
||||
| ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `[(); std::mem::size_of::<Self::Assoc>()]`
|
||||
| |
|
||||
| expected because this is `<Self as Foo>::Assoc`
|
||||
|
|
||||
|
@ -5,7 +5,7 @@ LL | struct Bug<S> {
|
||||
| - this type parameter
|
||||
...
|
||||
LL | let x: S = MaybeUninit::uninit();
|
||||
| - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found union `MaybeUninit`
|
||||
| - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found `MaybeUninit<_>`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -8,7 +8,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/type_mismatch.rs:5:26
|
||||
|
|
||||
LL | fn bar<const N: u8>() -> [u8; N] {}
|
||||
| --- ^^^^^^^ expected array `[u8; N]`, found `()`
|
||||
| --- ^^^^^^^ expected `[u8; N]`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
||||
|
@ -14,7 +14,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/type_not_in_scope.rs:7:33
|
||||
|
|
||||
LL | fn getn<const N: cfg_attr>() -> [u8; N] {}
|
||||
| ---- ^^^^^^^ expected array `[u8; N]`, found `()`
|
||||
| ---- ^^^^^^^ expected `[u8; N]`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
||||
|
@ -11,7 +11,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/types-mismatch-const-args.rs:16:41
|
||||
|
|
||||
LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
|
||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
|
||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 2, 3>`, found `A<'_, u32, 2, 3>`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -22,7 +22,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/types-mismatch-const-args.rs:18:41
|
||||
|
|
||||
LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
|
||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
|
||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 4, 3>`, found `A<'_, u32, 2, 3>`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/types-mismatch-const-args.rs:16:41
|
||||
|
|
||||
LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
|
||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
|
||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 2, 3>`, found `A<'_, u32, 2, 3>`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -24,7 +24,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/types-mismatch-const-args.rs:18:41
|
||||
|
|
||||
LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
|
||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
|
||||
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `A<'_, u16, 4, 3>`, found `A<'_, u32, 2, 3>`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -8,7 +8,7 @@ const CONSTANT: S = S(0);
|
||||
enum E {
|
||||
V = CONSTANT,
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected `isize`, found struct `S`
|
||||
//~| expected `isize`, found `S`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-eval-span.rs:9:9
|
||||
|
|
||||
LL | V = CONSTANT,
|
||||
| ^^^^^^^^ expected `isize`, found struct `S`
|
||||
| ^^^^^^^^ expected `isize`, found `S`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const TUP: (usize,) = 5usize << 64;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected tuple, found `usize`
|
||||
//~| expected `(usize,)`, found `usize`
|
||||
const ARR: [i32; TUP.0] = [];
|
||||
//~^ constant
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/const-tup-index-span.rs:3:23
|
||||
|
|
||||
LL | const TUP: (usize,) = 5usize << 64;
|
||||
| ^^^^^^^^^^^^ expected tuple, found `usize`
|
||||
| ^^^^^^^^^^^^ expected `(usize,)`, found `usize`
|
||||
|
|
||||
= note: expected tuple `(usize,)`
|
||||
found type `usize`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/nested_erroneous_ctfe.rs:2:16
|
||||
|
|
||||
LL | [9; || [9; []]];
|
||||
| ^^ expected `usize`, found array of 0 elements
|
||||
| ^^ expected `usize`, found `[_; 0]`
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found array `[_; 0]`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/cross-borrow-trait.rs:10:26
|
||||
|
|
||||
LL | let _y: &dyn Trait = x;
|
||||
| ---------- ^ expected `&dyn Trait`, found struct `Box`
|
||||
| ---------- ^ expected `&dyn Trait`, found `Box<dyn Trait>`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | match String::new() {
|
||||
| ------------- this expression has type `String`
|
||||
LL | "" | _ => {}
|
||||
| ^^ expected struct `String`, found `&str`
|
||||
| ^^ expected `String`, found `&str`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -22,7 +22,7 @@ error[E0308]: mismatched types
|
||||
LL | let &&x = &1isize as &dyn T;
|
||||
| ^^ ----------------- this expression has type `&dyn T`
|
||||
| |
|
||||
| expected trait object `dyn T`, found reference
|
||||
| expected `dyn T`, found `&_`
|
||||
|
|
||||
= note: expected trait object `dyn T`
|
||||
found reference `&_`
|
||||
@ -38,7 +38,7 @@ error[E0308]: mismatched types
|
||||
LL | let &&&x = &(&1isize as &dyn T);
|
||||
| ^^ -------------------- this expression has type `&&dyn T`
|
||||
| |
|
||||
| expected trait object `dyn T`, found reference
|
||||
| expected `dyn T`, found `&_`
|
||||
|
|
||||
= note: expected trait object `dyn T`
|
||||
found reference `&_`
|
||||
@ -54,7 +54,7 @@ error[E0308]: mismatched types
|
||||
LL | let box box x = Box::new(1isize) as Box<dyn T>;
|
||||
| ^^^^^ ------------------------------ this expression has type `Box<dyn T>`
|
||||
| |
|
||||
| expected trait object `dyn T`, found struct `Box`
|
||||
| expected `dyn T`, found `Box<_>`
|
||||
|
|
||||
= note: expected trait object `dyn T`
|
||||
found struct `Box<_>`
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | (x, y) = &(1, 2);
|
||||
| ^^^^^^ ------- this expression has type `&({integer}, {integer})`
|
||||
| |
|
||||
| expected reference, found tuple
|
||||
| expected `&({integer}, {integer})`, found `(_, _)`
|
||||
|
|
||||
= note: expected reference `&({integer}, {integer})`
|
||||
found tuple `(_, _)`
|
||||
|
@ -16,7 +16,7 @@ LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok...
|
||||
LL | | Ok("")
|
||||
LL | | ))))))))))))))))))))))))))))))
|
||||
LL | | ))))))))))))))))))))))))))))));
|
||||
| |__________________________________^ expected struct `Atype`, found enum `Result`
|
||||
| |__________________________________^ expected `Atype<Btype<..., ...>, ...>`, found `Result<Result<..., ...>, ...>`
|
||||
|
|
||||
= note: expected struct `Atype<Btype<..., ...>, ...>`
|
||||
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||
@ -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 | | ))))))))))))))))))))))))))))))
|
||||
LL | | ))))))))))))))))))))))));
|
||||
| |____________________________^ expected enum `Option`, found enum `Result`
|
||||
| |____________________________^ expected `Option<Result<..., ...>>`, found `Result<Result<..., ...>, ...>`
|
||||
|
|
||||
= note: expected enum `Option<Result<..., ...>>`
|
||||
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||
@ -50,7 +50,7 @@ LL | | Atype<
|
||||
... |
|
||||
LL | | i32
|
||||
LL | | > = ();
|
||||
| | - ^^ expected struct `Atype`, found `()`
|
||||
| | - ^^ expected `Atype<Btype<..., ...>, ...>`, found `()`
|
||||
| |_____|
|
||||
| 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 | | ))))))))))))))))))))))))))))))
|
||||
LL | | ))))))))))))))))))))))));
|
||||
| |____________________________^ expected `()`, found enum `Result`
|
||||
| |____________________________^ expected `()`, found `Result<Result<..., ...>, ...>`
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found enum `Result<Result<..., ...>, ...>`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/brackets-to-braces-single-element.rs:1:24
|
||||
|
|
||||
LL | const A: [&str; 1] = { "hello" };
|
||||
| ^^^^^^^ expected array `[&'static str; 1]`, found `&str`
|
||||
| ^^^^^^^ expected `[&str; 1]`, found `&str`
|
||||
|
|
||||
help: to create an array, use square brackets instead of curly braces
|
||||
|
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/brackets-to-braces-single-element.rs:4:19
|
||||
|
|
||||
LL | const B: &[u32] = &{ 1 };
|
||||
| ^^^^^^ expected slice `[u32]`, found integer
|
||||
| ^^^^^^ expected `&[u32]`, found `&{integer}`
|
||||
|
|
||||
= note: expected reference `&'static [u32]`
|
||||
found reference `&{integer}`
|
||||
@ -26,7 +26,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/brackets-to-braces-single-element.rs:7:27
|
||||
|
|
||||
LL | const C: &&[u32; 1] = &&{ 1 };
|
||||
| ^ expected array `[u32; 1]`, found integer
|
||||
| ^ expected `[u32; 1]`, found integer
|
||||
|
|
||||
help: to create an array, use square brackets instead of curly braces
|
||||
|
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | match f {
|
||||
| - this expression has type `Foo`
|
||||
LL | Bar { x } => {
|
||||
| ^^^^^^^^^ expected enum `Foo`, found struct `Bar`
|
||||
| ^^^^^^^^^ expected `Foo`, found `Bar`
|
||||
|
|
||||
help: try wrapping the pattern in `Foo::Bar`
|
||||
|
|
||||
@ -22,7 +22,7 @@ LL | match 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
|
||||
|
|
||||
= note: expected enum `Option<S>`
|
||||
@ -47,7 +47,7 @@ LL | match s {
|
||||
LL | S => {
|
||||
| ^
|
||||
| |
|
||||
| expected enum `Result`, found struct `S`
|
||||
| expected `Result<S, S>`, found `S`
|
||||
| `S` is interpreted as a unit struct, not a new binding
|
||||
|
|
||||
= note: expected enum `Result<S, S>`
|
||||
|
@ -7,7 +7,7 @@ LL | / while false {
|
||||
LL | |
|
||||
LL | | f();
|
||||
LL | | }
|
||||
| |_____^ expected enum `Option`, found `()`
|
||||
| |_____^ expected `Option<()>`, found `()`
|
||||
|
|
||||
= note: expected enum `Option<()>`
|
||||
found unit type `()`
|
||||
@ -26,7 +26,7 @@ error[E0308]: mismatched types
|
||||
LL | fn b() -> Result<(), ()> {
|
||||
| -------------- expected `Result<(), ()>` because of return type
|
||||
LL | f()
|
||||
| ^^^ expected enum `Result`, found `()`
|
||||
| ^^^ expected `Result<(), ()>`, found `()`
|
||||
|
|
||||
= note: expected enum `Result<(), ()>`
|
||||
found unit type `()`
|
||||
@ -45,7 +45,7 @@ LL | / for _ in [1, 2] {
|
||||
LL | |
|
||||
LL | | f();
|
||||
LL | | }
|
||||
| |_____^ expected enum `Option`, found `()`
|
||||
| |_____^ expected `Option<()>`, found `()`
|
||||
|
|
||||
= note: expected enum `Option<()>`
|
||||
found unit type `()`
|
||||
@ -62,7 +62,7 @@ error[E0308]: `?` operator has incompatible types
|
||||
--> $DIR/compatible-variants.rs:35:5
|
||||
|
|
||||
LL | c()?
|
||||
| ^^^^ expected enum `Option`, found `()`
|
||||
| ^^^^ expected `Option<()>`, found `()`
|
||||
|
|
||||
= note: `?` operator cannot convert from `()` to `Option<()>`
|
||||
= note: expected enum `Option<()>`
|
||||
@ -85,7 +85,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/compatible-variants.rs:42:25
|
||||
|
|
||||
LL | let _: Option<()> = while false {};
|
||||
| ---------- ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
|
||||
| ---------- ^^^^^^^^^^^^^^ expected `Option<()>`, found `()`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -100,7 +100,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/compatible-variants.rs:46:9
|
||||
|
|
||||
LL | while false {}
|
||||
| ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
|
||||
| ^^^^^^^^^^^^^^ expected `Option<()>`, found `()`
|
||||
|
|
||||
= note: expected enum `Option<()>`
|
||||
found unit type `()`
|
||||
@ -117,7 +117,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/compatible-variants.rs:50:31
|
||||
|
|
||||
LL | let _: Result<i32, i32> = 1;
|
||||
| ---------------- ^ expected enum `Result`, found integer
|
||||
| ---------------- ^ expected `Result<i32, i32>`, found integer
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -134,7 +134,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/compatible-variants.rs:53:26
|
||||
|
|
||||
LL | let _: Option<i32> = 1;
|
||||
| ----------- ^ expected enum `Option`, found integer
|
||||
| ----------- ^ expected `Option<i32>`, found integer
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -149,7 +149,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/compatible-variants.rs:56:28
|
||||
|
|
||||
LL | let _: Hey<i32, i32> = 1;
|
||||
| ------------- ^ expected enum `Hey`, found integer
|
||||
| ------------- ^ expected `Hey<i32, i32>`, found integer
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -166,7 +166,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/compatible-variants.rs:59:29
|
||||
|
|
||||
LL | let _: Hey<i32, bool> = false;
|
||||
| -------------- ^^^^^ expected enum `Hey`, found `bool`
|
||||
| -------------- ^^^^^ expected `Hey<i32, bool>`, found `bool`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -181,7 +181,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/compatible-variants.rs:63:19
|
||||
|
|
||||
LL | let _ = Foo { bar };
|
||||
| ^^^ expected enum `Option`, found `i32`
|
||||
| ^^^ expected `Option<i32>`, found `i32`
|
||||
|
|
||||
= note: expected enum `Option<i32>`
|
||||
found type `i32`
|
||||
@ -194,7 +194,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/compatible-variants.rs:80:16
|
||||
|
|
||||
LL | let a: A = B::Fst;
|
||||
| - ^^^^^^ expected enum `A`, found enum `B`
|
||||
| - ^^^^^^ expected `A`, found `B`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -207,7 +207,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/compatible-variants.rs:86:17
|
||||
|
|
||||
LL | let a: A2 = B::Fst;
|
||||
| -- ^^^^^^ expected struct `A2`, found enum `B`
|
||||
| -- ^^^^^^ expected `A2`, found `B`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-42764.rs:11:43
|
||||
|
|
||||
LL | this_function_expects_a_double_option(n);
|
||||
| ------------------------------------- ^ expected enum `DoubleOption`, found `usize`
|
||||
| ------------------------------------- ^ expected `DoubleOption<_>`, found `usize`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
@ -24,7 +24,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-42764.rs:27:33
|
||||
|
|
||||
LL | let _c = Context { wrapper: Payload{} };
|
||||
| ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload`
|
||||
| ^^^^^^^^^ expected `Wrapper`, found `Payload`
|
||||
|
|
||||
help: try wrapping the expression in `Wrapper`
|
||||
|
|
||||
|
@ -10,7 +10,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/recursion_limit_deref.rs:51:22
|
||||
|
|
||||
LL | let x: &Bottom = &t;
|
||||
| ------- ^^ expected struct `Bottom`, found struct `Top`
|
||||
| ------- ^^ expected `&Bottom`, found `&Top`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/disambiguate-identical-names.rs:13:10
|
||||
|
|
||||
LL | test(&v);
|
||||
| ---- ^^ expected struct `Vec`, found struct `HashMap`
|
||||
| ---- ^^ expected `&Vec<Vec<u32>>`, found `&HashMap<u8, u8>`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
|
@ -5,7 +5,7 @@ LL | fn assert_sizeof() -> ! {
|
||||
| - expected `!` because of return type
|
||||
LL | unsafe {
|
||||
LL | ::std::mem::transmute::<f64, [u8; 8]>(panic!())
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found array `[u8; 8]`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `!`, found `[u8; 8]`
|
||||
|
|
||||
= note: expected type `!`
|
||||
found array `[u8; 8]`
|
||||
|
@ -32,7 +32,7 @@ pub fn main() {
|
||||
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
|
||||
f5.2 = Bar1 {f: 36};
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected trait object `dyn ToBar`, found struct `Bar1`
|
||||
//~| expected `dyn ToBar`, found `Bar1`
|
||||
//~| expected trait object `dyn ToBar`
|
||||
//~| found struct `Bar1`
|
||||
//~| ERROR the size for values of type
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-assign-3.rs:33:12
|
||||
|
|
||||
LL | f5.2 = Bar1 {f: 36};
|
||||
| ---- ^^^^^^^^^^^^ expected trait object `dyn ToBar`, found struct `Bar1`
|
||||
| ---- ^^^^^^^^^^^^ expected `dyn ToBar`, found `Bar1`
|
||||
| |
|
||||
| expected due to the type of this binding
|
||||
|
|
||||
|
@ -34,7 +34,7 @@ pub fn main() {
|
||||
let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36});
|
||||
f5.ptr = Bar1 {f: 36};
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected trait object `dyn ToBar`, found struct `Bar1`
|
||||
//~| expected `dyn ToBar`, found `Bar1`
|
||||
//~| expected trait object `dyn ToBar`
|
||||
//~| found struct `Bar1`
|
||||
//~| ERROR the size for values of type
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-assign.rs:35:14
|
||||
|
|
||||
LL | f5.ptr = Bar1 {f: 36};
|
||||
| ------ ^^^^^^^^^^^^ expected trait object `dyn ToBar`, found struct `Bar1`
|
||||
| ------ ^^^^^^^^^^^^ expected `dyn ToBar`, found `Bar1`
|
||||
| |
|
||||
| expected due to the type of this binding
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-coerce1.rs:16:29
|
||||
|
|
||||
LL | let f3: &Fat<[usize]> = f2;
|
||||
| ------------- ^^ expected slice `[usize]`, found array `[isize; 3]`
|
||||
| ------------- ^^ expected `&Fat<[usize]>`, found `&Fat<[isize; 3]>`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -21,7 +21,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-coerce1.rs:28:27
|
||||
|
|
||||
LL | let f3: &([usize],) = f2;
|
||||
| ----------- ^^ expected slice `[usize]`, found array `[isize; 3]`
|
||||
| ----------- ^^ expected `&([usize],)`, found `&([isize; 3],)`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
@ -11,7 +11,7 @@ pub fn main() {
|
||||
let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] };
|
||||
let f2: &Fat<[isize; 3]> = f1;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected array `[isize; 3]`, found slice `[isize]`
|
||||
//~| expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>`
|
||||
//~| expected reference `&Fat<[isize; 3]>`
|
||||
//~| found reference `&Fat<[isize]>`
|
||||
|
||||
@ -19,7 +19,7 @@ pub fn main() {
|
||||
let f1: &([isize],) = &([1, 2, 3],);
|
||||
let f2: &([isize; 3],) = f1;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected array `[isize; 3]`, found slice `[isize]`
|
||||
//~| expected `&([isize; 3],)`, found `&([isize],)`
|
||||
//~| expected reference `&([isize; 3],)`
|
||||
//~| found reference `&([isize],)`
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-coerce4.rs:12:32
|
||||
|
|
||||
LL | let f2: &Fat<[isize; 3]> = f1;
|
||||
| ---------------- ^^ expected array `[isize; 3]`, found slice `[isize]`
|
||||
| ---------------- ^^ expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/dst-bad-coerce4.rs:20:30
|
||||
|
|
||||
LL | let f2: &([isize; 3],) = f1;
|
||||
| -------------- ^^ expected array `[isize; 3]`, found slice `[isize]`
|
||||
| -------------- ^^ expected `&([isize; 3],)`, found `&([isize],)`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user