Auto merge of #96155 - jackh726:param-heuristics-followup, r=estebank
Followups for method call error change Each commit is self-contained. Fixes most of the followup reviews from that PR. r? `@estebank`
This commit is contained in:
commit
030c886c29
44 changed files with 265 additions and 312 deletions
|
@ -1584,9 +1584,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
Variable(ty::error::ExpectedFound<Ty<'a>>),
|
Variable(ty::error::ExpectedFound<Ty<'a>>),
|
||||||
Fixed(&'static str),
|
Fixed(&'static str),
|
||||||
}
|
}
|
||||||
let (expected_found, exp_found, is_simple_error) = match values {
|
let (expected_found, exp_found, is_simple_error, values) = match values {
|
||||||
None => (None, Mismatch::Fixed("type"), false),
|
None => (None, Mismatch::Fixed("type"), false, None),
|
||||||
Some(values) => {
|
Some(values) => {
|
||||||
|
let values = self.resolve_vars_if_possible(values);
|
||||||
let (is_simple_error, exp_found) = match values {
|
let (is_simple_error, exp_found) = match values {
|
||||||
ValuePairs::Terms(infer::ExpectedFound {
|
ValuePairs::Terms(infer::ExpectedFound {
|
||||||
expected: ty::Term::Ty(expected),
|
expected: ty::Term::Ty(expected),
|
||||||
|
@ -1614,7 +1615,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
(vals, exp_found, is_simple_error)
|
(vals, exp_found, is_simple_error, Some(values))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub fn check_legal_trait_for_method_call(
|
||||||
|
|
||||||
enum CallStep<'tcx> {
|
enum CallStep<'tcx> {
|
||||||
Builtin(Ty<'tcx>),
|
Builtin(Ty<'tcx>),
|
||||||
DeferredClosure(ty::FnSig<'tcx>),
|
DeferredClosure(DefId, ty::FnSig<'tcx>),
|
||||||
/// E.g., enum variant constructors.
|
/// E.g., enum variant constructors.
|
||||||
Overloaded(MethodCallee<'tcx>),
|
Overloaded(MethodCallee<'tcx>),
|
||||||
}
|
}
|
||||||
|
@ -107,8 +107,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
self.confirm_builtin_call(call_expr, callee_expr, callee_ty, arg_exprs, expected)
|
self.confirm_builtin_call(call_expr, callee_expr, callee_ty, arg_exprs, expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(CallStep::DeferredClosure(fn_sig)) => {
|
Some(CallStep::DeferredClosure(def_id, fn_sig)) => {
|
||||||
self.confirm_deferred_closure_call(call_expr, arg_exprs, expected, fn_sig)
|
self.confirm_deferred_closure_call(call_expr, arg_exprs, expected, def_id, fn_sig)
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(CallStep::Overloaded(method_callee)) => {
|
Some(CallStep::Overloaded(method_callee)) => {
|
||||||
|
@ -171,7 +171,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
closure_substs: substs,
|
closure_substs: substs,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return Some(CallStep::DeferredClosure(closure_sig));
|
return Some(CallStep::DeferredClosure(def_id, closure_sig));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,6 +533,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
call_expr: &'tcx hir::Expr<'tcx>,
|
call_expr: &'tcx hir::Expr<'tcx>,
|
||||||
arg_exprs: &'tcx [hir::Expr<'tcx>],
|
arg_exprs: &'tcx [hir::Expr<'tcx>],
|
||||||
expected: Expectation<'tcx>,
|
expected: Expectation<'tcx>,
|
||||||
|
closure_def_id: DefId,
|
||||||
fn_sig: ty::FnSig<'tcx>,
|
fn_sig: ty::FnSig<'tcx>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
// `fn_sig` is the *signature* of the closure being called. We
|
// `fn_sig` is the *signature* of the closure being called. We
|
||||||
|
@ -555,7 +556,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
arg_exprs,
|
arg_exprs,
|
||||||
fn_sig.c_variadic,
|
fn_sig.c_variadic,
|
||||||
TupleArgumentsFlag::TupleArguments,
|
TupleArgumentsFlag::TupleArguments,
|
||||||
None,
|
Some(closure_def_id),
|
||||||
);
|
);
|
||||||
|
|
||||||
fn_sig.output()
|
fn_sig.output()
|
||||||
|
|
|
@ -24,7 +24,7 @@ use rustc_infer::infer::TypeTrace;
|
||||||
use rustc_middle::ty::adjustment::AllowTwoPhase;
|
use rustc_middle::ty::adjustment::AllowTwoPhase;
|
||||||
use rustc_middle::ty::error::TypeError;
|
use rustc_middle::ty::error::TypeError;
|
||||||
use rustc_middle::ty::fold::TypeFoldable;
|
use rustc_middle::ty::fold::TypeFoldable;
|
||||||
use rustc_middle::ty::{self, Ty};
|
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use rustc_span::symbol::Ident;
|
use rustc_span::symbol::Ident;
|
||||||
use rustc_span::{self, Span};
|
use rustc_span::{self, Span};
|
||||||
|
@ -394,6 +394,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
break 'errors;
|
break 'errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.set_tainted_by_errors();
|
||||||
|
|
||||||
// The algorithm here is inspired by levenshtein distance and longest common subsequence.
|
// The algorithm here is inspired by levenshtein distance and longest common subsequence.
|
||||||
// We'll try to detect 4 different types of mistakes:
|
// We'll try to detect 4 different types of mistakes:
|
||||||
// - An extra parameter has been provided that doesn't satisfy *any* of the other inputs
|
// - An extra parameter has been provided that doesn't satisfy *any* of the other inputs
|
||||||
|
@ -502,6 +504,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
TupleMatchFound::Single => {
|
TupleMatchFound::Single => {
|
||||||
let expected_ty = expected_input_tys[0];
|
let expected_ty = expected_input_tys[0];
|
||||||
let provided_ty = final_arg_types[0].map(|ty| ty.0).unwrap();
|
let provided_ty = final_arg_types[0].map(|ty| ty.0).unwrap();
|
||||||
|
let expected_ty = self.resolve_vars_if_possible(expected_ty);
|
||||||
|
let provided_ty = self.resolve_vars_if_possible(provided_ty);
|
||||||
let cause = &self.misc(provided_args[0].span);
|
let cause = &self.misc(provided_args[0].span);
|
||||||
let compatibility = demand_compatible(0, &mut final_arg_types);
|
let compatibility = demand_compatible(0, &mut final_arg_types);
|
||||||
let type_error = match compatibility {
|
let type_error = match compatibility {
|
||||||
|
@ -523,24 +527,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
format!("arguments to this {} are incorrect", call_name),
|
format!("arguments to this {} are incorrect", call_name),
|
||||||
);
|
);
|
||||||
// Call out where the function is defined
|
// Call out where the function is defined
|
||||||
if let Some(def_id) = fn_def_id && let Some(def_span) = tcx.def_ident_span(def_id) {
|
label_fn_like(tcx, &mut err, fn_def_id);
|
||||||
let mut spans: MultiSpan = def_span.into();
|
|
||||||
|
|
||||||
let params = tcx
|
|
||||||
.hir()
|
|
||||||
.get_if_local(def_id)
|
|
||||||
.and_then(|node| node.body_id())
|
|
||||||
.into_iter()
|
|
||||||
.map(|id| tcx.hir().body(id).params)
|
|
||||||
.flatten();
|
|
||||||
|
|
||||||
for param in params {
|
|
||||||
spans.push_span_label(param.span, String::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
let def_kind = tcx.def_kind(def_id);
|
|
||||||
err.span_note(spans, &format!("{} defined here", def_kind.descr(def_id)));
|
|
||||||
}
|
|
||||||
err.emit();
|
err.emit();
|
||||||
break 'errors;
|
break 'errors;
|
||||||
}
|
}
|
||||||
|
@ -558,24 +545,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
DiagnosticId::Error(err_code.to_owned()),
|
DiagnosticId::Error(err_code.to_owned()),
|
||||||
);
|
);
|
||||||
// Call out where the function is defined
|
// Call out where the function is defined
|
||||||
if let Some(def_id) = fn_def_id && let Some(def_span) = tcx.def_ident_span(def_id) {
|
label_fn_like(tcx, &mut err, fn_def_id);
|
||||||
let mut spans: MultiSpan = def_span.into();
|
|
||||||
|
|
||||||
let params = tcx
|
|
||||||
.hir()
|
|
||||||
.get_if_local(def_id)
|
|
||||||
.and_then(|node| node.body_id())
|
|
||||||
.into_iter()
|
|
||||||
.map(|id| tcx.hir().body(id).params)
|
|
||||||
.flatten();
|
|
||||||
|
|
||||||
for param in params {
|
|
||||||
spans.push_span_label(param.span, String::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
let def_kind = tcx.def_kind(def_id);
|
|
||||||
err.span_note(spans, &format!("{} defined here", def_kind.descr(def_id)));
|
|
||||||
}
|
|
||||||
err.multipart_suggestion(
|
err.multipart_suggestion(
|
||||||
"use parentheses to construct a tuple",
|
"use parentheses to construct a tuple",
|
||||||
vec![(start, '('.to_string()), (end, ')'.to_string())],
|
vec![(start, '('.to_string()), (end, ')'.to_string())],
|
||||||
|
@ -597,13 +567,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
{
|
{
|
||||||
let expected_ty = expected_input_tys[*input_idx];
|
let expected_ty = expected_input_tys[*input_idx];
|
||||||
let provided_ty = final_arg_types[*input_idx].map(|ty| ty.0).unwrap();
|
let provided_ty = final_arg_types[*input_idx].map(|ty| ty.0).unwrap();
|
||||||
|
let expected_ty = self.resolve_vars_if_possible(expected_ty);
|
||||||
|
let provided_ty = self.resolve_vars_if_possible(provided_ty);
|
||||||
let cause = &self.misc(provided_args[*input_idx].span);
|
let cause = &self.misc(provided_args[*input_idx].span);
|
||||||
let trace = TypeTrace::types(cause, true, expected_ty, provided_ty);
|
let trace = TypeTrace::types(cause, true, expected_ty, provided_ty);
|
||||||
let mut err = self.report_and_explain_type_error(trace, error);
|
let mut err = self.report_and_explain_type_error(trace, error);
|
||||||
self.emit_coerce_suggestions(
|
self.emit_coerce_suggestions(
|
||||||
&mut err,
|
&mut err,
|
||||||
&provided_args[*input_idx],
|
&provided_args[*input_idx],
|
||||||
final_arg_types[*input_idx].map(|ty| ty.0).unwrap(),
|
provided_ty,
|
||||||
final_arg_types[*input_idx].map(|ty| ty.1).unwrap(),
|
final_arg_types[*input_idx].map(|ty| ty.1).unwrap(),
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
@ -613,24 +585,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
format!("arguments to this {} are incorrect", call_name),
|
format!("arguments to this {} are incorrect", call_name),
|
||||||
);
|
);
|
||||||
// Call out where the function is defined
|
// Call out where the function is defined
|
||||||
if let Some(def_id) = fn_def_id && let Some(def_span) = tcx.def_ident_span(def_id) {
|
label_fn_like(tcx, &mut err, fn_def_id);
|
||||||
let mut spans: MultiSpan = def_span.into();
|
|
||||||
|
|
||||||
let params = tcx
|
|
||||||
.hir()
|
|
||||||
.get_if_local(def_id)
|
|
||||||
.and_then(|node| node.body_id())
|
|
||||||
.into_iter()
|
|
||||||
.map(|id| tcx.hir().body(id).params)
|
|
||||||
.flatten();
|
|
||||||
|
|
||||||
for param in params {
|
|
||||||
spans.push_span_label(param.span, String::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
let def_kind = tcx.def_kind(def_id);
|
|
||||||
err.span_note(spans, &format!("{} defined here", def_kind.descr(def_id)));
|
|
||||||
}
|
|
||||||
err.emit();
|
err.emit();
|
||||||
break 'errors;
|
break 'errors;
|
||||||
}
|
}
|
||||||
|
@ -678,12 +633,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
match error {
|
match error {
|
||||||
Error::Invalid(input_idx, compatibility) => {
|
Error::Invalid(input_idx, compatibility) => {
|
||||||
let expected_ty = expected_input_tys[input_idx];
|
let expected_ty = expected_input_tys[input_idx];
|
||||||
if let Compatibility::Incompatible(error) = &compatibility {
|
|
||||||
let provided_ty = final_arg_types
|
let provided_ty = final_arg_types
|
||||||
.get(input_idx)
|
.get(input_idx)
|
||||||
.and_then(|x| x.as_ref())
|
.and_then(|x| x.as_ref())
|
||||||
.map(|ty| ty.0)
|
.map(|ty| ty.0)
|
||||||
.unwrap_or(tcx.ty_error());
|
.unwrap_or(tcx.ty_error());
|
||||||
|
let expected_ty = self.resolve_vars_if_possible(expected_ty);
|
||||||
|
let provided_ty = self.resolve_vars_if_possible(provided_ty);
|
||||||
|
if let Compatibility::Incompatible(error) = &compatibility {
|
||||||
let cause = &self.misc(
|
let cause = &self.misc(
|
||||||
provided_args.get(input_idx).map(|i| i.span).unwrap_or(call_span),
|
provided_args.get(input_idx).map(|i| i.span).unwrap_or(call_span),
|
||||||
);
|
);
|
||||||
|
@ -948,24 +905,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call out where the function is defined
|
// Call out where the function is defined
|
||||||
if let Some(def_id) = fn_def_id && let Some(def_span) = tcx.def_ident_span(def_id) {
|
label_fn_like(tcx, &mut err, fn_def_id);
|
||||||
let mut spans: MultiSpan = def_span.into();
|
|
||||||
|
|
||||||
let params = tcx
|
|
||||||
.hir()
|
|
||||||
.get_if_local(def_id)
|
|
||||||
.and_then(|node| node.body_id())
|
|
||||||
.into_iter()
|
|
||||||
.flat_map(|id| tcx.hir().body(id).params)
|
|
||||||
;
|
|
||||||
|
|
||||||
for param in params {
|
|
||||||
spans.push_span_label(param.span, String::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
let def_kind = tcx.def_kind(def_id);
|
|
||||||
err.span_note(spans, &format!("{} defined here", def_kind.descr(def_id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// And add a suggestion block for all of the parameters
|
// And add a suggestion block for all of the parameters
|
||||||
let suggestion_text = match suggestion_text {
|
let suggestion_text = match suggestion_text {
|
||||||
|
@ -1790,3 +1730,47 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn label_fn_like<'tcx>(
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
|
err: &mut rustc_errors::DiagnosticBuilder<'tcx, rustc_errors::ErrorGuaranteed>,
|
||||||
|
def_id: Option<DefId>,
|
||||||
|
) {
|
||||||
|
let Some(def_id) = def_id else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Some(def_span) = tcx.def_ident_span(def_id) {
|
||||||
|
let mut spans: MultiSpan = def_span.into();
|
||||||
|
|
||||||
|
let params = tcx
|
||||||
|
.hir()
|
||||||
|
.get_if_local(def_id)
|
||||||
|
.and_then(|node| node.body_id())
|
||||||
|
.into_iter()
|
||||||
|
.map(|id| tcx.hir().body(id).params)
|
||||||
|
.flatten();
|
||||||
|
|
||||||
|
for param in params {
|
||||||
|
spans.push_span_label(param.span, String::new());
|
||||||
|
}
|
||||||
|
|
||||||
|
let def_kind = tcx.def_kind(def_id);
|
||||||
|
err.span_note(spans, &format!("{} defined here", def_kind.descr(def_id)));
|
||||||
|
} else {
|
||||||
|
match tcx.hir().get_if_local(def_id) {
|
||||||
|
Some(hir::Node::Expr(hir::Expr {
|
||||||
|
kind: hir::ExprKind::Closure(_, _, _, span, ..),
|
||||||
|
..
|
||||||
|
})) => {
|
||||||
|
let spans: MultiSpan = (*span).into();
|
||||||
|
|
||||||
|
// Note: We don't point to param spans here because they overlap
|
||||||
|
// with the closure span itself
|
||||||
|
|
||||||
|
err.span_note(spans, "closure defined here");
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -22,4 +22,7 @@ fn main() {
|
||||||
missing(); //~ ERROR this function takes
|
missing(); //~ ERROR this function takes
|
||||||
swapped("", 1); //~ ERROR arguments to this function are incorrect
|
swapped("", 1); //~ ERROR arguments to this function are incorrect
|
||||||
permuted(Y {}, Z {}, X {}); //~ ERROR arguments to this function are incorrect
|
permuted(Y {}, Z {}, X {}); //~ ERROR arguments to this function are incorrect
|
||||||
|
|
||||||
|
let closure = |x| x;
|
||||||
|
closure(); //~ ERROR this function takes
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,23 @@ help: reorder these arguments
|
||||||
LL | permuted(X {}, Y {}, Z {});
|
LL | permuted(X {}, Y {}, Z {});
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error[E0057]: this function takes 1 argument but 0 arguments were supplied
|
||||||
|
--> $DIR/basic.rs:27:5
|
||||||
|
|
|
||||||
|
LL | closure();
|
||||||
|
| ^^^^^^^-- an argument is missing
|
||||||
|
|
|
||||||
|
note: closure defined here
|
||||||
|
--> $DIR/basic.rs:26:19
|
||||||
|
|
|
||||||
|
LL | let closure = |x| x;
|
||||||
|
| ^^^
|
||||||
|
help: provide the argument
|
||||||
|
|
|
||||||
|
LL | closure({_});
|
||||||
|
| ~~~~~~~~~~~~
|
||||||
|
|
||||||
Some errors have detailed explanations: E0061, E0308.
|
error: aborting due to 6 previous errors
|
||||||
For more information about an error, try `rustc --explain E0061`.
|
|
||||||
|
Some errors have detailed explanations: E0057, E0061, E0308.
|
||||||
|
For more information about an error, try `rustc --explain E0057`.
|
||||||
|
|
|
@ -13,7 +13,7 @@ note: expected this to be `Option<T>`
|
||||||
LL | type Item = T;
|
LL | type Item = T;
|
||||||
| ^
|
| ^
|
||||||
= note: expected enum `Option<T>`
|
= note: expected enum `Option<T>`
|
||||||
found type `T`
|
found type parameter `T`
|
||||||
note: required by a bound in `is_iterator_of`
|
note: required by a bound in `is_iterator_of`
|
||||||
--> $DIR/associated-types-issue-20346.rs:15:34
|
--> $DIR/associated-types-issue-20346.rs:15:34
|
||||||
|
|
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | foo(());
|
||||||
| ^^^ lifetime mismatch
|
| ^^^ lifetime mismatch
|
||||||
|
|
|
|
||||||
= note: expected reference `&'a ()`
|
= note: expected reference `&'a ()`
|
||||||
found type `&()`
|
found reference `&()`
|
||||||
note: the lifetime requirement is introduced here
|
note: the lifetime requirement is introduced here
|
||||||
--> $DIR/higher-ranked-projection.rs:15:33
|
--> $DIR/higher-ranked-projection.rs:15:33
|
||||||
|
|
|
|
||||||
|
|
|
@ -24,12 +24,17 @@ LL | fun(one(), two());
|
||||||
| |
|
| |
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
|
note: while checking the return type of the `async fn`
|
||||||
|
--> $DIR/generator-desc.rs:5:16
|
||||||
|
|
|
||||||
|
LL | async fn one() {}
|
||||||
|
| ^ checked the `Output` of this `async fn`, expected opaque type
|
||||||
note: while checking the return type of the `async fn`
|
note: while checking the return type of the `async fn`
|
||||||
--> $DIR/generator-desc.rs:6:16
|
--> $DIR/generator-desc.rs:6:16
|
||||||
|
|
|
|
||||||
LL | async fn two() {}
|
LL | async fn two() {}
|
||||||
| ^ checked the `Output` of this `async fn`, found opaque type
|
| ^ checked the `Output` of this `async fn`, found opaque type
|
||||||
= note: expected type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:5:16>)
|
= note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:5:16>)
|
||||||
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:6:16>)
|
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/generator-desc.rs:6:16>)
|
||||||
= help: consider `await`ing on both `Future`s
|
= help: consider `await`ing on both `Future`s
|
||||||
= note: distinct uses of `impl Trait` result in different opaque types
|
= note: distinct uses of `impl Trait` result in different opaque types
|
||||||
|
@ -43,26 +48,26 @@ error[E0308]: mismatched types
|
||||||
--> $DIR/generator-desc.rs:14:26
|
--> $DIR/generator-desc.rs:14:26
|
||||||
|
|
|
|
||||||
LL | fun((async || {})(), (async || {})());
|
LL | fun((async || {})(), (async || {})());
|
||||||
| --- ^^^^^^^^^^^^^^^ expected `async` closure body, found a different `async` closure body
|
| --- -- ^^^^^^^^^^^^^^^ expected `async` closure body, found a different `async` closure body
|
||||||
| |
|
| | |
|
||||||
|
| | the expected `async` closure body
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
|
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
|
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
|
||||||
| ------------------------------- the found opaque type
|
| -------------------------------
|
||||||
|
| |
|
||||||
|
| the expected opaque type
|
||||||
|
| the found opaque type
|
||||||
|
|
|
|
||||||
= note: expected type `impl Future<Output = ()>` (`async` closure body)
|
= note: expected opaque type `impl Future<Output = ()>` (`async` closure body)
|
||||||
found opaque type `impl Future<Output = ()>` (`async` closure body)
|
found opaque type `impl Future<Output = ()>` (`async` closure body)
|
||||||
note: function defined here
|
note: function defined here
|
||||||
--> $DIR/generator-desc.rs:8:4
|
--> $DIR/generator-desc.rs:8:4
|
||||||
|
|
|
|
||||||
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
|
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
|
||||||
| ^^^ ----- -----
|
| ^^^ ----- -----
|
||||||
help: consider `await`ing on the `Future`
|
|
||||||
|
|
|
||||||
LL | fun((async || {})(), (async || {})().await);
|
|
||||||
| ++++++
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,12 @@ LL | |
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____- `if` and `else` have incompatible types
|
| |_____- `if` and `else` have incompatible types
|
||||||
|
|
|
|
||||||
= note: expected type `impl Future<Output = ()>`
|
note: while checking the return type of the `async fn`
|
||||||
|
--> $DIR/suggest-missing-await.rs:18:18
|
||||||
|
|
|
||||||
|
LL | async fn dummy() {}
|
||||||
|
| ^ checked the `Output` of this `async fn`, expected opaque type
|
||||||
|
= note: expected opaque type `impl Future<Output = ()>`
|
||||||
found unit type `()`
|
found unit type `()`
|
||||||
help: consider `await`ing on the `Future`
|
help: consider `await`ing on the `Future`
|
||||||
|
|
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as immutable
|
|
||||||
--> $DIR/suggest-local-var-imm-and-mut.rs:12:22
|
|
||||||
|
|
|
||||||
LL | self.foo(self.bar());
|
|
||||||
| ---------^^^^^^^^^^-
|
|
||||||
| | | |
|
|
||||||
| | | mutable borrow occurs here
|
|
||||||
| | immutable borrow later used by call
|
|
||||||
| immutable borrow occurs here
|
|
||||||
|
|
||||||
error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as immutable
|
|
||||||
--> $DIR/suggest-local-var-imm-and-mut.rs:24:29
|
|
||||||
|
|
|
||||||
LL | Self::foo(self, Self::bar(self));
|
|
||||||
| --------- ---- ^^^^^^^^^^^^^^^ mutable borrow occurs here
|
|
||||||
| | |
|
|
||||||
| | immutable borrow occurs here
|
|
||||||
| immutable borrow later used by call
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0502`.
|
|
|
@ -11,7 +11,7 @@ LL | | _ => unimplemented!(),
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____- `match` arms have incompatible types
|
| |_____- `match` arms have incompatible types
|
||||||
|
|
|
|
||||||
= note: expected type `fn(i32, i32) -> i32 {add}`
|
= note: expected fn item `fn(i32, i32) -> i32 {add}`
|
||||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:43]`
|
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:43]`
|
||||||
|
|
||||||
error[E0308]: `match` arms have incompatible types
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
@ -20,14 +20,17 @@ error[E0308]: `match` arms have incompatible types
|
||||||
LL | let _ = match "+" {
|
LL | let _ = match "+" {
|
||||||
| _____________-
|
| _____________-
|
||||||
LL | | "+" => |a, b| (a + b) as i32,
|
LL | | "+" => |a, b| (a + b) as i32,
|
||||||
| | --------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:37]`
|
| | ---------------------
|
||||||
|
| | |
|
||||||
|
| | the expected closure
|
||||||
|
| | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:37]`
|
||||||
LL | | "-" => |a, b| (a - b + cap) as i32,
|
LL | | "-" => |a, b| (a - b + cap) as i32,
|
||||||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
||||||
LL | | _ => unimplemented!(),
|
LL | | _ => unimplemented!(),
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____- `match` arms have incompatible types
|
| |_____- `match` arms have incompatible types
|
||||||
|
|
|
|
||||||
= note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:37]`
|
= note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:37]`
|
||||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:43]`
|
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:43]`
|
||||||
= note: no two closures, even if identical, have the same type
|
= note: no two closures, even if identical, have the same type
|
||||||
= help: consider boxing your closure and/or using it as a trait object
|
= help: consider boxing your closure and/or using it as a trait object
|
||||||
|
@ -38,14 +41,17 @@ error[E0308]: `match` arms have incompatible types
|
||||||
LL | let _ = match "+" {
|
LL | let _ = match "+" {
|
||||||
| _____________-
|
| _____________-
|
||||||
LL | | "+" => |a, b| (a + b + cap) as i32,
|
LL | | "+" => |a, b| (a + b + cap) as i32,
|
||||||
| | --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43]`
|
| | ---------------------------
|
||||||
|
| | |
|
||||||
|
| | the expected closure
|
||||||
|
| | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43]`
|
||||||
LL | | "-" => |a, b| (a - b) as i32,
|
LL | | "-" => |a, b| (a - b) as i32,
|
||||||
| | ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
| | ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
||||||
LL | | _ => unimplemented!(),
|
LL | | _ => unimplemented!(),
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____- `match` arms have incompatible types
|
| |_____- `match` arms have incompatible types
|
||||||
|
|
|
|
||||||
= note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43]`
|
= note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43]`
|
||||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:37]`
|
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:37]`
|
||||||
= note: no two closures, even if identical, have the same type
|
= note: no two closures, even if identical, have the same type
|
||||||
= help: consider boxing your closure and/or using it as a trait object
|
= help: consider boxing your closure and/or using it as a trait object
|
||||||
|
@ -56,14 +62,17 @@ error[E0308]: `match` arms have incompatible types
|
||||||
LL | let _ = match "+" {
|
LL | let _ = match "+" {
|
||||||
| _____________-
|
| _____________-
|
||||||
LL | | "+" => |a, b| (a + b + cap) as i32,
|
LL | | "+" => |a, b| (a + b + cap) as i32,
|
||||||
| | --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43]`
|
| | ---------------------------
|
||||||
|
| | |
|
||||||
|
| | the expected closure
|
||||||
|
| | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43]`
|
||||||
LL | | "-" => |a, b| (a - b + cap) as i32,
|
LL | | "-" => |a, b| (a - b + cap) as i32,
|
||||||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
||||||
LL | | _ => unimplemented!(),
|
LL | | _ => unimplemented!(),
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____- `match` arms have incompatible types
|
| |_____- `match` arms have incompatible types
|
||||||
|
|
|
|
||||||
= note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43]`
|
= note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43]`
|
||||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:43]`
|
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:43]`
|
||||||
= note: no two closures, even if identical, have the same type
|
= note: no two closures, even if identical, have the same type
|
||||||
= help: consider boxing your closure and/or using it as a trait object
|
= help: consider boxing your closure and/or using it as a trait object
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | test(&mut 7, &7);
|
||||||
| |
|
| |
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
= note: expected type `&mut {integer}`
|
= note: expected mutable reference `&mut {integer}`
|
||||||
found reference `&{integer}`
|
found reference `&{integer}`
|
||||||
note: function defined here
|
note: function defined here
|
||||||
--> $DIR/coerce-reborrow-multi-arg-fail.rs:1:4
|
--> $DIR/coerce-reborrow-multi-arg-fail.rs:1:4
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
error[E0308]: arguments to this function are incorrect
|
|
||||||
--> $DIR/const-argument-cross-crate-mismatch.rs:7:41
|
|
||||||
|
|
|
||||||
LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8]));
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^----------^
|
|
||||||
| |
|
|
||||||
| expected `[u8; 3]`, found `[u8; 2]`
|
|
||||||
|
|
|
||||||
help: provide an argument of the correct type
|
|
||||||
|
|
|
||||||
LL | let _ = const_generic_lib::function(({[u8; 3]}));
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0308]: arguments to this function are incorrect
|
|
||||||
--> $DIR/const-argument-cross-crate-mismatch.rs:9:39
|
|
||||||
|
|
|
||||||
LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]);
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^
|
|
||||||
| |
|
|
||||||
| expected `[u8; 2]`, found `[u8; 3]`
|
|
||||||
|
|
|
||||||
help: provide an argument of the correct type
|
|
||||||
|
|
|
||||||
LL | let _: const_generic_lib::Alias = ({[u8; 2]});
|
|
||||||
| ^^^^^^^^^^^
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0308`.
|
|
|
@ -6,7 +6,7 @@ LL | (x, y) = &(1, 2);
|
||||||
| |
|
| |
|
||||||
| expected reference, found tuple
|
| expected reference, found tuple
|
||||||
|
|
|
|
||||||
= note: expected type `&({integer}, {integer})`
|
= note: expected reference `&({integer}, {integer})`
|
||||||
found tuple `(_, _)`
|
found tuple `(_, _)`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
|
@ -14,7 +14,7 @@ LL | (a, a, b) = (1, 2);
|
||||||
| |
|
| |
|
||||||
| expected a tuple with 2 elements, found one with 3 elements
|
| expected a tuple with 2 elements, found one with 3 elements
|
||||||
|
|
|
|
||||||
= note: expected type `({integer}, {integer})`
|
= note: expected tuple `({integer}, {integer})`
|
||||||
found tuple `(_, _, _)`
|
found tuple `(_, _, _)`
|
||||||
|
|
||||||
error[E0070]: invalid left-hand side of assignment
|
error[E0070]: invalid left-hand side of assignment
|
||||||
|
@ -33,7 +33,7 @@ LL | (_,) = (1, 2);
|
||||||
| |
|
| |
|
||||||
| expected a tuple with 2 elements, found one with 1 element
|
| expected a tuple with 2 elements, found one with 1 element
|
||||||
|
|
|
|
||||||
= note: expected type `({integer}, {integer})`
|
= note: expected tuple `({integer}, {integer})`
|
||||||
found tuple `(_,)`
|
found tuple `(_,)`
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
|
@ -4,6 +4,11 @@ error[E0057]: this function takes 1 argument but 0 arguments were supplied
|
||||||
LL | let a = f();
|
LL | let a = f();
|
||||||
| ^-- an argument is missing
|
| ^-- an argument is missing
|
||||||
|
|
|
|
||||||
|
note: closure defined here
|
||||||
|
--> $DIR/E0057.rs:2:13
|
||||||
|
|
|
||||||
|
LL | let f = |x| x * 3;
|
||||||
|
| ^^^
|
||||||
help: provide the argument
|
help: provide the argument
|
||||||
|
|
|
|
||||||
LL | let a = f({_});
|
LL | let a = f({_});
|
||||||
|
@ -15,6 +20,11 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied
|
||||||
LL | let c = f(2, 3);
|
LL | let c = f(2, 3);
|
||||||
| ^ - argument unexpected
|
| ^ - argument unexpected
|
||||||
|
|
|
|
||||||
|
note: closure defined here
|
||||||
|
--> $DIR/E0057.rs:2:13
|
||||||
|
|
|
||||||
|
LL | let f = |x| x * 3;
|
||||||
|
| ^^^
|
||||||
help: remove the extra argument
|
help: remove the extra argument
|
||||||
|
|
|
|
||||||
LL | let c = f(2);
|
LL | let c = f(2);
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immutable
|
|
||||||
--> $DIR/E0502.rs:4:5
|
|
||||||
|
|
|
||||||
LL | let ref y = a;
|
|
||||||
| ----- immutable borrow occurs here
|
|
||||||
LL | bar(a);
|
|
||||||
| ^^^^^^ mutable borrow occurs here
|
|
||||||
LL | y.use_ref();
|
|
||||||
| ----------- immutable borrow later used here
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0502`.
|
|
|
@ -1,15 +0,0 @@
|
||||||
fn wants_uniq(x: String) { }
|
|
||||||
fn wants_slice(x: &str) { }
|
|
||||||
|
|
||||||
fn has_uniq(x: String) {
|
|
||||||
wants_uniq(x);
|
|
||||||
wants_slice(&*x);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn has_slice(x: &str) {
|
|
||||||
wants_uniq(x); //~ ERROR mismatched types
|
|
||||||
wants_slice(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
error[E0308]: mismatched types
|
|
||||||
--> $DIR/estr-subtyping.rs:10:15
|
|
||||||
|
|
|
||||||
LL | wants_uniq(x);
|
|
||||||
| ---------- ^- help: try using a conversion method: `.to_string()`
|
|
||||||
| | |
|
|
||||||
| | expected struct `String`, found `&str`
|
|
||||||
| arguments to this function are incorrect
|
|
||||||
|
|
|
||||||
note: function defined here
|
|
||||||
--> $DIR/estr-subtyping.rs:1:4
|
|
||||||
|
|
|
||||||
LL | fn wants_uniq(x: String) { }
|
|
||||||
| ^^^^^^^^^^ ---------
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0308`.
|
|
|
@ -12,7 +12,7 @@ impl<T> Foo for T { /* `foo` is still default here */ }
|
||||||
fn main() {
|
fn main() {
|
||||||
eq(foo::<u8>, bar::<u8>);
|
eq(foo::<u8>, bar::<u8>);
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `fn(_) -> _ {foo::<u8>}`
|
//~| expected fn item `fn(_) -> _ {foo::<u8>}`
|
||||||
//~| found fn item `fn(_) -> _ {bar::<u8>}`
|
//~| found fn item `fn(_) -> _ {bar::<u8>}`
|
||||||
//~| expected fn item, found a different fn item
|
//~| expected fn item, found a different fn item
|
||||||
//~| different `fn` items always have unique types, even if their signatures are the same
|
//~| different `fn` items always have unique types, even if their signatures are the same
|
||||||
|
@ -28,7 +28,6 @@ fn main() {
|
||||||
|
|
||||||
eq(bar::<String>, bar::<Vec<u8>>);
|
eq(bar::<String>, bar::<Vec<u8>>);
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `fn(_) -> _ {bar::<String>}`
|
|
||||||
//~| found fn item `fn(_) -> _ {bar::<Vec<u8>>}`
|
//~| found fn item `fn(_) -> _ {bar::<Vec<u8>>}`
|
||||||
//~| expected struct `String`, found struct `Vec`
|
//~| expected struct `String`, found struct `Vec`
|
||||||
//~| different `fn` items always have unique types, even if their signatures are the same
|
//~| different `fn` items always have unique types, even if their signatures are the same
|
||||||
|
@ -45,7 +44,6 @@ fn main() {
|
||||||
|
|
||||||
eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
|
eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| expected type `fn(_) -> _ {foo::<u8>}`
|
|
||||||
//~| found fn pointer `fn(_) -> _`
|
//~| found fn pointer `fn(_) -> _`
|
||||||
//~| expected fn item, found fn pointer
|
//~| expected fn item, found fn pointer
|
||||||
//~| change the expected type to be function pointer
|
//~| change the expected type to be function pointer
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | eq(foo::<u8>, bar::<u8>);
|
||||||
| |
|
| |
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
= note: expected type `fn(_) -> _ {foo::<u8>}`
|
= note: expected fn item `fn(_) -> _ {foo::<u8>}`
|
||||||
found fn item `fn(_) -> _ {bar::<u8>}`
|
found fn item `fn(_) -> _ {bar::<u8>}`
|
||||||
= note: different `fn` items always have unique types, even if their signatures are the same
|
= note: different `fn` items always have unique types, even if their signatures are the same
|
||||||
= help: change the expected type to be function pointer `fn(isize) -> isize`
|
= help: change the expected type to be function pointer `fn(isize) -> isize`
|
||||||
|
@ -25,7 +25,7 @@ LL | eq(foo::<u8>, foo::<i8>);
|
||||||
| |
|
| |
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
= note: expected type `fn(_) -> _ {foo::<u8>}`
|
= note: expected fn item `fn(_) -> _ {foo::<u8>}`
|
||||||
found fn item `fn(_) -> _ {foo::<i8>}`
|
found fn item `fn(_) -> _ {foo::<i8>}`
|
||||||
= note: different `fn` items always have unique types, even if their signatures are the same
|
= note: different `fn` items always have unique types, even if their signatures are the same
|
||||||
= help: change the expected type to be function pointer `fn(isize) -> isize`
|
= help: change the expected type to be function pointer `fn(isize) -> isize`
|
||||||
|
@ -44,7 +44,7 @@ LL | eq(bar::<String>, bar::<Vec<u8>>);
|
||||||
| |
|
| |
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
= note: expected type `fn(_) -> _ {bar::<String>}`
|
= note: expected fn item `fn(_) -> _ {bar::<String>}`
|
||||||
found fn item `fn(_) -> _ {bar::<Vec<u8>>}`
|
found fn item `fn(_) -> _ {bar::<Vec<u8>>}`
|
||||||
= note: different `fn` items always have unique types, even if their signatures are the same
|
= note: different `fn` items always have unique types, even if their signatures are the same
|
||||||
= help: change the expected type to be function pointer `fn(isize) -> isize`
|
= help: change the expected type to be function pointer `fn(isize) -> isize`
|
||||||
|
@ -56,14 +56,14 @@ LL | fn eq<T>(x: T, y: T) { }
|
||||||
| ^^ ---- ----
|
| ^^ ---- ----
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/fn-item-type.rs:39:26
|
--> $DIR/fn-item-type.rs:38:26
|
||||||
|
|
|
|
||||||
LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
|
LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
|
||||||
| -- ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
|
| -- ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
|
||||||
| |
|
| |
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
= note: expected type `fn() {<u8 as Foo>::foo}`
|
= note: expected fn item `fn() {<u8 as Foo>::foo}`
|
||||||
found fn item `fn() {<u16 as Foo>::foo}`
|
found fn item `fn() {<u16 as Foo>::foo}`
|
||||||
= note: different `fn` items always have unique types, even if their signatures are the same
|
= note: different `fn` items always have unique types, even if their signatures are the same
|
||||||
= help: change the expected type to be function pointer `fn()`
|
= help: change the expected type to be function pointer `fn()`
|
||||||
|
@ -75,14 +75,14 @@ LL | fn eq<T>(x: T, y: T) { }
|
||||||
| ^^ ---- ----
|
| ^^ ---- ----
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/fn-item-type.rs:46:19
|
--> $DIR/fn-item-type.rs:45:19
|
||||||
|
|
|
|
||||||
LL | eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
|
LL | eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
|
||||||
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found fn pointer
|
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found fn pointer
|
||||||
| |
|
| |
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
= note: expected type `fn(_) -> _ {foo::<u8>}`
|
= note: expected fn item `fn(_) -> _ {foo::<u8>}`
|
||||||
found fn pointer `fn(_) -> _`
|
found fn pointer `fn(_) -> _`
|
||||||
= help: change the expected type to be function pointer `fn(isize) -> isize`
|
= help: change the expected type to be function pointer `fn(isize) -> isize`
|
||||||
= help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
|
= help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||||
LL | 5
|
LL | 5
|
||||||
| ^ expected enum `Result`, found integer
|
| ^ expected enum `Result`, found integer
|
||||||
|
|
|
|
||||||
= note: expected type `Result<{integer}, _>`
|
= note: expected enum `Result<{integer}, _>`
|
||||||
found type `{integer}`
|
found type `{integer}`
|
||||||
note: return type inferred to be `Result<{integer}, _>` here
|
note: return type inferred to be `Result<{integer}, _>` here
|
||||||
--> $DIR/type-mismatch-signature-deduction.rs:9:20
|
--> $DIR/type-mismatch-signature-deduction.rs:9:20
|
||||||
|
|
|
@ -21,6 +21,10 @@ note: function defined here
|
||||||
|
|
|
|
||||||
LL | fn bar<T>(_: T) {}
|
LL | fn bar<T>(_: T) {}
|
||||||
| ^^^ ----
|
| ^^^ ----
|
||||||
|
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
|
||||||
|
|
|
||||||
|
LL | bar::<isize>(i.try_into().unwrap()); // i should not be re-coerced back to an isize
|
||||||
|
| ++++++++++++++++++++
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@ note: function defined here
|
||||||
|
|
|
|
||||||
LL | fn foo(_s: i16) { }
|
LL | fn foo(_s: i16) { }
|
||||||
| ^^^ -------
|
| ^^^ -------
|
||||||
|
help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
|
||||||
|
|
|
||||||
|
LL | foo((1*(1 as isize)).try_into().unwrap());
|
||||||
|
| + +++++++++++++++++++++
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/issue-13359.rs:10:9
|
--> $DIR/issue-13359.rs:10:9
|
||||||
|
@ -25,6 +29,10 @@ note: function defined here
|
||||||
|
|
|
|
||||||
LL | fn bar(_s: u32) { }
|
LL | fn bar(_s: u32) { }
|
||||||
| ^^^ -------
|
| ^^^ -------
|
||||||
|
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
||||||
|
|
|
||||||
|
LL | bar((1*(1 as usize)).try_into().unwrap());
|
||||||
|
| + +++++++++++++++++++++
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | let Some(x) = Some(1) else { Some(2) };
|
||||||
| ^^^^^^^^^^^ expected `!`, found enum `Option`
|
| ^^^^^^^^^^^ expected `!`, found enum `Option`
|
||||||
|
|
|
|
||||||
= note: expected type `!`
|
= note: expected type `!`
|
||||||
found type `Option<{integer}>`
|
found enum `Option<{integer}>`
|
||||||
= help: try adding a diverging expression, such as `return` or `panic!(..)`
|
= help: try adding a diverging expression, such as `return` or `panic!(..)`
|
||||||
= help: ...or use `match` instead of `let...else`
|
= help: ...or use `match` instead of `let...else`
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ LL | | };
|
||||||
| |_____^ expected `!`, found `()`
|
| |_____^ expected `!`, found `()`
|
||||||
|
|
|
|
||||||
= note: expected type `!`
|
= note: expected type `!`
|
||||||
found type `()`
|
found unit type `()`
|
||||||
= help: try adding a diverging expression, such as `return` or `panic!(..)`
|
= help: try adding a diverging expression, such as `return` or `panic!(..)`
|
||||||
= help: ...or use `match` instead of `let...else`
|
= help: ...or use `match` instead of `let...else`
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ LL | | };
|
||||||
| |_____^ expected `!`, found enum `Option`
|
| |_____^ expected `!`, found enum `Option`
|
||||||
|
|
|
|
||||||
= note: expected type `!`
|
= note: expected type `!`
|
||||||
found type `Option<{integer}>`
|
found enum `Option<{integer}>`
|
||||||
= help: try adding a diverging expression, such as `return` or `panic!(..)`
|
= help: try adding a diverging expression, such as `return` or `panic!(..)`
|
||||||
= help: ...or use `match` instead of `let...else`
|
= help: ...or use `match` instead of `let...else`
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,10 @@ note: function defined here
|
||||||
LL | fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64;
|
LL | fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64;
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
||||||
|
|
|
||||||
|
LL | ($arr.len() * size_of($arr[0])).try_into().unwrap());
|
||||||
|
| + +++++++++++++++++++++
|
||||||
|
|
||||||
error[E0605]: non-primitive cast: `{integer}` as `()`
|
error[E0605]: non-primitive cast: `{integer}` as `()`
|
||||||
--> $DIR/issue-26480.rs:22:19
|
--> $DIR/issue-26480.rs:22:19
|
||||||
|
|
|
@ -92,7 +92,7 @@ LL | let (B(A(a, _) | B(a)) | A(a, A(a, _) | B(a))) = B(B(1));
|
||||||
| first introduced with type `{integer}` here
|
| first introduced with type `{integer}` here
|
||||||
|
|
|
|
||||||
= note: expected type `{integer}`
|
= note: expected type `{integer}`
|
||||||
found type `E<{integer}>`
|
found enum `E<{integer}>`
|
||||||
= note: a binding must have the same type in all alternatives
|
= note: a binding must have the same type in all alternatives
|
||||||
|
|
||||||
error: aborting due to 15 previous errors
|
error: aborting due to 15 previous errors
|
||||||
|
|
|
@ -57,8 +57,8 @@ LL | let (Ok(ref a) | Err(ref mut a)): Result<&u8, &mut u8> = Ok(&0);
|
||||||
| | types differ in mutability
|
| | types differ in mutability
|
||||||
| first introduced with type `&&u8` here
|
| first introduced with type `&&u8` here
|
||||||
|
|
|
|
||||||
= note: expected type `&&u8`
|
= note: expected reference `&&u8`
|
||||||
found type `&mut &mut u8`
|
found mutable reference `&mut &mut u8`
|
||||||
= note: a binding must have the same type in all alternatives
|
= note: a binding must have the same type in all alternatives
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
|
@ -70,8 +70,8 @@ LL | let (Ok((ref a, b)) | Err((ref mut a, ref b))) = Ok((0, &0));
|
||||||
| | types differ in mutability
|
| | types differ in mutability
|
||||||
| first introduced with type `&{integer}` here
|
| first introduced with type `&{integer}` here
|
||||||
|
|
|
|
||||||
= note: expected type `&{integer}`
|
= note: expected reference `&{integer}`
|
||||||
found type `&mut _`
|
found mutable reference `&mut _`
|
||||||
= note: a binding must have the same type in all alternatives
|
= note: a binding must have the same type in all alternatives
|
||||||
|
|
||||||
error: aborting due to 9 previous errors
|
error: aborting due to 9 previous errors
|
||||||
|
|
|
@ -316,6 +316,9 @@ LL | if let X.. .0 = 0 {}
|
||||||
| | |
|
| | |
|
||||||
| | expected integer, found floating-point number
|
| | expected integer, found floating-point number
|
||||||
| this is of type `u8`
|
| this is of type `u8`
|
||||||
|
|
|
||||||
|
= note: expected type `u8`
|
||||||
|
found type `{float}`
|
||||||
|
|
||||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||||
--> $DIR/recover-range-pats.rs:33:12
|
--> $DIR/recover-range-pats.rs:33:12
|
||||||
|
@ -350,6 +353,9 @@ LL | if let X..=.0 = 0 {}
|
||||||
| | |
|
| | |
|
||||||
| | expected integer, found floating-point number
|
| | expected integer, found floating-point number
|
||||||
| this is of type `u8`
|
| this is of type `u8`
|
||||||
|
|
|
||||||
|
= note: expected type `u8`
|
||||||
|
found type `{float}`
|
||||||
|
|
||||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||||
--> $DIR/recover-range-pats.rs:54:12
|
--> $DIR/recover-range-pats.rs:54:12
|
||||||
|
@ -384,6 +390,9 @@ LL | if let X... .0 = 0 {}
|
||||||
| | |
|
| | |
|
||||||
| | expected integer, found floating-point number
|
| | expected integer, found floating-point number
|
||||||
| this is of type `u8`
|
| this is of type `u8`
|
||||||
|
|
|
||||||
|
= note: expected type `u8`
|
||||||
|
found type `{float}`
|
||||||
|
|
||||||
error[E0029]: only `char` and numeric types are allowed in range patterns
|
error[E0029]: only `char` and numeric types are allowed in range patterns
|
||||||
--> $DIR/recover-range-pats.rs:73:12
|
--> $DIR/recover-range-pats.rs:73:12
|
||||||
|
|
|
@ -25,7 +25,7 @@ error[E0308]: cannot coerce intrinsics to function pointers
|
||||||
LL | std::intrinsics::unlikely,
|
LL | std::intrinsics::unlikely,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot coerce intrinsics to function pointers
|
||||||
|
|
|
|
||||||
= note: expected type `extern "rust-intrinsic" fn(_) -> _ {likely}`
|
= note: expected fn item `extern "rust-intrinsic" fn(_) -> _ {likely}`
|
||||||
found fn item `extern "rust-intrinsic" fn(_) -> _ {unlikely}`
|
found fn item `extern "rust-intrinsic" fn(_) -> _ {unlikely}`
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
|
@ -54,8 +54,8 @@ LL | Opts::A(ref mut i) | Opts::B(ref i) => {}
|
||||||
| |
|
| |
|
||||||
| first introduced with type `&mut isize` here
|
| first introduced with type `&mut isize` here
|
||||||
|
|
|
|
||||||
= note: expected type `&mut isize`
|
= note: expected mutable reference `&mut isize`
|
||||||
found type `&isize`
|
found reference `&isize`
|
||||||
= note: in the same arm, a binding must have the same type in all alternatives
|
= note: in the same arm, a binding must have the same type in all alternatives
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
error: aborting due to 6 previous errors
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | match &s {
|
||||||
LL | "abc" => true,
|
LL | "abc" => true,
|
||||||
| ^^^^^ expected `&str`, found `str`
|
| ^^^^^ expected `&str`, found `str`
|
||||||
|
|
|
|
||||||
= note: expected type `&&str`
|
= note: expected reference `&&str`
|
||||||
found reference `&'static str`
|
found reference `&'static str`
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
|
@ -17,7 +17,7 @@ LL | match &s {
|
||||||
LL | b"abc" => true,
|
LL | b"abc" => true,
|
||||||
| ^^^^^^ expected `&[u8]`, found array `[u8; 3]`
|
| ^^^^^^ expected `&[u8]`, found array `[u8; 3]`
|
||||||
|
|
|
|
||||||
= note: expected type `&&[u8]`
|
= note: expected reference `&&[u8]`
|
||||||
found reference `&'static [u8; 3]`
|
found reference `&'static [u8; 3]`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
fn main() {
|
|
||||||
let f = |x| x * 3;
|
|
||||||
let a = f(); //~ ERROR E0057
|
|
||||||
let b = f(4);
|
|
||||||
let c = f(2, 3); //~ ERROR E0057
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
error[E0057]: this function takes 1 argument but 0 arguments were supplied
|
|
||||||
--> $DIR/E0057.rs:3:13
|
|
||||||
|
|
|
||||||
LL | let a = f();
|
|
||||||
| ^-- an argument is missing
|
|
||||||
|
|
|
||||||
help: provide the argument
|
|
||||||
|
|
|
||||||
LL | let a = f({_});
|
|
||||||
| ~~~~~~
|
|
||||||
|
|
||||||
error[E0057]: this function takes 1 argument but 2 arguments were supplied
|
|
||||||
--> $DIR/E0057.rs:5:13
|
|
||||||
|
|
|
||||||
LL | let c = f(2, 3);
|
|
||||||
| ^ - argument unexpected
|
|
||||||
|
|
|
||||||
help: remove the extra argument
|
|
||||||
|
|
|
||||||
LL | let c = f(2);
|
|
||||||
| ~~~~
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0057`.
|
|
|
@ -19,7 +19,7 @@ note: while checking the return type of the `async fn`
|
||||||
|
|
|
|
||||||
LL | pub async fn answer_str(&self, _s: &str) -> Test {
|
LL | pub async fn answer_str(&self, _s: &str) -> Test {
|
||||||
| ^^^^ checked the `Output` of this `async fn`, found opaque type
|
| ^^^^ checked the `Output` of this `async fn`, found opaque type
|
||||||
= note: expected type `()`
|
= note: expected unit type `()`
|
||||||
found opaque type `impl Future<Output = Test>`
|
found opaque type `impl Future<Output = Test>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
|
@ -16,6 +16,9 @@ fn extra_semicolon() {
|
||||||
async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
|
async fn async_dummy() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
|
||||||
//~| NOTE while checking the return type of the `async fn`
|
//~| NOTE while checking the return type of the `async fn`
|
||||||
//~| NOTE in this expansion of desugaring of `async` block or function
|
//~| NOTE in this expansion of desugaring of `async` block or function
|
||||||
|
//~| NOTE checked the `Output` of this `async fn`, expected opaque type
|
||||||
|
//~| NOTE while checking the return type of the `async fn`
|
||||||
|
//~| NOTE in this expansion of desugaring of `async` block or function
|
||||||
async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
|
async fn async_dummy2() {} //~ NOTE checked the `Output` of this `async fn`, found opaque type
|
||||||
//~| NOTE checked the `Output` of this `async fn`, found opaque type
|
//~| NOTE checked the `Output` of this `async fn`, found opaque type
|
||||||
//~| NOTE while checking the return type of the `async fn`
|
//~| NOTE while checking the return type of the `async fn`
|
||||||
|
@ -31,7 +34,7 @@ async fn async_extra_semicolon_same() {
|
||||||
}
|
}
|
||||||
false => async_dummy(), //~ ERROR `match` arms have incompatible types
|
false => async_dummy(), //~ ERROR `match` arms have incompatible types
|
||||||
//~^ NOTE expected `()`, found opaque type
|
//~^ NOTE expected `()`, found opaque type
|
||||||
//~| NOTE expected type `()`
|
//~| NOTE expected unit type `()`
|
||||||
//~| HELP consider `await`ing on the `Future`
|
//~| HELP consider `await`ing on the `Future`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -44,7 +47,7 @@ async fn async_extra_semicolon_different() {
|
||||||
}
|
}
|
||||||
false => async_dummy2(), //~ ERROR `match` arms have incompatible types
|
false => async_dummy2(), //~ ERROR `match` arms have incompatible types
|
||||||
//~^ NOTE expected `()`, found opaque type
|
//~^ NOTE expected `()`, found opaque type
|
||||||
//~| NOTE expected type `()`
|
//~| NOTE expected unit type `()`
|
||||||
//~| HELP consider `await`ing on the `Future`
|
//~| HELP consider `await`ing on the `Future`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -55,7 +58,7 @@ async fn async_different_futures() {
|
||||||
//~| HELP consider `await`ing on both `Future`s
|
//~| HELP consider `await`ing on both `Future`s
|
||||||
false => async_dummy2(), //~ ERROR `match` arms have incompatible types
|
false => async_dummy2(), //~ ERROR `match` arms have incompatible types
|
||||||
//~^ NOTE expected opaque type, found a different opaque type
|
//~^ NOTE expected opaque type, found a different opaque type
|
||||||
//~| NOTE expected type `impl Future<Output = ()>`
|
//~| NOTE expected opaque type `impl Future<Output = ()>`
|
||||||
//~| NOTE distinct uses of `impl Trait` result in different opaque types
|
//~| NOTE distinct uses of `impl Trait` result in different opaque types
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0308]: `match` arms have incompatible types
|
error[E0308]: `match` arms have incompatible types
|
||||||
--> $DIR/match-prev-arm-needing-semi.rs:32:18
|
--> $DIR/match-prev-arm-needing-semi.rs:35:18
|
||||||
|
|
|
|
||||||
LL | let _ = match true {
|
LL | let _ = match true {
|
||||||
| _____________-
|
| _____________-
|
||||||
|
@ -20,7 +20,7 @@ note: while checking the return type of the `async fn`
|
||||||
|
|
|
|
||||||
LL | async fn async_dummy() {}
|
LL | async fn async_dummy() {}
|
||||||
| ^ checked the `Output` of this `async fn`, found opaque type
|
| ^ checked the `Output` of this `async fn`, found opaque type
|
||||||
= note: expected type `()`
|
= note: expected unit type `()`
|
||||||
found opaque type `impl Future<Output = ()>`
|
found opaque type `impl Future<Output = ()>`
|
||||||
help: consider `await`ing on the `Future`
|
help: consider `await`ing on the `Future`
|
||||||
|
|
|
|
||||||
|
@ -33,7 +33,7 @@ LL + async_dummy()
|
||||||
|
|
|
|
||||||
|
|
||||||
error[E0308]: `match` arms have incompatible types
|
error[E0308]: `match` arms have incompatible types
|
||||||
--> $DIR/match-prev-arm-needing-semi.rs:45:18
|
--> $DIR/match-prev-arm-needing-semi.rs:48:18
|
||||||
|
|
|
|
||||||
LL | let _ = match true {
|
LL | let _ = match true {
|
||||||
| _____________-
|
| _____________-
|
||||||
|
@ -50,11 +50,11 @@ LL | | };
|
||||||
| |_____- `match` arms have incompatible types
|
| |_____- `match` arms have incompatible types
|
||||||
|
|
|
|
||||||
note: while checking the return type of the `async fn`
|
note: while checking the return type of the `async fn`
|
||||||
--> $DIR/match-prev-arm-needing-semi.rs:19:25
|
--> $DIR/match-prev-arm-needing-semi.rs:22:25
|
||||||
|
|
|
|
||||||
LL | async fn async_dummy2() {}
|
LL | async fn async_dummy2() {}
|
||||||
| ^ checked the `Output` of this `async fn`, found opaque type
|
| ^ checked the `Output` of this `async fn`, found opaque type
|
||||||
= note: expected type `()`
|
= note: expected unit type `()`
|
||||||
found opaque type `impl Future<Output = ()>`
|
found opaque type `impl Future<Output = ()>`
|
||||||
help: consider `await`ing on the `Future`
|
help: consider `await`ing on the `Future`
|
||||||
|
|
|
|
||||||
|
@ -69,7 +69,7 @@ LL ~ false => Box::new(async_dummy2()),
|
||||||
|
|
|
|
||||||
|
|
||||||
error[E0308]: `match` arms have incompatible types
|
error[E0308]: `match` arms have incompatible types
|
||||||
--> $DIR/match-prev-arm-needing-semi.rs:56:18
|
--> $DIR/match-prev-arm-needing-semi.rs:59:18
|
||||||
|
|
|
|
||||||
LL | let _ = match true {
|
LL | let _ = match true {
|
||||||
| _____________-
|
| _____________-
|
||||||
|
@ -84,12 +84,17 @@ LL | | };
|
||||||
| |_____- `match` arms have incompatible types
|
| |_____- `match` arms have incompatible types
|
||||||
|
|
|
|
||||||
note: while checking the return type of the `async fn`
|
note: while checking the return type of the `async fn`
|
||||||
--> $DIR/match-prev-arm-needing-semi.rs:19:25
|
--> $DIR/match-prev-arm-needing-semi.rs:16:24
|
||||||
|
|
|
||||||
|
LL | async fn async_dummy() {}
|
||||||
|
| ^ checked the `Output` of this `async fn`, expected opaque type
|
||||||
|
note: while checking the return type of the `async fn`
|
||||||
|
--> $DIR/match-prev-arm-needing-semi.rs:22:25
|
||||||
|
|
|
|
||||||
LL | async fn async_dummy2() {}
|
LL | async fn async_dummy2() {}
|
||||||
| ^ checked the `Output` of this `async fn`, found opaque type
|
| ^ checked the `Output` of this `async fn`, found opaque type
|
||||||
= note: expected type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>)
|
= note: expected opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>)
|
||||||
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:19:25>)
|
found opaque type `impl Future<Output = ()>` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:22:25>)
|
||||||
= note: distinct uses of `impl Trait` result in different opaque types
|
= note: distinct uses of `impl Trait` result in different opaque types
|
||||||
help: consider `await`ing on both `Future`s
|
help: consider `await`ing on both `Future`s
|
||||||
|
|
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ LL | | _ => Box::new(Bar),
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____- `match` arms have incompatible types
|
| |_____- `match` arms have incompatible types
|
||||||
|
|
|
|
||||||
= note: expected type `Box<Baz>`
|
= note: expected struct `Box<Baz>`
|
||||||
found struct `Box<Bar>`
|
found struct `Box<Bar>`
|
||||||
note: you might have meant to return the `match` expression
|
note: you might have meant to return the `match` expression
|
||||||
--> $DIR/match-with-different-arm-types-as-stmt-instead-of-expr.rs:27:6
|
--> $DIR/match-with-different-arm-types-as-stmt-instead-of-expr.rs:27:6
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
error[E0308]: `if` and `else` have incompatible types
|
error[E0308]: `if` and `else` have incompatible types
|
||||||
--> $DIR/opaque-type-error.rs:20:9
|
--> $DIR/opaque-type-error.rs:20:9
|
||||||
|
|
|
|
||||||
|
LL | fn thing_one() -> impl Future<Output = Result<(), ()>> {
|
||||||
|
| ------------------------------------ the expected opaque type
|
||||||
|
...
|
||||||
LL | fn thing_two() -> impl Future<Output = Result<(), ()>> {
|
LL | fn thing_two() -> impl Future<Output = Result<(), ()>> {
|
||||||
| ------------------------------------ the found opaque type
|
| ------------------------------------ the found opaque type
|
||||||
...
|
...
|
||||||
|
@ -13,7 +16,7 @@ LL | | thing_two()
|
||||||
LL | | }.await
|
LL | | }.await
|
||||||
| |_____- `if` and `else` have incompatible types
|
| |_____- `if` and `else` have incompatible types
|
||||||
|
|
|
|
||||||
= note: expected type `impl Future<Output = Result<(), ()>>` (opaque type at <$DIR/opaque-type-error.rs:8:19>)
|
= note: expected opaque type `impl Future<Output = Result<(), ()>>` (opaque type at <$DIR/opaque-type-error.rs:8:19>)
|
||||||
found opaque type `impl Future<Output = Result<(), ()>>` (opaque type at <$DIR/opaque-type-error.rs:12:19>)
|
found opaque type `impl Future<Output = Result<(), ()>>` (opaque type at <$DIR/opaque-type-error.rs:12:19>)
|
||||||
= note: distinct uses of `impl Trait` result in different opaque types
|
= note: distinct uses of `impl Trait` result in different opaque types
|
||||||
help: consider `await`ing on both `Future`s
|
help: consider `await`ing on both `Future`s
|
||||||
|
|
|
@ -9,7 +9,7 @@ LL | builder.push(output);
|
||||||
| |
|
| |
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
= note: expected type `F`
|
= note: expected type parameter `F`
|
||||||
found struct `Class<P>`
|
found struct `Class<P>`
|
||||||
note: associated function defined here
|
note: associated function defined here
|
||||||
--> $DIR/issue-52893.rs:11:8
|
--> $DIR/issue-52893.rs:11:8
|
||||||
|
|
|
@ -8,6 +8,11 @@ LL | | let b = 1;
|
||||||
LL | | });
|
LL | | });
|
||||||
| |_____- argument unexpected
|
| |_____- argument unexpected
|
||||||
|
|
|
|
||||||
|
note: closure defined here
|
||||||
|
--> $DIR/wrong_argument_ice-4.rs:2:6
|
||||||
|
|
|
||||||
|
LL | (|| {})(|| {
|
||||||
|
| ^^
|
||||||
help: remove the extra argument
|
help: remove the extra argument
|
||||||
|
|
|
|
||||||
LL | (|| {})();
|
LL | (|| {})();
|
||||||
|
|
|
@ -6,6 +6,11 @@ LL | let z = f(1_usize, 2);
|
||||||
| |
|
| |
|
||||||
| arguments to this function are incorrect
|
| arguments to this function are incorrect
|
||||||
|
|
|
|
||||||
|
note: closure defined here
|
||||||
|
--> $DIR/unboxed-closures-type-mismatch.rs:4:17
|
||||||
|
|
|
||||||
|
LL | let mut f = |x: isize, y: isize| -> isize { x + y };
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
help: change the type of the numeric literal from `usize` to `isize`
|
help: change the type of the numeric literal from `usize` to `isize`
|
||||||
|
|
|
|
||||||
LL | let z = f(1_isize, 2);
|
LL | let z = f(1_isize, 2);
|
||||||
|
|
|
@ -3,7 +3,10 @@ error[E0308]: `if` and `else` have incompatible types
|
||||||
|
|
|
|
||||||
LL | / if a % 2 == 0 {
|
LL | / if a % 2 == 0 {
|
||||||
LL | | move || println!("{a}")
|
LL | | move || println!("{a}")
|
||||||
| | ----------------------- expected because of this
|
| | -----------------------
|
||||||
|
| | |
|
||||||
|
| | the expected closure
|
||||||
|
| | expected because of this
|
||||||
LL | | } else {
|
LL | | } else {
|
||||||
LL | | Box::new(move || println!("{}", b))
|
LL | | Box::new(move || println!("{}", b))
|
||||||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found struct `Box`
|
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found struct `Box`
|
||||||
|
@ -11,7 +14,7 @@ LL | |
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_____- `if` and `else` have incompatible types
|
| |_____- `if` and `else` have incompatible types
|
||||||
|
|
|
|
||||||
= note: expected type `[closure@$DIR/box-instead-of-dyn-fn.rs:8:9: 8:32]`
|
= note: expected closure `[closure@$DIR/box-instead-of-dyn-fn.rs:8:9: 8:32]`
|
||||||
found struct `Box<[closure@$DIR/box-instead-of-dyn-fn.rs:10:18: 10:43]>`
|
found struct `Box<[closure@$DIR/box-instead-of-dyn-fn.rs:10:18: 10:43]>`
|
||||||
|
|
||||||
error[E0746]: return type cannot have an unboxed trait object
|
error[E0746]: return type cannot have an unboxed trait object
|
||||||
|
|
|
@ -9,7 +9,7 @@ LL | | None => &R,
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_____- `match` arms have incompatible types
|
| |_____- `match` arms have incompatible types
|
||||||
|
|
|
|
||||||
= note: expected type `&S`
|
= note: expected reference `&S`
|
||||||
found reference `&R`
|
found reference `&R`
|
||||||
|
|
||||||
error[E0038]: the trait `Trait` cannot be made into an object
|
error[E0038]: the trait `Trait` cannot be made into an object
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue